]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
samples/seccomp: Zero out members based on seccomp_notif_sizes
authorSargun Dhillon <sargun@sargun.me>
Mon, 30 Dec 2019 20:35:03 +0000 (12:35 -0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 06:00:53 +0000 (01:00 -0500)
commitd4c16100bdf347e5203775a15b8059528985ac42
treecde98a3bd23283aff00647e532e813609b3d7c68
parent29a00b1b54e481c0f61a9e61968c0e84f3a85e0b
samples/seccomp: Zero out members based on seccomp_notif_sizes

BugLink: https://bugs.launchpad.net/bugs/1861710
commit 771b894f2f3dfedc2ba5561731fffa0e39b1bbb6 upstream.

The sizes by which seccomp_notif and seccomp_notif_resp are allocated are
based on the SECCOMP_GET_NOTIF_SIZES ioctl. This allows for graceful
extension of these datastructures. If userspace zeroes out the
datastructure based on its version, and it is lagging behind the kernel's
version, it will end up sending trailing garbage. On the other hand,
if it is ahead of the kernel version, it will write extra zero space,
and potentially cause corruption.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Suggested-by: Tycho Andersen <tycho@tycho.ws>
Link: https://lore.kernel.org/r/20191230203503.4925-1-sargun@sargun.me
Fixes: fec7b6690541 ("samples: add an example of seccomp user trap")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
samples/seccomp/user-trap.c