提交 d24f7c7f 编写于 作者: H Hannes Frederic Sowa 提交者: David S. Miller

bpf: bpf_lock on kallsysms doesn't need to be irqsave

Hannes rightfully spotted that the bpf_lock doesn't need to be
irqsave variant. We never perform any such updates where this
would be necessary (neither right now nor in future), therefore
relax this further.
Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Acked-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 728a853a
...@@ -394,27 +394,23 @@ static bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp) ...@@ -394,27 +394,23 @@ static bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp)
void bpf_prog_kallsyms_add(struct bpf_prog *fp) void bpf_prog_kallsyms_add(struct bpf_prog *fp)
{ {
unsigned long flags;
if (!bpf_prog_kallsyms_candidate(fp) || if (!bpf_prog_kallsyms_candidate(fp) ||
!capable(CAP_SYS_ADMIN)) !capable(CAP_SYS_ADMIN))
return; return;
spin_lock_irqsave(&bpf_lock, flags); spin_lock_bh(&bpf_lock);
bpf_prog_ksym_node_add(fp->aux); bpf_prog_ksym_node_add(fp->aux);
spin_unlock_irqrestore(&bpf_lock, flags); spin_unlock_bh(&bpf_lock);
} }
void bpf_prog_kallsyms_del(struct bpf_prog *fp) void bpf_prog_kallsyms_del(struct bpf_prog *fp)
{ {
unsigned long flags;
if (!bpf_prog_kallsyms_candidate(fp)) if (!bpf_prog_kallsyms_candidate(fp))
return; return;
spin_lock_irqsave(&bpf_lock, flags); spin_lock_bh(&bpf_lock);
bpf_prog_ksym_node_del(fp->aux); bpf_prog_ksym_node_del(fp->aux);
spin_unlock_irqrestore(&bpf_lock, flags); spin_unlock_bh(&bpf_lock);
} }
static struct bpf_prog *bpf_prog_kallsyms_find(unsigned long addr) static struct bpf_prog *bpf_prog_kallsyms_find(unsigned long addr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册