selftests/seccomp: Zero out seccomp_notif
authorSargun Dhillon <sargun@sargun.me>
Sun, 29 Dec 2019 06:24:49 +0000 (22:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2020 09:19:57 +0000 (10:19 +0100)
commite0c77c3fa8aeb4811155c485e5be24805d6842c3
tree5f83ec448cc49bc029258892cd68332f79d3ae35
parent72893303a6d2fb8d65c00f463bc443c3eab72808
selftests/seccomp: Zero out seccomp_notif

commit 88c13f8bd71472fbab5338b01d99122908c77e53 upstream.

The seccomp_notif structure should be zeroed out prior to calling the
SECCOMP_IOCTL_NOTIF_RECV ioctl. Previously, the kernel did not check
whether these structures were zeroed out or not, so these worked.

This patch zeroes out the seccomp_notif data structure prior to calling
the ioctl.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Reviewed-by: Tycho Andersen <tycho@tycho.ws>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20191229062451.9467-1-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>
tools/testing/selftests/seccomp/seccomp_bpf.c