Commit e547ff3f authored by Chenbo Feng's avatar Chenbo Feng Committed by Alexei Starovoitov

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: default avatarChenbo Feng <fengc@google.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 2407a88a
......@@ -518,7 +518,7 @@ int bpf_obj_get_user(const char __user *pathname, int flags)
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment