mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
seccomp: Check that seccomp_notif is zeroed out by the user
commit2882d53c9c
upstream. This patch is a small change in enforcement of the uapi for SECCOMP_IOCTL_NOTIF_RECV ioctl. Specifically, the datastructure which is passed (seccomp_notif) must be zeroed out. Previously any of its members could be set to nonsense values, and we would ignore it. This ensures all fields are set to their zero value. Signed-off-by: Sargun Dhillon <sargun@sargun.me> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Reviewed-by: Aleksa Sarai <cyphar@cyphar.com> Acked-by: Tycho Andersen <tycho@tycho.ws> Link: https://lore.kernel.org/r/20191229062451.9467-2-sargun@sargun.me Fixes:6a21cc50f0
("seccomp: add a return code to trap to userspace") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e0c77c3fa8
commit
f75e60d239
1 changed files with 7 additions and 0 deletions
|
@ -1015,6 +1015,13 @@ static long seccomp_notify_recv(struct seccomp_filter *filter,
|
|||
struct seccomp_notif unotif;
|
||||
ssize_t ret;
|
||||
|
||||
/* Verify that we're not given garbage to keep struct extensible. */
|
||||
ret = check_zeroed_user(buf, sizeof(unotif));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!ret)
|
||||
return -EINVAL;
|
||||
|
||||
memset(&unotif, 0, sizeof(unotif));
|
||||
|
||||
ret = down_interruptible(&filter->notif->request);
|
||||
|
|
Loading…
Reference in a new issue