bpf: Set run context for rawtp test_run callback
Subsystems (2)
Jiri Olsa
reviewerPATCH v2 1/1 bpf: Set run context for rawtp test_run callback
syzbot reported crash when rawtp program executed through the test_run interface calls bpf_get_attach_cookie helper or any other helper that touches task->bpf_ctx pointer.
Setting the run context (task->bpf_ctx pointer) for test_run callback.
---
v2 changes:
- setting run context for test_run callback instead of using __bpf_trace_run [Alexei]
net/bpf/test_run.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bpf/test_run.c +6 -0
@@ -727,10 +727,16 @@ static void __bpf_prog_test_run_raw_tp(void *data) {struct bpf_raw_tp_test_run_info *info = data; +struct bpf_trace_run_ctx run_ctx = {}; +struct bpf_run_ctx *old_run_ctx; + + old_run_ctx =bpf_set_run_ctx (&run_ctx.run_ctx);rcu_read_lock (); info->retval =bpf_prog_run (info->prog, info->ctx);rcu_read_unlock (); + +bpf_reset_run_ctx (old_run_ctx); } int bpf_prog_test_run_raw_tp(struct bpf_prog *prog,
Signature · 1 line
2.45.1
This patch was applied to bpf/bpf.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf.git (master)
by Andrii Nakryiko <[email protected]>:
Quoted 8 lines · On Tue, 4 Jun 2024 17:00:24 +0200 you wrote:
syzbot reported crash when rawtp program executed through the
test_runinterface callsbpf_get_attach_cookiehelper or any other helper that touchestask->bpf_ctxpointer.Setting the run context (
task->bpf_ctxpointer) fortest_runcallback.[...]
Here is the summary with links:
- [PATCHv2,bpf] bpf: Set run context for rawtp test_run callback
https://git.kernel.org/bpf/bpf/c/f472e923bf4b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html