summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenbo Feng <fengc@google.com>2019-05-14 19:42:57 -0700
committerMichael Bestas <mkbestas@lineageos.org>2022-04-19 00:51:28 +0300
commit64d6e2e3b447d0e3d417dfb6c8570cd10f3da8d3 (patch)
tree69339b3c139b55ef59a6b87668315790448da33c
parent51086b4424106d5659cca4a95dcbdc7cd3bbc15d (diff)
UPSTREAM: bpf: relax inode permission check for retrieving bpf program
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> (cherry picked from commit e547ff3f803e779a3898f1f48447b29f43c54085) Bug: 129650054 Change-Id: I71487ad6f4d22e0a8be3757d9b72d1c04c92104d (cherry picked from commit 9e74c1b9e8418aa0209b15db24f0b3d4876f52aa) Signed-off-by: Chatur27 <jasonbright2709@gmail.com>
-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 56f3ab785c68..5a52c25ba18a 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -325,7 +325,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);