summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2020-06-15 15:42:46 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-19 08:15:58 +0200
commit0f09c88f207c0b6a45454e770829a7aba814059e (patch)
tree36f861131b7ebab898569a05ad4f016c9b397a0e /kernel
parent7915a3c04139cb44d26d8de3aed8abbfc735586f (diff)
downloadlinux-stable-0f09c88f207c0b6a45454e770829a7aba814059e.tar.gz
linux-stable-0f09c88f207c0b6a45454e770829a7aba814059e.tar.bz2
linux-stable-0f09c88f207c0b6a45454e770829a7aba814059e.zip
seccomp: Fix ioctl number for SECCOMP_IOCTL_NOTIF_ID_VALID
[ Upstream commit 47e33c05f9f07cac3de833e531bcac9ae052c7ca ] When SECCOMP_IOCTL_NOTIF_ID_VALID was first introduced it had the wrong direction flag set. While this isn't a big deal as nothing currently enforces these bits in the kernel, it should be defined correctly. Fix the define and provide support for the old command until it is no longer needed for backward compatibility. Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace") Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/seccomp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index 2c697ce7be21..e0fd97235653 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -42,6 +42,14 @@
#include <linux/uaccess.h>
#include <linux/anon_inodes.h>
+/*
+ * When SECCOMP_IOCTL_NOTIF_ID_VALID was first introduced, it had the
+ * wrong direction flag in the ioctl number. This is the broken one,
+ * which the kernel needs to keep supporting until all userspaces stop
+ * using the wrong command number.
+ */
+#define SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR SECCOMP_IOR(2, __u64)
+
enum notify_state {
SECCOMP_NOTIFY_INIT,
SECCOMP_NOTIFY_SENT,
@@ -1168,6 +1176,7 @@ static long seccomp_notify_ioctl(struct file *file, unsigned int cmd,
return seccomp_notify_recv(filter, buf);
case SECCOMP_IOCTL_NOTIF_SEND:
return seccomp_notify_send(filter, buf);
+ case SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR:
case SECCOMP_IOCTL_NOTIF_ID_VALID:
return seccomp_notify_id_valid(filter, buf);
default: