seccomp: Check that seccomp_notif is zeroed out by the user
authorSargun Dhillon <sargun@sargun.me>
Sun, 29 Dec 2019 06:24:50 +0000 (22:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2020 09:19:57 +0000 (10:19 +0100)
commitf75e60d239087a582ca3d828fb475422d8046b79
treeecead378cf01c26e37d1393341889177952abb11
parente0c77c3fa8aeb4811155c485e5be24805d6842c3
seccomp: Check that seccomp_notif is zeroed out by the user

commit 2882d53c9c6f3b8311d225062522f03772cf0179 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: 6a21cc50f0c7 ("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>
kernel/seccomp.c