aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChenbo Feng <fengc@google.com>2019-05-14 19:42:57 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-25 18:22:31 +0200
commitd811930f74ac7a24342b1882fdfb9a01caca90d6 (patch)
tree152b275dbe987aef4018af7a1cc37fbad577a0a6
parentca7ef7e3ddfad32558d2aade0e827d720661eb13 (diff)
downloadlinux-yocto-d811930f74ac7a24342b1882fdfb9a01caca90d6.tar.gz
linux-yocto-d811930f74ac7a24342b1882fdfb9a01caca90d6.tar.bz2
linux-yocto-d811930f74ac7a24342b1882fdfb9a01caca90d6.zip
bpf: relax inode permission check for retrieving bpf program
commit e547ff3f803e779a3898f1f48447b29f43c54085 upstream. For iptable module to load a bpf program from a pinned location, it only retrieve a loaded program and cannot change the program content so requiring a write permission for it might not be necessary. Also when adding or removing an unrelated iptable rule, it might need to flush and reload the xt_bpf related rules as well and triggers the inode permission check. It might be better to remove the write premission check for the inode so we won't need to grant write access to all the processes that flush and restore iptables rules. Signed-off-by: Chenbo Feng <fengc@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--kernel/bpf/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 4a8f390a2b82..dc9d7ac8228d 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -518,7 +518,7 @@ out:
static struct bpf_prog *__get_prog_inode(struct inode *inode, enum bpf_prog_type type)
{
struct bpf_prog *prog;
- int ret = inode_permission(inode, MAY_READ | MAY_WRITE);
+ int ret = inode_permission(inode, MAY_READ);
if (ret)
return ERR_PTR(ret);