linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] seccomp: Check flags on seccomp_notif is unset
@ 2019-12-25 21:45 Sargun Dhillon
  2019-12-26 11:52 ` Christian Brauner
  0 siblings, 1 reply; 13+ messages in thread
From: Sargun Dhillon @ 2019-12-25 21:45 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: tycho, jannh, christian.brauner, keescook

This patch is a small change in enforcement of the uapi for
SECCOMP_IOCTL_NOTIF_RECV ioctl. Specificaly, the datastructure which is
passed (seccomp_notif), has a flags member. Previously that could be
set to a nonsense value, and we would ignore it. This ensures that
no flags are set.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Cc: Kees Cook <keescook@chromium.org>
---
 kernel/seccomp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index 12d2227e5786..455925557490 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -1026,6 +1026,13 @@ static long seccomp_notify_recv(struct seccomp_filter *filter,
 	struct seccomp_notif unotif;
 	ssize_t ret;
 
+	if (copy_from_user(&unotif, buf, sizeof(unotif)))
+		return -EFAULT;
+
+	/* flags is reserved right now, make sure it's unset */
+	if (unotif.flags)
+		return -EINVAL;
+
 	memset(&unotif, 0, sizeof(unotif));
 
 	ret = down_interruptible(&filter->notif->request);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-12-27 15:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-25 21:45 [PATCH] seccomp: Check flags on seccomp_notif is unset Sargun Dhillon
2019-12-26 11:52 ` Christian Brauner
2019-12-26 14:32   ` Aleksa Sarai
2019-12-26 14:34     ` Christian Brauner
2019-12-27  2:24       ` Aleksa Sarai
2019-12-27  2:31         ` Aleksa Sarai
2019-12-27 11:47           ` Christian Brauner
2019-12-27 14:22             ` Sargun Dhillon
2019-12-27 14:38               ` Tycho Andersen
2019-12-27 15:15               ` Aleksa Sarai
2019-12-27 15:32                 ` Christian Brauner
2019-12-26 15:37     ` Tycho Andersen
2019-12-27  2:28       ` Aleksa Sarai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).