Skip to contentSkip to conversation

bpf: Remove tst_run from lwt_seg6local_prog_ops.

PATCH Applied Sebastian Andrzej Siewior 4 participants 4 messages Jul 10, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Remove tst_run from lwt_seg6local_prog_ops.

The syzbot reported that the lwt_seg6 related BPF ops can be invoked via bpf_test_run() without without entering input_action_end_bpf() first.

Martin KaFai Lau said that self test for BPF_PROG_TYPE_LWT_SEG6LOCAL probably didn't work since it was introduced in commit 04d4b274e2a ("ipv6: sr: Add seg6local action End.BPF"). The reason is that the per-CPU variable seg6_bpf_srh_states::srh is never assigned in the self test case but each BPF function expects it.

Remove test_run for BPF_PROG_TYPE_LWT_SEG6LOCAL.

Reported-by [email protected]
Fixes d1542d4ae4df ("seg6: Use nested-BH locking for seg6_bpf_srh_states.")
---
 net/core/filter.c | 1 -
 1 file changed, 1 deletion(-)
net/core/filter.c +0 -1
index d767880c276d9..4cf1d34f76172 100644
@@ -11053,7 +11053,6 @@ const struct bpf_verifier_ops lwt_seg6local_verifier_ops = {
 };
 
 const struct bpf_prog_ops lwt_seg6local_prog_ops = {
-	.test_run		= bpf_prog_test_run_skb,
 };
 
 const struct bpf_verifier_ops cg_sock_verifier_ops = {
Signature · 1 line
2.45.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Sebastian Andrzej Siewior

The syzbot reported that the lwt_seg6 related BPF ops can be invoked via bpf_test_run() without without entering input_action_end_bpf() first.

Martin KaFai Lau said that self test for BPF_PROG_TYPE_LWT_SEG6LOCAL probably didn't work since it was introduced in commit 04d4b274e2a ("ipv6: sr: Add seg6local action End.BPF"). The reason is that the per-CPU variable seg6_bpf_srh_states::srh is never assigned in the self test case but each BPF function expects it.

Quoted 5 lines

Remove test_run for BPF_PROG_TYPE_LWT_SEG6LOCAL.

Reported-by [email protected]
Fixes d1542d4ae4df ("seg6: Use nested-BH locking for seg6_bpf_srh_states.")

We can also add in addition for reference:

Fixes 004d4b274e2a ("ipv6: sr: Add seg6local action End.BPF")
Quoted 1 line
#2 lore raw
Quoted 13 lines · Daniel Borkmann
Quoted 12 lines · Sebastian Andrzej Siewior

The syzbot reported that the lwt_seg6 related BPF ops can be invoked via bpf_test_run() without without entering input_action_end_bpf() first.

Martin KaFai Lau said that self test for BPF_PROG_TYPE_LWT_SEG6LOCAL probably didn't work since it was introduced in commit 04d4b274e2a ("ipv6: sr: Add seg6local action End.BPF"). The reason is that the per-CPU variable seg6_bpf_srh_states::srh is never assigned in the self test case but each BPF function expects it.

Remove test_run for BPF_PROG_TYPE_LWT_SEG6LOCAL.

Quoted 7 lines
Quoted 3 lines
Reported-by [email protected]
Fixes d1542d4ae4df ("seg6: Use nested-BH locking for seg6_bpf_srh_states.")

We can also add in addition for reference:

Fixes 004d4b274e2a ("ipv6: sr: Add seg6local action End.BPF")

Added the Fixes tag before applying.

Thanks!

#3 lore raw
In reply to Sebastian Andrzej Siewior
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:

Quoted 11 lines · On Wed, 10 Jul 2024 16:16:31 +0200 you wrote:

The syzbot reported that the lwt_seg6 related BPF ops can be invoked via bpf_test_run() without without entering input_action_end_bpf() first.

Martin KaFai Lau said that self test for BPF_PROG_TYPE_LWT_SEG6LOCAL probably didn't work since it was introduced in commit 04d4b274e2a ("ipv6: sr: Add seg6local action End.BPF"). The reason is that the per-CPU variable seg6_bpf_srh_states::srh is never assigned in the self test case but each BPF function expects it.

[...]

Here is the summary with links:
- [bpf-next] bpf: Remove tst_run from lwt_seg6local_prog_ops.

    https://git.kernel.org/bpf/bpf-next/c/c13fda93aca1

You are awesome, thank you!

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