selftests/seccomp: Catch garbage on SECCOMP_IOCTL_NOTIF_RECV
authorSargun Dhillon <sargun@sargun.me>
Mon, 30 Dec 2019 20:38:11 +0000 (12:38 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2020 09:19:58 +0000 (10:19 +0100)
commita61eb076ccaa22681ff225b4390b27f7a05e0b36
tree925b15bd6f8adcf7eb4dcbd91309446babb05ac6
parentde7cd9dfc578e8b1f6586ffbc0e24683c356d143
selftests/seccomp: Catch garbage on SECCOMP_IOCTL_NOTIF_RECV

commit e4ab5ccc357b978999328fadae164e098c26fa40 upstream.

This adds logic to the user_notification_basic test to set a member
of struct seccomp_notif to an invalid value to ensure that the kernel
returns EINVAL if any of the struct seccomp_notif members are set to
invalid values.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Suggested-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20191230203811.4996-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