Skip to contentSkip to conversation

bpf: Fix tr dereferencing

PATCH Applied Leon Hwang 2 participants 2 messages Sep 17, 2023 – Sep 19, 2023

Subsystems (2)
lore
Share & tools
lore

Leon Hwang

author
#0 lore raw

PATCH v2 1/1 bpf: Fix tr dereferencing

Fix 'tr' dereferencing bug when CONFIG_BPF_JIT is turned off.

When CONFIG_BPF_JIT is turned off, 'bpf_trampoline_get()' returns NULL, which is same as the cases when CONFIG_BPF_JIT is turned on.

v1->v2:
* Comments from Alexei:
* Return NULL in that case.

Fixes f7b12b6fea00 ("bpf: verifier: refactor check_attach_btf_id()")
---
 include/linux/bpf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bpf.h +1 -1
index 024e8b28c34b8..49f8b691496c4 100644
@@ -1307,7 +1307,7 @@ static inline int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link,
 static inline struct bpf_trampoline *bpf_trampoline_get(u64 key,
 							struct bpf_attach_target_info *tgt_info)
 {
-	return ERR_PTR(-EOPNOTSUPP);
+	return NULL;
 }
 static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
 #define DEFINE_BPF_DISPATCHER(name)
Signature · 1 line
2.41.0
#1 lore raw
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 10 lines · On Sun, 17 Sep 2023 23:38:46 +0800 you wrote:

Fix 'tr' dereferencing bug when CONFIG_BPF_JIT is turned off.

When CONFIG_BPF_JIT is turned off, 'bpf_trampoline_get()' returns NULL, which is same as the cases when CONFIG_BPF_JIT is turned on.

v1->v2:
* Comments from Alexei:
* Return NULL in that case.

[...]

Here is the summary with links:
- [bpf,v2] bpf: Fix tr dereferencing

    https://git.kernel.org/bpf/bpf/c/b724a6418f1f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html