* [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
@ 2025-02-01 3:01 Kuniyuki Iwashima
2025-02-01 3:16 ` Yan Zhai
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Kuniyuki Iwashima @ 2025-02-01 3:01 UTC (permalink / raw)
To: Martin KaFai Lau, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko
Cc: Kumar Kartikeya Dwivedi, Kuniyuki Iwashima, Kuniyuki Iwashima,
bpf, netdev, Yan Zhai
Yan Zhai reported a BPF prog could trigger a null-ptr-deref [0]
in trace_kfree_skb if the prog does not check if rx_sk is NULL.
Commit c53795d48ee8 ("net: add rx_sk to trace_kfree_skb") added
rx_sk to trace_kfree_skb, but rx_sk is optional and could be NULL.
Let's add kfree_skb to raw_tp_null_args[] to let the BPF verifier
validate such a prog and prevent the issue.
Now we fail to load such a prog:
libbpf: prog 'drop': -- BEGIN PROG LOAD LOG --
0: R1=ctx() R10=fp0
; int BPF_PROG(drop, struct sk_buff *skb, void *location, @ kfree_skb_sk_null.bpf.c:21
0: (79) r3 = *(u64 *)(r1 +24)
func 'kfree_skb' arg3 has btf_id 5253 type STRUCT 'sock'
1: R1=ctx() R3_w=trusted_ptr_or_null_sock(id=1)
; bpf_printk("sk: %d, %d\n", sk, sk->__sk_common.skc_family); @ kfree_skb_sk_null.bpf.c:24
1: (69) r4 = *(u16 *)(r3 +16)
R3 invalid mem access 'trusted_ptr_or_null_'
processed 2 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
-- END PROG LOAD LOG --
Note this fix requires commit 838a10bd2ebf ("bpf: Augment raw_tp
arguments with PTR_MAYBE_NULL").
[0]:
BUG: kernel NULL pointer dereference, address: 0000000000000010
PF: supervisor read access in kernel mode
PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
PREEMPT SMP
CPU: 6 UID: 0 PID: 348 Comm: sshd Not tainted 6.12.11 #206
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:bpf_prog_5e21a6db8fcff1aa_drop+0x10/0x2d
Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 0f 1f 00 55 48 89 e5 48 8b 57 18 <48> 0f b7 4a 10 48 bf 0c 4f e2 c1 ad 90 ff ff be 0c 00 00 00 e8 0f
RSP: 0018:ffffa86640b53da8 EFLAGS: 00010202
RAX: 0000000000000001 RBX: ffffa866402d1000 RCX: 0000000000000002
RDX: 0000000000000000 RSI: ffffa866402d1048 RDI: ffffa86640b53dc8
RBP: ffffa86640b53da8 R08: 0000000000000000 R09: 9c908cd09b9c8c91
R10: ffff90adc056b540 R11: 0000000000000002 R12: 0000000000000000
R13: ffffa86640b53e88 R14: 0000000000000800 R15: fffffffffffffffe
FS: 00007f2a27c2b480(0000) GS:ffff90b0efd00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000010 CR3: 0000000100e69004 CR4: 00000000001726f0
Call Trace:
<TASK>
? __die+0x1f/0x60
? page_fault_oops+0x148/0x420
? search_bpf_extables+0x5b/0x70
? fixup_exception+0x27/0x2c0
? exc_page_fault+0x75/0x170
? asm_exc_page_fault+0x22/0x30
? bpf_prog_5e21a6db8fcff1aa_drop+0x10/0x2d
bpf_trace_run4+0x68/0xd0
? unix_stream_connect+0x1f4/0x6f0
sk_skb_reason_drop+0x90/0x120
unix_stream_connect+0x1f4/0x6f0
__sys_connect+0x7f/0xb0
__x64_sys_connect+0x14/0x20
do_syscall_64+0x47/0xc30
entry_SYSCALL_64_after_hwframe+0x4b/0x53
RIP: 0033:0x7f2a27f296a0
Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 80 3d 41 ff 0c 00 00 74 17 b8 2a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 54
RSP: 002b:00007ffe29274f58 EFLAGS: 00000202 ORIG_RAX: 000000000000002a
Fixes: c53795d48ee8 ("net: add rx_sk to trace_kfree_skb")
Reported-by: Yan Zhai <yan@cloudflare.com>
Closes: https://lore.kernel.org/netdev/Z50zebTRzI962e6X@debian.debian/
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
v2:
* Add kfree_skb to raw_tp_null_args[] instead of annotating
rx_skb with __nullable
v1: https://lore.kernel.org/bpf/20250201001425.42377-1-kuniyu@amazon.com/
---
kernel/bpf/btf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 9de6acddd479..c3223e0db2f5 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6507,6 +6507,8 @@ static const struct bpf_raw_tp_null_args raw_tp_null_args[] = {
/* rxrpc */
{ "rxrpc_recvdata", 0x1 },
{ "rxrpc_resend", 0x10 },
+ /* skb */
+ {"kfree_skb", 0x1000},
/* sunrpc */
{ "xs_stream_read_data", 0x1 },
/* ... from xprt_cong_event event class */
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
2025-02-01 3:01 [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[] Kuniyuki Iwashima
@ 2025-02-01 3:16 ` Yan Zhai
2025-02-01 8:13 ` Jiri Olsa
2025-02-03 13:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: Yan Zhai @ 2025-02-01 3:16 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: Martin KaFai Lau, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Kumar Kartikeya Dwivedi, Kuniyuki Iwashima, bpf,
netdev
On Fri, Jan 31, 2025 at 9:02 PM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> Yan Zhai reported a BPF prog could trigger a null-ptr-deref [0]
> in trace_kfree_skb if the prog does not check if rx_sk is NULL.
>
> Commit c53795d48ee8 ("net: add rx_sk to trace_kfree_skb") added
> rx_sk to trace_kfree_skb, but rx_sk is optional and could be NULL.
>
> Let's add kfree_skb to raw_tp_null_args[] to let the BPF verifier
> validate such a prog and prevent the issue.
>
> Now we fail to load such a prog:
>
> libbpf: prog 'drop': -- BEGIN PROG LOAD LOG --
> 0: R1=ctx() R10=fp0
> ; int BPF_PROG(drop, struct sk_buff *skb, void *location, @ kfree_skb_sk_null.bpf.c:21
> 0: (79) r3 = *(u64 *)(r1 +24)
> func 'kfree_skb' arg3 has btf_id 5253 type STRUCT 'sock'
> 1: R1=ctx() R3_w=trusted_ptr_or_null_sock(id=1)
> ; bpf_printk("sk: %d, %d\n", sk, sk->__sk_common.skc_family); @ kfree_skb_sk_null.bpf.c:24
> 1: (69) r4 = *(u16 *)(r3 +16)
> R3 invalid mem access 'trusted_ptr_or_null_'
> processed 2 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
> -- END PROG LOAD LOG --
>
> Note this fix requires commit 838a10bd2ebf ("bpf: Augment raw_tp
> arguments with PTR_MAYBE_NULL").
>
> [0]:
> BUG: kernel NULL pointer dereference, address: 0000000000000010
> PF: supervisor read access in kernel mode
> PF: error_code(0x0000) - not-present page
> PGD 0 P4D 0
> PREEMPT SMP
> CPU: 6 UID: 0 PID: 348 Comm: sshd Not tainted 6.12.11 #206
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> RIP: 0010:bpf_prog_5e21a6db8fcff1aa_drop+0x10/0x2d
> Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 0f 1f 00 55 48 89 e5 48 8b 57 18 <48> 0f b7 4a 10 48 bf 0c 4f e2 c1 ad 90 ff ff be 0c 00 00 00 e8 0f
> RSP: 0018:ffffa86640b53da8 EFLAGS: 00010202
> RAX: 0000000000000001 RBX: ffffa866402d1000 RCX: 0000000000000002
> RDX: 0000000000000000 RSI: ffffa866402d1048 RDI: ffffa86640b53dc8
> RBP: ffffa86640b53da8 R08: 0000000000000000 R09: 9c908cd09b9c8c91
> R10: ffff90adc056b540 R11: 0000000000000002 R12: 0000000000000000
> R13: ffffa86640b53e88 R14: 0000000000000800 R15: fffffffffffffffe
> FS: 00007f2a27c2b480(0000) GS:ffff90b0efd00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000010 CR3: 0000000100e69004 CR4: 00000000001726f0
> Call Trace:
> <TASK>
> ? __die+0x1f/0x60
> ? page_fault_oops+0x148/0x420
> ? search_bpf_extables+0x5b/0x70
> ? fixup_exception+0x27/0x2c0
> ? exc_page_fault+0x75/0x170
> ? asm_exc_page_fault+0x22/0x30
> ? bpf_prog_5e21a6db8fcff1aa_drop+0x10/0x2d
> bpf_trace_run4+0x68/0xd0
> ? unix_stream_connect+0x1f4/0x6f0
> sk_skb_reason_drop+0x90/0x120
> unix_stream_connect+0x1f4/0x6f0
> __sys_connect+0x7f/0xb0
> __x64_sys_connect+0x14/0x20
> do_syscall_64+0x47/0xc30
> entry_SYSCALL_64_after_hwframe+0x4b/0x53
> RIP: 0033:0x7f2a27f296a0
> Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 80 3d 41 ff 0c 00 00 74 17 b8 2a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 54
> RSP: 002b:00007ffe29274f58 EFLAGS: 00000202 ORIG_RAX: 000000000000002a
>
> Fixes: c53795d48ee8 ("net: add rx_sk to trace_kfree_skb")
> Reported-by: Yan Zhai <yan@cloudflare.com>
> Closes: https://lore.kernel.org/netdev/Z50zebTRzI962e6X@debian.debian/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Tested-by: Yan Zhai <yan@cloudflare.com>
> ---
> v2:
> * Add kfree_skb to raw_tp_null_args[] instead of annotating
> rx_skb with __nullable
>
> v1: https://lore.kernel.org/bpf/20250201001425.42377-1-kuniyu@amazon.com/
> ---
> kernel/bpf/btf.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 9de6acddd479..c3223e0db2f5 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -6507,6 +6507,8 @@ static const struct bpf_raw_tp_null_args raw_tp_null_args[] = {
> /* rxrpc */
> { "rxrpc_recvdata", 0x1 },
> { "rxrpc_resend", 0x10 },
> + /* skb */
> + {"kfree_skb", 0x1000},
> /* sunrpc */
> { "xs_stream_read_data", 0x1 },
> /* ... from xprt_cong_event event class */
> --
> 2.39.5 (Apple Git-154)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
2025-02-01 3:01 [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[] Kuniyuki Iwashima
2025-02-01 3:16 ` Yan Zhai
@ 2025-02-01 8:13 ` Jiri Olsa
2025-02-01 8:15 ` Alexei Starovoitov
2025-02-03 13:10 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2025-02-01 8:13 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: Martin KaFai Lau, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Kumar Kartikeya Dwivedi, Kuniyuki Iwashima, bpf,
netdev, Yan Zhai
On Fri, Jan 31, 2025 at 07:01:42PM -0800, Kuniyuki Iwashima wrote:
> Yan Zhai reported a BPF prog could trigger a null-ptr-deref [0]
> in trace_kfree_skb if the prog does not check if rx_sk is NULL.
>
> Commit c53795d48ee8 ("net: add rx_sk to trace_kfree_skb") added
> rx_sk to trace_kfree_skb, but rx_sk is optional and could be NULL.
>
> Let's add kfree_skb to raw_tp_null_args[] to let the BPF verifier
> validate such a prog and prevent the issue.
>
> Now we fail to load such a prog:
>
> libbpf: prog 'drop': -- BEGIN PROG LOAD LOG --
> 0: R1=ctx() R10=fp0
> ; int BPF_PROG(drop, struct sk_buff *skb, void *location, @ kfree_skb_sk_null.bpf.c:21
> 0: (79) r3 = *(u64 *)(r1 +24)
> func 'kfree_skb' arg3 has btf_id 5253 type STRUCT 'sock'
> 1: R1=ctx() R3_w=trusted_ptr_or_null_sock(id=1)
> ; bpf_printk("sk: %d, %d\n", sk, sk->__sk_common.skc_family); @ kfree_skb_sk_null.bpf.c:24
> 1: (69) r4 = *(u16 *)(r3 +16)
> R3 invalid mem access 'trusted_ptr_or_null_'
> processed 2 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
> -- END PROG LOAD LOG --
>
> Note this fix requires commit 838a10bd2ebf ("bpf: Augment raw_tp
> arguments with PTR_MAYBE_NULL").
>
> [0]:
> BUG: kernel NULL pointer dereference, address: 0000000000000010
> PF: supervisor read access in kernel mode
> PF: error_code(0x0000) - not-present page
> PGD 0 P4D 0
> PREEMPT SMP
> CPU: 6 UID: 0 PID: 348 Comm: sshd Not tainted 6.12.11 #206
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> RIP: 0010:bpf_prog_5e21a6db8fcff1aa_drop+0x10/0x2d
> Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 0f 1f 00 55 48 89 e5 48 8b 57 18 <48> 0f b7 4a 10 48 bf 0c 4f e2 c1 ad 90 ff ff be 0c 00 00 00 e8 0f
> RSP: 0018:ffffa86640b53da8 EFLAGS: 00010202
> RAX: 0000000000000001 RBX: ffffa866402d1000 RCX: 0000000000000002
> RDX: 0000000000000000 RSI: ffffa866402d1048 RDI: ffffa86640b53dc8
> RBP: ffffa86640b53da8 R08: 0000000000000000 R09: 9c908cd09b9c8c91
> R10: ffff90adc056b540 R11: 0000000000000002 R12: 0000000000000000
> R13: ffffa86640b53e88 R14: 0000000000000800 R15: fffffffffffffffe
> FS: 00007f2a27c2b480(0000) GS:ffff90b0efd00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000010 CR3: 0000000100e69004 CR4: 00000000001726f0
> Call Trace:
> <TASK>
> ? __die+0x1f/0x60
> ? page_fault_oops+0x148/0x420
> ? search_bpf_extables+0x5b/0x70
> ? fixup_exception+0x27/0x2c0
> ? exc_page_fault+0x75/0x170
> ? asm_exc_page_fault+0x22/0x30
> ? bpf_prog_5e21a6db8fcff1aa_drop+0x10/0x2d
> bpf_trace_run4+0x68/0xd0
> ? unix_stream_connect+0x1f4/0x6f0
> sk_skb_reason_drop+0x90/0x120
> unix_stream_connect+0x1f4/0x6f0
> __sys_connect+0x7f/0xb0
> __x64_sys_connect+0x14/0x20
> do_syscall_64+0x47/0xc30
> entry_SYSCALL_64_after_hwframe+0x4b/0x53
> RIP: 0033:0x7f2a27f296a0
> Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 80 3d 41 ff 0c 00 00 74 17 b8 2a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 54
> RSP: 002b:00007ffe29274f58 EFLAGS: 00000202 ORIG_RAX: 000000000000002a
>
> Fixes: c53795d48ee8 ("net: add rx_sk to trace_kfree_skb")
> Reported-by: Yan Zhai <yan@cloudflare.com>
> Closes: https://lore.kernel.org/netdev/Z50zebTRzI962e6X@debian.debian/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> ---
> v2:
> * Add kfree_skb to raw_tp_null_args[] instead of annotating
> rx_skb with __nullable
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
>
> v1: https://lore.kernel.org/bpf/20250201001425.42377-1-kuniyu@amazon.com/
> ---
> kernel/bpf/btf.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 9de6acddd479..c3223e0db2f5 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -6507,6 +6507,8 @@ static const struct bpf_raw_tp_null_args raw_tp_null_args[] = {
> /* rxrpc */
> { "rxrpc_recvdata", 0x1 },
> { "rxrpc_resend", 0x10 },
> + /* skb */
> + {"kfree_skb", 0x1000},
> /* sunrpc */
> { "xs_stream_read_data", 0x1 },
> /* ... from xprt_cong_event event class */
> --
> 2.39.5 (Apple Git-154)
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
2025-02-01 8:13 ` Jiri Olsa
@ 2025-02-01 8:15 ` Alexei Starovoitov
2025-02-02 10:06 ` Jiri Olsa
0 siblings, 1 reply; 7+ messages in thread
From: Alexei Starovoitov @ 2025-02-01 8:15 UTC (permalink / raw)
To: Jiri Olsa
Cc: Kuniyuki Iwashima, Martin KaFai Lau, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Kumar Kartikeya Dwivedi,
Kuniyuki Iwashima, bpf, Network Development, Yan Zhai
On Sat, Feb 1, 2025 at 9:13 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>
> > v2:
> > * Add kfree_skb to raw_tp_null_args[] instead of annotating
> > rx_skb with __nullable
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
Jiri, Kumar,
how come that we missed it earlier?
Is this a new change in the tracepoint?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
2025-02-01 8:15 ` Alexei Starovoitov
@ 2025-02-02 10:06 ` Jiri Olsa
2025-02-10 17:49 ` Jiri Olsa
0 siblings, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2025-02-02 10:06 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Jiri Olsa, Kuniyuki Iwashima, Martin KaFai Lau,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Kumar Kartikeya Dwivedi, Kuniyuki Iwashima, bpf,
Network Development, Yan Zhai
On Sat, Feb 01, 2025 at 09:15:28AM +0100, Alexei Starovoitov wrote:
> On Sat, Feb 1, 2025 at 9:13 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> >
> > > v2:
> > > * Add kfree_skb to raw_tp_null_args[] instead of annotating
> > > rx_skb with __nullable
> >
> > Acked-by: Jiri Olsa <jolsa@kernel.org>
>
> Jiri, Kumar,
> how come that we missed it earlier?
> Is this a new change in the tracepoint?
must have slipped, sry.. I'll double check tracepoints again
jirka
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
2025-02-01 3:01 [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[] Kuniyuki Iwashima
2025-02-01 3:16 ` Yan Zhai
2025-02-01 8:13 ` Jiri Olsa
@ 2025-02-03 13:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-03 13:10 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: martin.lau, ast, daniel, andrii, memxor, kuni1840, bpf, netdev,
yan
Hello:
This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Fri, 31 Jan 2025 19:01:42 -0800 you wrote:
> Yan Zhai reported a BPF prog could trigger a null-ptr-deref [0]
> in trace_kfree_skb if the prog does not check if rx_sk is NULL.
>
> Commit c53795d48ee8 ("net: add rx_sk to trace_kfree_skb") added
> rx_sk to trace_kfree_skb, but rx_sk is optional and could be NULL.
>
> Let's add kfree_skb to raw_tp_null_args[] to let the BPF verifier
> validate such a prog and prevent the issue.
>
> [...]
Here is the summary with links:
- [v2,bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
https://git.kernel.org/bpf/bpf/c/fc610c8c586c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[].
2025-02-02 10:06 ` Jiri Olsa
@ 2025-02-10 17:49 ` Jiri Olsa
0 siblings, 0 replies; 7+ messages in thread
From: Jiri Olsa @ 2025-02-10 17:49 UTC (permalink / raw)
To: Jiri Olsa
Cc: Alexei Starovoitov, Kuniyuki Iwashima, Martin KaFai Lau,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Kumar Kartikeya Dwivedi, Kuniyuki Iwashima, bpf,
Network Development, Yan Zhai
On Sun, Feb 02, 2025 at 11:06:26AM +0100, Jiri Olsa wrote:
> On Sat, Feb 01, 2025 at 09:15:28AM +0100, Alexei Starovoitov wrote:
> > On Sat, Feb 1, 2025 at 9:13 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> > >
> > > > v2:
> > > > * Add kfree_skb to raw_tp_null_args[] instead of annotating
> > > > rx_skb with __nullable
> > >
> > > Acked-by: Jiri Olsa <jolsa@kernel.org>
> >
> > Jiri, Kumar,
> > how come that we missed it earlier?
> > Is this a new change in the tracepoint?
>
> must have slipped, sry.. I'll double check tracepoints again
sry for late reply, I was traveling last week
I overlooked tracepoints defined in drivers directly :-\
however there was one recent change adding the null check:
9ab96b524dce hugetlb: fix NULL pointer dereference in trace_hugetlbfs_alloc_inode
will send update shortly
jirka
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-10 17:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-01 3:01 [PATCH v2 bpf] net: Add rx_skb of kfree_skb to raw_tp_null_args[] Kuniyuki Iwashima
2025-02-01 3:16 ` Yan Zhai
2025-02-01 8:13 ` Jiri Olsa
2025-02-01 8:15 ` Alexei Starovoitov
2025-02-02 10:06 ` Jiri Olsa
2025-02-10 17:49 ` Jiri Olsa
2025-02-03 13:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).