aboutsummaryrefslogtreecommitdiffstats
path: root/features/seccomp/net-compat.c-linux-filter.h-share-compat_sock_fprog.patch
diff options
context:
space:
mode:
Diffstat (limited to 'features/seccomp/net-compat.c-linux-filter.h-share-compat_sock_fprog.patch')
-rw-r--r--features/seccomp/net-compat.c-linux-filter.h-share-compat_sock_fprog.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/features/seccomp/net-compat.c-linux-filter.h-share-compat_sock_fprog.patch b/features/seccomp/net-compat.c-linux-filter.h-share-compat_sock_fprog.patch
new file mode 100644
index 00000000..f186f7c9
--- /dev/null
+++ b/features/seccomp/net-compat.c-linux-filter.h-share-compat_sock_fprog.patch
@@ -0,0 +1,80 @@
+From 01cef9b98077e652997585d35f765b4b69e33f51 Mon Sep 17 00:00:00 2001
+From: Will Drewry <wad@chromium.org>
+Date: Thu, 12 Apr 2012 16:47:53 -0500
+Subject: [PATCH] net/compat.c,linux/filter.h: share compat_sock_fprog
+
+commit 0c5fe1b4221c6701224c2601cf3c692e5721103e upstream.
+
+Any other users of bpf_*_filter that take a struct sock_fprog from
+userspace will need to be able to also accept a compat_sock_fprog
+if the arch supports compat calls. This change allows the existing
+compat_sock_fprog be shared.
+
+Signed-off-by: Will Drewry <wad@chromium.org>
+Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
+Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
+Acked-by: Eric Paris <eparis@redhat.com>
+
+v18: tasered by the apostrophe police
+v14: rebase/nochanges
+v13: rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc
+v12: rebase on to linux-next
+v11: introduction
+Signed-off-by: James Morris <james.l.morris@oracle.com>
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+---
+ include/linux/filter.h | 11 +++++++++++
+ net/compat.c | 8 --------
+ 2 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/include/linux/filter.h b/include/linux/filter.h
+index aaa2e80..f2e5315 100644
+--- a/include/linux/filter.h
++++ b/include/linux/filter.h
+@@ -10,6 +10,7 @@
+
+ #ifdef __KERNEL__
+ #include <linux/atomic.h>
++#include <linux/compat.h>
+ #endif
+
+ /*
+@@ -132,6 +133,16 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
+
+ #ifdef __KERNEL__
+
++#ifdef CONFIG_COMPAT
++/*
++ * A struct sock_filter is architecture independent.
++ */
++struct compat_sock_fprog {
++ u16 len;
++ compat_uptr_t filter; /* struct sock_filter * */
++};
++#endif
++
+ struct sk_buff;
+ struct sock;
+
+diff --git a/net/compat.c b/net/compat.c
+index e055708..242c828 100644
+--- a/net/compat.c
++++ b/net/compat.c
+@@ -328,14 +328,6 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)
+ __scm_destroy(scm);
+ }
+
+-/*
+- * A struct sock_filter is architecture independent.
+- */
+-struct compat_sock_fprog {
+- u16 len;
+- compat_uptr_t filter; /* struct sock_filter * */
+-};
+-
+ static int do_set_attach_filter(struct socket *sock, int level, int optname,
+ char __user *optval, unsigned int optlen)
+ {
+--
+1.7.9.1
+