projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f7e9cb1
)
bpf: require CAP_NET_ADMIN when using sockmap maps
author
John Fastabend
<john.fastabend@gmail.com>
Wed, 18 Oct 2017 14:11:22 +0000
(07:11 -0700)
committer
David S. Miller
<davem@davemloft.net>
Fri, 20 Oct 2017 12:01:29 +0000
(13:01 +0100)
Restrict sockmap to CAP_NET_ADMIN.
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/sockmap.c
patch
|
blob
|
blame
|
history
diff --git
a/kernel/bpf/sockmap.c
b/kernel/bpf/sockmap.c
index beaabb21c3a355944cce536047ebee02df77fdcf..2b6eb35ae5d39799a9ae33fe5bf07508d2b82a54 100644
(file)
--- a/
kernel/bpf/sockmap.c
+++ b/
kernel/bpf/sockmap.c
@@
-486,6
+486,9
@@
static struct bpf_map *sock_map_alloc(union bpf_attr *attr)
int err = -EINVAL;
u64 cost;
+ if (!capable(CAP_NET_ADMIN))
+ return ERR_PTR(-EPERM);
+
/* check sanity of attributes */
if (attr->max_entries == 0 || attr->key_size != 4 ||
attr->value_size != 4 || attr->map_flags & ~BPF_F_NUMA_NODE)