kcm: use BPF_PROG_RUN
Subsystems (3)
PATCH 1/1 kcm: use BPF_PROG_RUN
Instead of invoking struct bpf_prog::bpf_func directly, use the BPF_PROG_RUN macro.
--- net/kcm/kcmsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/kcm/kcmsock.c +1 -1
@@ -379,7 +379,7 @@ static int kcm_parse_func_strparser(struct strparser *strp, struct sk_buff *skb) struct kcm_psock *psock = container_of(strp, struct kcm_psock, strp);struct bpf_prog *prog = psock->bpf_prog; -return (*prog->bpf_func)(skb, prog->insnsi); +return BPF_PROG_RUN (prog, skb); }static int kcm_read_sock_done (struct strparser *strp,int err)
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
Quoted 4 lines · Sami Tolvanen
Instead of invoking struct
bpf_prog::bpf_funcdirectly, use theBPF_PROG_RUNmacro.Signed-off-by Sami Tolvanen <[email protected]>
Quoted 18 lines
--- net/kcm/kcmsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/kcm/kcmsock.c +1
-1@@ -379,7 +379,7 @@ static int kcm_parse_func_strparser(struct strparser *strp, struct sk_buff *skb) struct kcm_psock *psock = container_of(strp, struct kcm_psock, strp);struct bpf_prog *prog = psock->bpf_prog; -return (*prog->bpf_func)(skb, prog->insnsi); +return BPF_PROG_RUN (prog, skb); }static int kcm_read_sock_done (struct strparser *strp,int err)
Alexei Starovoitov
AppliedQuoted 10 lines · Yonghong Song
Quoted 4 lines · Sami Tolvanen
Instead of invoking struct
bpf_prog::bpf_funcdirectly, use theBPF_PROG_RUNmacro.Signed-off-by Sami Tolvanen <[email protected]>Acked-by Yonghong Song <[email protected]>
Applied. Thanks
Quoted 5 lines · Alexei Starovoitov
Quoted 4 lines · Yonghong Song
On 9/5/19 2:15 PM, Sami Tolvanen wrote:
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Instead of invoking struct
bpf_prog::bpf_funcdirectly, use theBPF_PROG_RUNmacro.Signed-off-by Sami Tolvanen <[email protected]>Acked-by Yonghong Song <[email protected]>Applied. Thanks
Then we probably need this as well, what do you think ?
net/kcm/kcmsock.c +6 -1
@@ -378,8 +378,13 @@ static int kcm_parse_func_strparser(struct strparser *strp, struct sk_buff *skb) { struct kcm_psock *psock = container_of(strp, struct kcm_psock, strp);struct bpf_prog *prog = psock->bpf_prog; +int res; -return BPF_PROG_RUN (prog, skb); +preempt_disable (); + res =BPF_PROG_RUN (prog, skb); +preempt_enable (); + +return res; }static int kcm_read_sock_done (struct strparser *strp,int err)
Daniel Borkmann
maintainerQuoted 6 lines · Eric Dumazet
Quoted 5 lines · Alexei Starovoitov
Quoted 4 lines · Yonghong Song
Quoted 3 lines · Sami Tolvanen
Instead of invoking struct
bpf_prog::bpf_funcdirectly, use theBPF_PROG_RUNmacro.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Sami Tolvanen <[email protected]>Acked-by Yonghong Song <[email protected]>Applied. Thanks
Then we probably need this as well, what do you think ?
Yep, it's broken. 6cab5e90ab2b ("bpf: run bpf programs with preemption disabled") probably forgot about it since it wasn't using BPF_PROG_RUN() in the first place. If you get a chance, please send a proper patch, thanks!
Quoted 19 lines
net/kcm/kcmsock.c +6
-1@@ -378,8 +378,13 @@ static int kcm_parse_func_strparser(struct strparser *strp, struct sk_buff *skb) { struct kcm_psock *psock = container_of(strp, struct kcm_psock, strp);struct bpf_prog *prog = psock->bpf_prog; +int res; -return BPF_PROG_RUN (prog, skb); +preempt_disable (); + res =BPF_PROG_RUN (prog, skb); +preempt_enable (); + +return res; }static int kcm_read_sock_done (struct strparser *strp,int err)
Quoted 11 lines · Daniel Borkmann
Quoted 10 lines · Eric Dumazet
Quoted 9 lines · Alexei Starovoitov
Quoted 7 lines · Yonghong Song
Quoted 4 lines · Sami Tolvanen
Instead of invoking struct
bpf_prog::bpf_funcdirectly, use theBPF_PROG_RUNmacro.Signed-off-by Sami Tolvanen <[email protected]>Acked-by Yonghong Song <[email protected]>
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Applied. Thanks
Then we probably need this as well, what do you think ?
Yep, it's broken.
6cab5e90ab2b("bpf: run bpf programs with preemption disabled") probably forgot about it since it wasn't usingBPF_PROG_RUN()in the first place. If you get a chance, please send a proper patch, thanks!
Sure, I will send this today.