* [PATCH v4] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
@ 2026-02-09 1:51 Feng Yang
2026-02-09 7:30 ` [syzbot ci] " syzbot ci
0 siblings, 1 reply; 4+ messages in thread
From: Feng Yang @ 2026-02-09 1:51 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms, ast, daniel, andrii
Cc: bpf, netdev, linux-kernel
From: Feng Yang <yangfeng@kylinos.cn>
The bpf_lwt_xmit_push_encap helper needs to access skb_dst(skb)->dev to
calculate the needed headroom:
err = skb_cow_head(skb,
len + LL_RESERVED_SPACE(skb_dst(skb)->dev));
But skb->_skb_refdst may not be initialized when the skb is set up by
bpf_prog_test_run_skb function. Executing bpf_lwt_push_ip_encap function
in this scenario will trigger null pointer dereference, causing a kernel
crash as Yinhao reported:
[ 105.186365] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 105.186382] #PF: supervisor read access in kernel mode
[ 105.186388] #PF: error_code(0x0000) - not-present page
[ 105.186393] PGD 121d3d067 P4D 121d3d067 PUD 106c83067 PMD 0
[ 105.186404] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 105.186412] CPU: 3 PID: 3250 Comm: poc Kdump: loaded Not tainted 6.19.0-rc5 #1
[ 105.186423] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 105.186427] RIP: 0010:bpf_lwt_push_ip_encap+0x1eb/0x520
[ 105.186443] Code: 0f 84 de 01 00 00 0f b7 4a 04 66 85 c9 0f 85 47 01 00 00 31 c0 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc 48 8b 73 58 48 83 e6 fe <48> 8b 36 0f b7 be ec 00 00 00 0f b7 b6 e6 00 00 00 01 fe 83 e6 f0
[ 105.186449] RSP: 0018:ffffbb0e0387bc50 EFLAGS: 00010246
[ 105.186455] RAX: 000000000000004e RBX: ffff94c74e036500 RCX: ffff94c74874da00
[ 105.186460] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff94c74e036500
[ 105.186463] RBP: 0000000000000001 R08: 0000000000000002 R09: 0000000000000000
[ 105.186467] R10: ffffbb0e0387bd50 R11: 0000000000000000 R12: ffffbb0e0387bc98
[ 105.186471] R13: 0000000000000014 R14: 0000000000000000 R15: 0000000000000002
[ 105.186484] FS: 00007f166aa4d680(0000) GS:ffff94c8b7780000(0000) knlGS:0000000000000000
[ 105.186490] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 105.186494] CR2: 0000000000000000 CR3: 000000015eade001 CR4: 0000000000770ee0
[ 105.186499] PKRU: 55555554
[ 105.186502] Call Trace:
[ 105.186507] <TASK>
[ 105.186513] bpf_lwt_xmit_push_encap+0x2b/0x40
[ 105.186522] bpf_prog_a75eaad51e517912+0x41/0x49
[ 105.186536] ? kvm_clock_get_cycles+0x18/0x30
[ 105.186547] ? ktime_get+0x3c/0xa0
[ 105.186554] bpf_test_run+0x195/0x320
[ 105.186563] ? bpf_test_run+0x10f/0x320
[ 105.186579] bpf_prog_test_run_skb+0x2f5/0x4f0
[ 105.186590] __sys_bpf+0x69c/0xa40
[ 105.186603] __x64_sys_bpf+0x1e/0x30
[ 105.186611] do_syscall_64+0x59/0x110
[ 105.186620] entry_SYSCALL_64_after_hwframe+0x76/0xe0
[ 105.186649] RIP: 0033:0x7f166a97455d
Temporarily add the setting of skb->_skb_refdst before bpf_test_run to resolve the issue.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Reported-by: Yinhao Hu <dddddd@hust.edu.cn>
Reported-by: Kaiyan Mei <M202472210@hust.edu.cn>
Closes: https://groups.google.com/g/hust-os-kernel-patches/c/8-a0kPpBW2s
Signed-off-by: Yun Lu <luyun@kylinos.cn>
Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
Tested-by: syzbot@syzkaller.appspotmail.com
---
Changes in v4:
- add rcu lock
- Link to v3: https://lore.kernel.org/all/20260206055113.63476-1-yangfeng59949@163.com/
Changes in v3:
- use dst_init
- Link to v2: https://lore.kernel.org/all/20260205092227.126665-1-yangfeng59949@163.com/
Changes in v2:
- Link to v1: https://lore.kernel.org/all/20260127084520.13890-1-luyun_611@163.com/
---
net/bpf/test_run.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 178c4738e63b..79b60ab9e682 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -989,6 +989,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
u32 tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
struct net *net = current->nsproxy->net_ns;
struct net_device *dev = net->loopback_dev;
+ struct dst_entry bpf_test_run_lwt_xmit_dst;
u32 headroom = NET_SKB_PAD + NET_IP_ALIGN;
u32 linear_sz = kattr->test.data_size_in;
u32 repeat = kattr->test.repeat;
@@ -1156,6 +1157,14 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
skb->ip_summed = CHECKSUM_COMPLETE;
}
+ if (prog->type == BPF_PROG_TYPE_LWT_XMIT) {
+ dst_init(&bpf_test_run_lwt_xmit_dst, NULL, NULL,
+ DST_OBSOLETE_NONE, DST_NOCOUNT);
+ bpf_test_run_lwt_xmit_dst.dev = dev;
+ rcu_read_lock();
+ skb_dst_set_noref(skb, &bpf_test_run_lwt_xmit_dst);
+ rcu_read_unlock();
+ }
ret = bpf_test_run(prog, skb, repeat, &retval, &duration, false);
if (ret)
goto out;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [syzbot ci] Re: bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
2026-02-09 1:51 [PATCH v4] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap Feng Yang
@ 2026-02-09 7:30 ` syzbot ci
0 siblings, 0 replies; 4+ messages in thread
From: syzbot ci @ 2026-02-09 7:30 UTC (permalink / raw)
To: andrii, ast, bpf, daniel, davem, edumazet, horms, kuba,
linux-kernel, netdev, pabeni, yangfeng59949
Cc: syzbot, syzkaller-bugs
syzbot ci has tested the following series
[v4] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
https://lore.kernel.org/all/20260209015111.28144-1-yangfeng59949@163.com
* [PATCH v4] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
and found the following issues:
* general protection fault in ip6_tnl_xmit
* general protection fault in tnl_update_pmtu
* general protection fault in wg_xmit
* general protection fault in xfrm_lookup_with_ifid
Full report is available here:
https://ci.syzbot.org/series/af38a4c5-943d-44d2-91e6-299e4e0a94db
***
general protection fault in ip6_tnl_xmit
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: db975debcb8c4cd367a78811bc1ba84c83f854bd
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/c4ef1868-7d17-40c4-b5a7-b2d7bec3a6fe/config
C repro: https://ci.syzbot.org/findings/311bc7a0-3bf0-490c-b561-a21f38f4d8e9/c_repro
syz repro: https://ci.syzbot.org/findings/311bc7a0-3bf0-490c-b561-a21f38f4d8e9/syz_repro
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000d: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000068-0x000000000000006f]
CPU: 1 UID: 0 PID: 5991 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:dst_neigh_lookup include/net/dst.h:404 [inline]
RIP: 0010:ip6_tnl_xmit+0x14a1/0x2af0 net/ipv6/ip6_tunnel.c:1123
Code: 74 12 4c 89 ef e8 af d8 ea f7 48 ba 00 00 00 00 00 fc ff df 4d 01 f4 49 83 c4 18 4d 8b 6d 00 49 83 c5 68 4c 89 e8 48 c1 e8 03 <80> 3c 10 00 74 08 4c 89 ef e8 81 d8 ea f7 4d 8b 5d 00 4c 89 ff 31
RSP: 0018:ffffc90003976e60 EFLAGS: 00010202
RAX: 000000000000000d RBX: 1ffff1102e6c7d07 RCX: ffff88810b2c57c0
RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003977028 R08: ffff88810b2c57c0 R09: 0000000000000002
R10: 000000000000dd86 R11: 0000000000000000 R12: ffff88816a0ce066
R13: 0000000000000068 R14: ffff88816a0ce000 R15: ffffc90003977ba0
FS: 000055555f394500(0000) GS:ffff8882a9927000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30263fff CR3: 000000010d832000 CR4: 00000000000006f0
Call Trace:
<TASK>
ipxip6_tnl_xmit net/ipv6/ip6_tunnel.c:1400 [inline]
ip6_tnl_start_xmit+0xc79/0x11d0 net/ipv6/ip6_tunnel.c:1448
__netdev_start_xmit include/linux/netdevice.h:5273 [inline]
netdev_start_xmit include/linux/netdevice.h:5282 [inline]
xmit_one net/core/dev.c:3853 [inline]
dev_hard_start_xmit+0x2cd/0x7f0 net/core/dev.c:3869
__dev_queue_xmit+0x14dd/0x32a0 net/core/dev.c:4819
dev_queue_xmit include/linux/netdevice.h:3381 [inline]
__bpf_tx_skb+0x18e/0x260 net/core/filter.c:2153
____bpf_clone_redirect net/core/filter.c:2487 [inline]
bpf_clone_redirect+0x313/0x4b0 net/core/filter.c:2450
bpf_prog_2f59963de350c2d2+0x5e/0x67
bpf_dispatcher_nop_func include/linux/bpf.h:1402 [inline]
__bpf_prog_run include/linux/filter.h:723 [inline]
bpf_prog_run include/linux/filter.h:730 [inline]
bpf_test_run+0x354/0x830 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0x13b4/0x1e00 net/bpf/test_run.c:1168
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4721
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6246
__do_sys_bpf kernel/bpf/syscall.c:6341 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6339 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6339
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff39439acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc03f9fef8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ff394615fa0 RCX: 00007ff39439acb9
RDX: 0000000000000028 RSI: 00002000000000c0 RDI: 000000000000000a
RBP: 00007ff394408bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ff394615fac R14: 00007ff394615fa0 R15: 00007ff394615fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dst_neigh_lookup include/net/dst.h:404 [inline]
RIP: 0010:ip6_tnl_xmit+0x14a1/0x2af0 net/ipv6/ip6_tunnel.c:1123
Code: 74 12 4c 89 ef e8 af d8 ea f7 48 ba 00 00 00 00 00 fc ff df 4d 01 f4 49 83 c4 18 4d 8b 6d 00 49 83 c5 68 4c 89 e8 48 c1 e8 03 <80> 3c 10 00 74 08 4c 89 ef e8 81 d8 ea f7 4d 8b 5d 00 4c 89 ff 31
RSP: 0018:ffffc90003976e60 EFLAGS: 00010202
RAX: 000000000000000d RBX: 1ffff1102e6c7d07 RCX: ffff88810b2c57c0
RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003977028 R08: ffff88810b2c57c0 R09: 0000000000000002
R10: 000000000000dd86 R11: 0000000000000000 R12: ffff88816a0ce066
R13: 0000000000000068 R14: ffff88816a0ce000 R15: ffffc90003977ba0
FS: 000055555f394500(0000) GS:ffff8882a9927000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30263fff CR3: 000000010d832000 CR4: 00000000000006f0
----------------
Code disassembly (best guess):
0: 74 12 je 0x14
2: 4c 89 ef mov %r13,%rdi
5: e8 af d8 ea f7 call 0xf7ead8b9
a: 48 ba 00 00 00 00 00 movabs $0xdffffc0000000000,%rdx
11: fc ff df
14: 4d 01 f4 add %r14,%r12
17: 49 83 c4 18 add $0x18,%r12
1b: 4d 8b 6d 00 mov 0x0(%r13),%r13
1f: 49 83 c5 68 add $0x68,%r13
23: 4c 89 e8 mov %r13,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 80 3c 10 00 cmpb $0x0,(%rax,%rdx,1) <-- trapping instruction
2e: 74 08 je 0x38
30: 4c 89 ef mov %r13,%rdi
33: e8 81 d8 ea f7 call 0xf7ead8b9
38: 4d 8b 5d 00 mov 0x0(%r13),%r11
3c: 4c 89 ff mov %r15,%rdi
3f: 31 .byte 0x31
***
general protection fault in tnl_update_pmtu
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: db975debcb8c4cd367a78811bc1ba84c83f854bd
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/c4ef1868-7d17-40c4-b5a7-b2d7bec3a6fe/config
C repro: https://ci.syzbot.org/findings/78a52206-e4f0-4a95-a881-32bbaab25810/c_repro
syz repro: https://ci.syzbot.org/findings/78a52206-e4f0-4a95-a881-32bbaab25810/syz_repro
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000a: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057]
CPU: 0 UID: 0 PID: 5980 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:skb_dst_update_pmtu_no_confirm include/net/dst.h:565 [inline]
RIP: 0010:tnl_update_pmtu+0x52b/0x1190 net/ipv4/ip_tunnel.c:533
Code: c1 e8 03 42 80 3c 38 00 74 08 48 89 df e8 ad 38 2a f8 4c 8b 3b 49 83 c7 50 4c 89 f8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 ff e8 87 38 2a f8 4d 8b 3f 4d 85 ff 8b 5c
RSP: 0018:ffffc90003d56e28 EFLAGS: 00010206
RAX: 000000000000000a RBX: ffffc90003d57ba8 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffc90003d57ba0 RDI: 0000000000000000
RBP: ffffc90003d57ba0 R08: ffffffff89db4393 R09: ffffffff8e35a3a0
R10: ffffc90003d56de0 R11: fffff520007aadbe R12: ffff88816a305380
R13: ffff88816a3053d8 R14: 1ffff1102d460a7b R15: 0000000000000050
FS: 000055559418b500(0000) GS:ffff88818e327000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30863fff CR3: 00000001bea06000 CR4: 00000000000006f0
Call Trace:
<TASK>
ip_tunnel_xmit+0xd36/0x2430 net/ipv4/ip_tunnel.c:805
__gre_xmit net/ipv4/ip_gre.c:490 [inline]
ipgre_xmit+0x8e6/0xc60 net/ipv4/ip_gre.c:694
__netdev_start_xmit include/linux/netdevice.h:5273 [inline]
netdev_start_xmit include/linux/netdevice.h:5282 [inline]
xmit_one net/core/dev.c:3853 [inline]
dev_hard_start_xmit+0x2cd/0x7f0 net/core/dev.c:3869
__dev_queue_xmit+0x14dd/0x32a0 net/core/dev.c:4819
dev_queue_xmit include/linux/netdevice.h:3381 [inline]
__bpf_tx_skb+0x18e/0x260 net/core/filter.c:2153
____bpf_clone_redirect net/core/filter.c:2487 [inline]
bpf_clone_redirect+0x313/0x4b0 net/core/filter.c:2450
bpf_prog_7c64685fc60f7d44+0x5f/0x68
bpf_dispatcher_nop_func include/linux/bpf.h:1402 [inline]
__bpf_prog_run include/linux/filter.h:723 [inline]
bpf_prog_run include/linux/filter.h:730 [inline]
bpf_test_run+0x354/0x830 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0x13b4/0x1e00 net/bpf/test_run.c:1168
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4721
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6246
__do_sys_bpf kernel/bpf/syscall.c:6341 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6339 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6339
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6668d9acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcdef544a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f6669015fa0 RCX: 00007f6668d9acb9
RDX: 000000000000002c RSI: 0000200000000080 RDI: 000000000000000a
RBP: 00007f6668e08bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f6669015fac R14: 00007f6669015fa0 R15: 00007f6669015fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:skb_dst_update_pmtu_no_confirm include/net/dst.h:565 [inline]
RIP: 0010:tnl_update_pmtu+0x52b/0x1190 net/ipv4/ip_tunnel.c:533
Code: c1 e8 03 42 80 3c 38 00 74 08 48 89 df e8 ad 38 2a f8 4c 8b 3b 49 83 c7 50 4c 89 f8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 ff e8 87 38 2a f8 4d 8b 3f 4d 85 ff 8b 5c
RSP: 0018:ffffc90003d56e28 EFLAGS: 00010206
RAX: 000000000000000a RBX: ffffc90003d57ba8 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffc90003d57ba0 RDI: 0000000000000000
RBP: ffffc90003d57ba0 R08: ffffffff89db4393 R09: ffffffff8e35a3a0
R10: ffffc90003d56de0 R11: fffff520007aadbe R12: ffff88816a305380
R13: ffff88816a3053d8 R14: 1ffff1102d460a7b R15: 0000000000000050
FS: 000055559418b500(0000) GS:ffff88818e327000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30863fff CR3: 00000001bea06000 CR4: 00000000000006f0
----------------
Code disassembly (best guess):
0: c1 e8 03 shr $0x3,%eax
3: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1)
8: 74 08 je 0x12
a: 48 89 df mov %rbx,%rdi
d: e8 ad 38 2a f8 call 0xf82a38bf
12: 4c 8b 3b mov (%rbx),%r15
15: 49 83 c7 50 add $0x50,%r15
19: 4c 89 f8 mov %r15,%rax
1c: 48 c1 e8 03 shr $0x3,%rax
20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
27: fc ff df
* 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
2e: 74 08 je 0x38
30: 4c 89 ff mov %r15,%rdi
33: e8 87 38 2a f8 call 0xf82a38bf
38: 4d 8b 3f mov (%r15),%r15
3b: 4d 85 ff test %r15,%r15
3e: 8b .byte 0x8b
3f: 5c pop %rsp
***
general protection fault in wg_xmit
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: db975debcb8c4cd367a78811bc1ba84c83f854bd
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/c4ef1868-7d17-40c4-b5a7-b2d7bec3a6fe/config
C repro: https://ci.syzbot.org/findings/9650e699-cf43-4d3b-841d-ae1a23f976f0/c_repro
syz repro: https://ci.syzbot.org/findings/9650e699-cf43-4d3b-841d-ae1a23f976f0/syz_repro
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000004: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027]
CPU: 0 UID: 0 PID: 5985 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:dst_mtu include/net/dst.h:219 [inline]
RIP: 0010:wg_xmit+0x355/0xf70 drivers/net/wireguard/device.c:173
Code: 00 fc ff df 80 3c 08 00 74 08 4c 89 ff e8 83 84 d9 fb 4d 8b 3f 49 83 c7 20 4c 89 f8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 ff e8 5d 84 d9 fb 4d 8b 3f 49 81 ff e0 38
RSP: 0018:ffffc90003cc7060 EFLAGS: 00010202
RAX: 0000000000000004 RBX: ffffc90003cc7ba0 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003cc7190 R08: ffffffff8fced577 R09: 1ffffffff1f9daae
R10: dffffc0000000000 R11: fffffbfff1f9daaf R12: ffffc90003cc70c0
R13: 1ffff1102ebe283b R14: ffff888175f14180 R15: 0000000000000020
FS: 00005555734f8500(0000) GS:ffff88818e327000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30663fff CR3: 00000001704ae000 CR4: 00000000000006f0
Call Trace:
<TASK>
__netdev_start_xmit include/linux/netdevice.h:5273 [inline]
netdev_start_xmit include/linux/netdevice.h:5282 [inline]
xmit_one net/core/dev.c:3853 [inline]
dev_hard_start_xmit+0x2cd/0x7f0 net/core/dev.c:3869
__dev_queue_xmit+0x14dd/0x32a0 net/core/dev.c:4819
dev_queue_xmit include/linux/netdevice.h:3381 [inline]
__bpf_tx_skb+0x18e/0x260 net/core/filter.c:2153
____bpf_clone_redirect net/core/filter.c:2487 [inline]
bpf_clone_redirect+0x313/0x4b0 net/core/filter.c:2450
bpf_prog_bd919e7baf24f63c+0x5f/0x68
bpf_dispatcher_nop_func include/linux/bpf.h:1402 [inline]
__bpf_prog_run include/linux/filter.h:723 [inline]
bpf_prog_run include/linux/filter.h:730 [inline]
bpf_test_run+0x354/0x830 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0x13b4/0x1e00 net/bpf/test_run.c:1168
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4721
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6246
__do_sys_bpf kernel/bpf/syscall.c:6341 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6339 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6339
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc57899acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd806bfbf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fc578c15fa0 RCX: 00007fc57899acb9
RDX: 0000000000000050 RSI: 0000200000000080 RDI: 000000000000000a
RBP: 00007fc578a08bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc578c15fac R14: 00007fc578c15fa0 R15: 00007fc578c15fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dst_mtu include/net/dst.h:219 [inline]
RIP: 0010:wg_xmit+0x355/0xf70 drivers/net/wireguard/device.c:173
Code: 00 fc ff df 80 3c 08 00 74 08 4c 89 ff e8 83 84 d9 fb 4d 8b 3f 49 83 c7 20 4c 89 f8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 ff e8 5d 84 d9 fb 4d 8b 3f 49 81 ff e0 38
RSP: 0018:ffffc90003cc7060 EFLAGS: 00010202
RAX: 0000000000000004 RBX: ffffc90003cc7ba0 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003cc7190 R08: ffffffff8fced577 R09: 1ffffffff1f9daae
R10: dffffc0000000000 R11: fffffbfff1f9daaf R12: ffffc90003cc70c0
R13: 1ffff1102ebe283b R14: ffff888175f14180 R15: 0000000000000020
FS: 00005555734f8500(0000) GS:ffff88818e327000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30663fff CR3: 00000001704ae000 CR4: 00000000000006f0
----------------
Code disassembly (best guess), 3 bytes skipped:
0: df 80 3c 08 00 74 filds 0x7400083c(%rax)
6: 08 4c 89 ff or %cl,-0x1(%rcx,%rcx,4)
a: e8 83 84 d9 fb call 0xfbd98492
f: 4d 8b 3f mov (%r15),%r15
12: 49 83 c7 20 add $0x20,%r15
16: 4c 89 f8 mov %r15,%rax
19: 48 c1 e8 03 shr $0x3,%rax
1d: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
24: fc ff df
* 27: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
2b: 74 08 je 0x35
2d: 4c 89 ff mov %r15,%rdi
30: e8 5d 84 d9 fb call 0xfbd98492
35: 4d 8b 3f mov (%r15),%r15
38: 49 rex.WB
39: 81 .byte 0x81
3a: ff e0 jmp *%rax
3c: 38 .byte 0x38
***
general protection fault in xfrm_lookup_with_ifid
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: db975debcb8c4cd367a78811bc1ba84c83f854bd
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/c4ef1868-7d17-40c4-b5a7-b2d7bec3a6fe/config
C repro: https://ci.syzbot.org/findings/2ae3c5a4-d593-4385-8e69-f77a40c2382d/c_repro
syz repro: https://ci.syzbot.org/findings/2ae3c5a4-d593-4385-8e69-f77a40c2382d/syz_repro
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 0 UID: 0 PID: 5978 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:xfrm_lookup_with_ifid+0xe1/0x1af0 net/xfrm/xfrm_policy.c:3181
Code: 24 20 4d 8d 66 08 4c 89 e0 48 c1 e8 03 4d 89 ee 42 80 3c 28 00 74 08 4c 89 e7 e8 5a 1f 17 f8 4d 8b 24 24 4c 89 e0 48 c1 e8 03 <42> 0f b6 04 30 84 c0 0f 85 94 17 00 00 41 0f b7 04 24 89 44 24 28
RSP: 0018:ffffc900045f6ea0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffc900045f6f40 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc900045f6f50
RBP: ffffc900045f6fb8 R08: ffffc900045f6f4f R09: 0000000000000000
R10: ffffc900045f6f40 R11: fffff520008bedea R12: 0000000000000000
R13: dffffc0000000000 R14: dffffc0000000000 R15: 0000000000000000
FS: 00005555873db500(0000) GS:ffff88818e327000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2fa63fff CR3: 000000016e128000 CR4: 00000000000006f0
Call Trace:
<TASK>
xfrm_lookup net/xfrm/xfrm_policy.c:3336 [inline]
xfrm_lookup_route+0x3c/0x1c0 net/xfrm/xfrm_policy.c:3347
vti_xmit net/ipv4/ip_vti.c:217 [inline]
vti_tunnel_xmit+0x48e/0x18f0 net/ipv4/ip_vti.c:307
__netdev_start_xmit include/linux/netdevice.h:5273 [inline]
netdev_start_xmit include/linux/netdevice.h:5282 [inline]
xmit_one net/core/dev.c:3853 [inline]
dev_hard_start_xmit+0x2cd/0x7f0 net/core/dev.c:3869
__dev_queue_xmit+0x14dd/0x32a0 net/core/dev.c:4819
dev_queue_xmit include/linux/netdevice.h:3381 [inline]
__bpf_tx_skb+0x18e/0x260 net/core/filter.c:2153
____bpf_clone_redirect net/core/filter.c:2487 [inline]
bpf_clone_redirect+0x313/0x4b0 net/core/filter.c:2450
bpf_prog_e16758452f539c38+0x5f/0x68
bpf_dispatcher_nop_func include/linux/bpf.h:1402 [inline]
__bpf_prog_run include/linux/filter.h:723 [inline]
bpf_prog_run include/linux/filter.h:730 [inline]
bpf_test_run+0x354/0x830 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0x13b4/0x1e00 net/bpf/test_run.c:1168
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4721
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6246
__do_sys_bpf kernel/bpf/syscall.c:6341 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6339 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6339
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f722f59acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff2a77bfd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f722f815fa0 RCX: 00007f722f59acb9
RDX: 000000000000002c RSI: 0000200000000080 RDI: 000000000000000a
RBP: 00007f722f608bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f722f815fac R14: 00007f722f815fa0 R15: 00007f722f815fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:xfrm_lookup_with_ifid+0xe1/0x1af0 net/xfrm/xfrm_policy.c:3181
Code: 24 20 4d 8d 66 08 4c 89 e0 48 c1 e8 03 4d 89 ee 42 80 3c 28 00 74 08 4c 89 e7 e8 5a 1f 17 f8 4d 8b 24 24 4c 89 e0 48 c1 e8 03 <42> 0f b6 04 30 84 c0 0f 85 94 17 00 00 41 0f b7 04 24 89 44 24 28
RSP: 0018:ffffc900045f6ea0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffc900045f6f40 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc900045f6f50
RBP: ffffc900045f6fb8 R08: ffffc900045f6f4f R09: 0000000000000000
R10: ffffc900045f6f40 R11: fffff520008bedea R12: 0000000000000000
R13: dffffc0000000000 R14: dffffc0000000000 R15: 0000000000000000
FS: 00005555873db500(0000) GS:ffff88818e327000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2fa63fff CR3: 000000016e128000 CR4: 00000000000006f0
----------------
Code disassembly (best guess):
0: 24 20 and $0x20,%al
2: 4d 8d 66 08 lea 0x8(%r14),%r12
6: 4c 89 e0 mov %r12,%rax
9: 48 c1 e8 03 shr $0x3,%rax
d: 4d 89 ee mov %r13,%r14
10: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1)
15: 74 08 je 0x1f
17: 4c 89 e7 mov %r12,%rdi
1a: e8 5a 1f 17 f8 call 0xf8171f79
1f: 4d 8b 24 24 mov (%r12),%r12
23: 4c 89 e0 mov %r12,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax <-- trapping instruction
2f: 84 c0 test %al,%al
31: 0f 85 94 17 00 00 jne 0x17cb
37: 41 0f b7 04 24 movzwl (%r12),%eax
3c: 89 44 24 28 mov %eax,0x28(%rsp)
***
If these findings have caused you to resend the series or submit a
separate fix, please add the following tag to your commit message:
Tested-by: syzbot@syzkaller.appspotmail.com
---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
@ 2026-02-06 5:51 Feng Yang
2026-02-06 11:02 ` [syzbot ci] " syzbot ci
0 siblings, 1 reply; 4+ messages in thread
From: Feng Yang @ 2026-02-06 5:51 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms; +Cc: bpf, netdev, linux-kernel
From: Feng Yang <yangfeng@kylinos.cn>
The bpf_lwt_xmit_push_encap helper needs to access skb_dst(skb)->dev to
calculate the needed headroom:
err = skb_cow_head(skb,
len + LL_RESERVED_SPACE(skb_dst(skb)->dev));
But skb->_skb_refdst may not be initialized when the skb is set up by
bpf_prog_test_run_skb function. Executing bpf_lwt_push_ip_encap function
in this scenario will trigger null pointer dereference, causing a kernel
crash as Yinhao reported:
[ 105.186365] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 105.186382] #PF: supervisor read access in kernel mode
[ 105.186388] #PF: error_code(0x0000) - not-present page
[ 105.186393] PGD 121d3d067 P4D 121d3d067 PUD 106c83067 PMD 0
[ 105.186404] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 105.186412] CPU: 3 PID: 3250 Comm: poc Kdump: loaded Not tainted 6.19.0-rc5 #1
[ 105.186423] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 105.186427] RIP: 0010:bpf_lwt_push_ip_encap+0x1eb/0x520
[ 105.186443] Code: 0f 84 de 01 00 00 0f b7 4a 04 66 85 c9 0f 85 47 01 00 00 31 c0 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc 48 8b 73 58 48 83 e6 fe <48> 8b 36 0f b7 be ec 00 00 00 0f b7 b6 e6 00 00 00 01 fe 83 e6 f0
[ 105.186449] RSP: 0018:ffffbb0e0387bc50 EFLAGS: 00010246
[ 105.186455] RAX: 000000000000004e RBX: ffff94c74e036500 RCX: ffff94c74874da00
[ 105.186460] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff94c74e036500
[ 105.186463] RBP: 0000000000000001 R08: 0000000000000002 R09: 0000000000000000
[ 105.186467] R10: ffffbb0e0387bd50 R11: 0000000000000000 R12: ffffbb0e0387bc98
[ 105.186471] R13: 0000000000000014 R14: 0000000000000000 R15: 0000000000000002
[ 105.186484] FS: 00007f166aa4d680(0000) GS:ffff94c8b7780000(0000) knlGS:0000000000000000
[ 105.186490] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 105.186494] CR2: 0000000000000000 CR3: 000000015eade001 CR4: 0000000000770ee0
[ 105.186499] PKRU: 55555554
[ 105.186502] Call Trace:
[ 105.186507] <TASK>
[ 105.186513] bpf_lwt_xmit_push_encap+0x2b/0x40
[ 105.186522] bpf_prog_a75eaad51e517912+0x41/0x49
[ 105.186536] ? kvm_clock_get_cycles+0x18/0x30
[ 105.186547] ? ktime_get+0x3c/0xa0
[ 105.186554] bpf_test_run+0x195/0x320
[ 105.186563] ? bpf_test_run+0x10f/0x320
[ 105.186579] bpf_prog_test_run_skb+0x2f5/0x4f0
[ 105.186590] __sys_bpf+0x69c/0xa40
[ 105.186603] __x64_sys_bpf+0x1e/0x30
[ 105.186611] do_syscall_64+0x59/0x110
[ 105.186620] entry_SYSCALL_64_after_hwframe+0x76/0xe0
[ 105.186649] RIP: 0033:0x7f166a97455d
Temporarily add the setting of skb->_skb_refdst before bpf_test_run to resolve the issue.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Reported-by: Yinhao Hu <dddddd@hust.edu.cn>
Reported-by: Kaiyan Mei <M202472210@hust.edu.cn>
Signed-off-by: Yun Lu <luyun@kylinos.cn>
Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
---
Changes in v3:
- use dst_init
- Link to v2: https://lore.kernel.org/all/20260205092227.126665-1-yangfeng59949@163.com/
Changes in v2:
- Link to v1: https://lore.kernel.org/all/20260127084520.13890-1-luyun_611@163.com/
---
net/bpf/test_run.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 178c4738e63b..3e1c47d53b82 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -989,6 +989,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
u32 tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
struct net *net = current->nsproxy->net_ns;
struct net_device *dev = net->loopback_dev;
+ struct dst_entry bpf_test_run_lwt_xmit_dst;
u32 headroom = NET_SKB_PAD + NET_IP_ALIGN;
u32 linear_sz = kattr->test.data_size_in;
u32 repeat = kattr->test.repeat;
@@ -1156,6 +1157,12 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
skb->ip_summed = CHECKSUM_COMPLETE;
}
+ if (prog->type == BPF_PROG_TYPE_LWT_XMIT) {
+ dst_init(&bpf_test_run_lwt_xmit_dst, NULL, NULL,
+ DST_OBSOLETE_NONE, DST_NOCOUNT);
+ bpf_test_run_lwt_xmit_dst.dev = dev;
+ skb_dst_set_noref(skb, &bpf_test_run_lwt_xmit_dst);
+ }
ret = bpf_test_run(prog, skb, repeat, &retval, &duration, false);
if (ret)
goto out;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [syzbot ci] Re: bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
2026-02-06 5:51 [PATCH v3] " Feng Yang
@ 2026-02-06 11:02 ` syzbot ci
0 siblings, 0 replies; 4+ messages in thread
From: syzbot ci @ 2026-02-06 11:02 UTC (permalink / raw)
To: bpf, davem, edumazet, horms, kuba, linux-kernel, netdev, pabeni,
yangfeng59949
Cc: syzbot, syzkaller-bugs
syzbot ci has tested the following series
[v3] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
https://lore.kernel.org/all/20260206055113.63476-1-yangfeng59949@163.com
* [PATCH v3] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
and found the following issue:
WARNING in skb_dst_set_noref
Full report is available here:
https://ci.syzbot.org/series/ebdff606-6251-4db9-ab50-448f5433094a
***
WARNING in skb_dst_set_noref
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: 1ace9bac1ad2bc6a0a70baaa16d22b7e783e88c5
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/673700c1-fa90-4aa2-8342-e6b397961829/config
C repro: https://ci.syzbot.org/findings/ad5a5f81-3d84-45ac-90ec-9a169eb16405/c_repro
syz repro: https://ci.syzbot.org/findings/ad5a5f81-3d84-45ac-90ec-9a169eb16405/syz_repro
------------[ cut here ]------------
!rcu_read_lock_held() && !rcu_read_lock_bh_held()
WARNING: ./include/linux/skbuff.h:1235 at skb_dst_set_noref+0x14a/0x1a0 include/linux/skbuff.h:1235, CPU#1: syz.0.17/5979
Modules linked in:
CPU: 1 UID: 0 PID: 5979 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:skb_dst_set_noref+0x14a/0x1a0 include/linux/skbuff.h:1235
Code: 5d 00 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d e9 9b 80 e9 01 cc e8 95 58 30 f8 90 0f 0b 90 e9 2f ff ff ff e8 87 58 30 f8 90 <0f> 0b 90 e9 5d ff ff ff 44 89 e1 80 e1 07 38 c1 0f 8c 76 ff ff ff
RSP: 0018:ffffc90004487a20 EFLAGS: 00010293
RAX: ffffffff89923f99 RBX: ffffc90004487ba0 RCX: ffff888103713a80
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffc90004487be3 R09: 1ffff92000890f7c
R10: dffffc0000000000 R11: fffff52000890f7d R12: 0000000000000000
R13: ffff88817331d858 R14: 1ffff1102e663b0b R15: ffff88817331d800
FS: 0000555590ae6500(0000) GS:ffff8882a9928000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2fb63fff CR3: 00000001139cc000 CR4: 00000000000006f0
Call Trace:
<TASK>
bpf_prog_test_run_skb+0xed8/0x1eb0 net/bpf/test_run.c:1164
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4721
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6246
__do_sys_bpf kernel/bpf/syscall.c:6341 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6339 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6339
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f21c579acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff4c8461d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f21c5a15fa0 RCX: 00007f21c579acb9
RDX: 0000000000000050 RSI: 0000200000000780 RDI: 000000000000000a
RBP: 00007f21c5808bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f21c5a15fac R14: 00007f21c5a15fa0 R15: 00007f21c5a15fa0
</TASK>
***
If these findings have caused you to resend the series or submit a
separate fix, please add the following tag to your commit message:
Tested-by: syzbot@syzkaller.appspotmail.com
---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
@ 2026-02-05 9:22 Feng Yang
2026-02-05 15:44 ` [syzbot ci] " syzbot ci
0 siblings, 1 reply; 4+ messages in thread
From: Feng Yang @ 2026-02-05 9:22 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, horms; +Cc: bpf, netdev, linux-kernel
From: Feng Yang <yangfeng@kylinos.cn>
The bpf_lwt_xmit_push_encap helper needs to access skb_dst(skb)->dev to
calculate the needed headroom:
err = skb_cow_head(skb,
len + LL_RESERVED_SPACE(skb_dst(skb)->dev));
But skb->_skb_refdst may not be initialized when the skb is set up by
bpf_prog_test_run_skb function. Executing bpf_lwt_push_ip_encap function
in this scenario will trigger null pointer dereference, causing a kernel
crash as Yinhao reported:
[ 105.186365] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 105.186382] #PF: supervisor read access in kernel mode
[ 105.186388] #PF: error_code(0x0000) - not-present page
[ 105.186393] PGD 121d3d067 P4D 121d3d067 PUD 106c83067 PMD 0
[ 105.186404] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 105.186412] CPU: 3 PID: 3250 Comm: poc Kdump: loaded Not tainted 6.19.0-rc5 #1
[ 105.186423] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 105.186427] RIP: 0010:bpf_lwt_push_ip_encap+0x1eb/0x520
[ 105.186443] Code: 0f 84 de 01 00 00 0f b7 4a 04 66 85 c9 0f 85 47 01 00 00 31 c0 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc 48 8b 73 58 48 83 e6 fe <48> 8b 36 0f b7 be ec 00 00 00 0f b7 b6 e6 00 00 00 01 fe 83 e6 f0
[ 105.186449] RSP: 0018:ffffbb0e0387bc50 EFLAGS: 00010246
[ 105.186455] RAX: 000000000000004e RBX: ffff94c74e036500 RCX: ffff94c74874da00
[ 105.186460] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff94c74e036500
[ 105.186463] RBP: 0000000000000001 R08: 0000000000000002 R09: 0000000000000000
[ 105.186467] R10: ffffbb0e0387bd50 R11: 0000000000000000 R12: ffffbb0e0387bc98
[ 105.186471] R13: 0000000000000014 R14: 0000000000000000 R15: 0000000000000002
[ 105.186484] FS: 00007f166aa4d680(0000) GS:ffff94c8b7780000(0000) knlGS:0000000000000000
[ 105.186490] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 105.186494] CR2: 0000000000000000 CR3: 000000015eade001 CR4: 0000000000770ee0
[ 105.186499] PKRU: 55555554
[ 105.186502] Call Trace:
[ 105.186507] <TASK>
[ 105.186513] bpf_lwt_xmit_push_encap+0x2b/0x40
[ 105.186522] bpf_prog_a75eaad51e517912+0x41/0x49
[ 105.186536] ? kvm_clock_get_cycles+0x18/0x30
[ 105.186547] ? ktime_get+0x3c/0xa0
[ 105.186554] bpf_test_run+0x195/0x320
[ 105.186563] ? bpf_test_run+0x10f/0x320
[ 105.186579] bpf_prog_test_run_skb+0x2f5/0x4f0
[ 105.186590] __sys_bpf+0x69c/0xa40
[ 105.186603] __x64_sys_bpf+0x1e/0x30
[ 105.186611] do_syscall_64+0x59/0x110
[ 105.186620] entry_SYSCALL_64_after_hwframe+0x76/0xe0
[ 105.186649] RIP: 0033:0x7f166a97455d
Temporarily add the setting of skb->_skb_refdst before bpf_test_run to resolve the issue.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Reported-by: Yinhao Hu <dddddd@hust.edu.cn>
Reported-by: Kaiyan Mei <M202472210@hust.edu.cn>
Signed-off-by: Yun Lu <luyun@kylinos.cn>
Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
---
Changes in v2:
- Link to v1: https://lore.kernel.org/all/20260127084520.13890-1-luyun_611@163.com/
---
net/bpf/test_run.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 178c4738e63b..c05b31cd1741 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -982,6 +982,7 @@ static struct proto bpf_dummy_proto = {
.obj_size = sizeof(struct sock),
};
+struct dst_entry bpf_test_run_lwt_xmit_dst;
int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
union bpf_attr __user *uattr)
{
@@ -1156,7 +1157,13 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
skb->ip_summed = CHECKSUM_COMPLETE;
}
+ if (prog->type == BPF_PROG_TYPE_LWT_XMIT) {
+ bpf_test_run_lwt_xmit_dst.dev = dev;
+ skb_dst_set(skb, &bpf_test_run_lwt_xmit_dst);
+ }
ret = bpf_test_run(prog, skb, repeat, &retval, &duration, false);
+ if (prog->type == BPF_PROG_TYPE_LWT_XMIT)
+ skb_dst_set(skb, NULL);
if (ret)
goto out;
if (!is_l2) {
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [syzbot ci] Re: bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
2026-02-05 9:22 [PATCH v2] " Feng Yang
@ 2026-02-05 15:44 ` syzbot ci
0 siblings, 0 replies; 4+ messages in thread
From: syzbot ci @ 2026-02-05 15:44 UTC (permalink / raw)
To: bpf, davem, edumazet, horms, kuba, linux-kernel, netdev, pabeni,
yangfeng59949
Cc: syzbot, syzkaller-bugs
syzbot ci has tested the following series
[v2] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
https://lore.kernel.org/all/20260205092227.126665-1-yangfeng59949@163.com
* [PATCH v2] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap
and found the following issues:
* WARNING in skb_dst_set
* general protection fault in percpu_counter_add_batch
* general protection fault in tnl_update_pmtu
* general protection fault in xfrm_lookup_with_ifid
Full report is available here:
https://ci.syzbot.org/series/c278e614-0520-4be1-8e1b-b6ed06beb3cd
***
WARNING in skb_dst_set
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: 75cd3beb64d0977009e3d1a2d0c03715d3e5e156
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/8d5f34b6-d9df-4c4a-9d51-7f4f910f379a/config
C repro: https://ci.syzbot.org/findings/9f4f73a7-44d6-4d8b-8fed-818bb8ca054d/c_repro
syz repro: https://ci.syzbot.org/findings/9f4f73a7-44d6-4d8b-8fed-818bb8ca054d/syz_repro
------------[ cut here ]------------
(skb->_skb_refdst & ~(1UL)) && !(skb->_skb_refdst & 1UL)
WARNING: ./include/linux/skbuff.h:1171 at skb_dst_check_unset include/linux/skbuff.h:1170 [inline], CPU#1: syz.0.17/5978
WARNING: ./include/linux/skbuff.h:1171 at skb_dst_set+0xfd/0x140 include/linux/skbuff.h:1217, CPU#1: syz.0.17/5978
Modules linked in:
CPU: 1 UID: 0 PID: 5978 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:skb_dst_check_unset include/linux/skbuff.h:1170 [inline]
RIP: 0010:skb_dst_set+0xfd/0x140 include/linux/skbuff.h:1217
Code: 2d 00 00 74 08 4c 89 f7 e8 80 13 98 f8 49 89 1e 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc e8 64 5c 30 f8 90 <0f> 0b 90 e9 6d ff ff ff 44 89 e1 80 e1 07 38 c1 7c 8f be 04 00 00
RSP: 0018:ffffc90005367b58 EFLAGS: 00010293
RAX: ffffffff89923bbc RBX: dffffc0000000001 RCX: ffff8881037d8000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 1ffff1102edaad5b R08: ffffffff8fced777 R09: 1ffffffff1f9daee
R10: dffffc0000000000 R11: ffffffff817422b0 R12: 0000000000000000
R13: ffff888176d56b01 R14: ffff888176d56ad8 R15: ffff888176d56a80
FS: 0000555564e8a500(0000) GS:ffff8882a9928000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2fe63fff CR3: 000000016852c000 CR4: 00000000000006f0
Call Trace:
<TASK>
bpf_prog_test_run_skb+0xe46/0x1ea0 net/bpf/test_run.c:1166
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4714
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6236
__do_sys_bpf kernel/bpf/syscall.c:6331 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6329 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6329
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f51a119acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff3a40e428 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f51a1415fa0 RCX: 00007f51a119acb9
RDX: 0000000000000050 RSI: 00002000000003c0 RDI: 000000000000000a
RBP: 00007f51a1208bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f51a1415fac R14: 00007f51a1415fa0 R15: 00007f51a1415fa0
</TASK>
***
general protection fault in percpu_counter_add_batch
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: 75cd3beb64d0977009e3d1a2d0c03715d3e5e156
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/8d5f34b6-d9df-4c4a-9d51-7f4f910f379a/config
C repro: https://ci.syzbot.org/findings/f58ed194-db04-464a-95de-a6d6cc45527a/c_repro
syz repro: https://ci.syzbot.org/findings/f58ed194-db04-464a-95de-a6d6cc45527a/syz_repro
Oops: general protection fault, probably for non-canonical address 0xdffffc000000001b: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x00000000000000d8-0x00000000000000df]
CPU: 1 UID: 0 PID: 5976 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:percpu_counter_add_batch+0x3e/0x1d0 lib/percpu_counter.c:98
Code: d4 49 89 f5 48 89 fb 49 bf 00 00 00 00 00 fc ff df e8 e6 76 f2 fc 48 89 5c 24 10 4c 8d 73 58 4c 89 f0 48 c1 e8 03 48 89 04 24 <42> 80 3c 38 00 74 08 4c 89 f7 e8 d3 2c 5a fd 49 8b 06 65 8b 28 41
RSP: 0018:ffffc90003b37778 EFLAGS: 00010206
RAX: 000000000000001b RBX: 0000000000000080 RCX: ffff888115b8ba80
RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000080
RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff52000766ee4 R12: 0000000000000020
R13: ffffffffffffffff R14: 00000000000000d8 R15: dffffc0000000000
FS: 000055555baf2500(0000) GS:ffff8882a9928000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffc74af2e38 CR3: 0000000115cec000 CR4: 00000000000006f0
Call Trace:
<TASK>
dst_entries_add include/net/dst_ops.h:59 [inline]
dst_count_dec net/core/dst.c:162 [inline]
dst_release+0x126/0x1b0 net/core/dst.c:176
refdst_drop include/net/dst.h:266 [inline]
skb_dst_drop include/net/dst.h:278 [inline]
____bpf_skb_set_tunnel_key net/core/filter.c:4867 [inline]
bpf_skb_set_tunnel_key+0x239/0xa30 net/core/filter.c:4835
bpf_prog_adb554717e5d6596+0x4f/0x5c
bpf_dispatcher_nop_func include/linux/bpf.h:1402 [inline]
__bpf_prog_run include/linux/filter.h:723 [inline]
bpf_prog_run include/linux/filter.h:730 [inline]
bpf_test_run+0x354/0x830 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0xe02/0x1ea0 net/bpf/test_run.c:1164
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4714
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6236
__do_sys_bpf kernel/bpf/syscall.c:6331 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6329 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6329
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fca1679acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdef1739c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fca16a15fa0 RCX: 00007fca1679acb9
RDX: 0000000000000050 RSI: 0000200000000d80 RDI: 000000000000000a
RBP: 00007fca16808bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fca16a15fac R14: 00007fca16a15fa0 R15: 00007fca16a15fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:percpu_counter_add_batch+0x3e/0x1d0 lib/percpu_counter.c:98
Code: d4 49 89 f5 48 89 fb 49 bf 00 00 00 00 00 fc ff df e8 e6 76 f2 fc 48 89 5c 24 10 4c 8d 73 58 4c 89 f0 48 c1 e8 03 48 89 04 24 <42> 80 3c 38 00 74 08 4c 89 f7 e8 d3 2c 5a fd 49 8b 06 65 8b 28 41
RSP: 0018:ffffc90003b37778 EFLAGS: 00010206
RAX: 000000000000001b RBX: 0000000000000080 RCX: ffff888115b8ba80
RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000080
RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff52000766ee4 R12: 0000000000000020
R13: ffffffffffffffff R14: 00000000000000d8 R15: dffffc0000000000
FS: 000055555baf2500(0000) GS:ffff8882a9928000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffc74af2e38 CR3: 0000000115cec000 CR4: 00000000000006f0
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 49 89 f5 mov %rsi,%r13
3: 48 89 fb mov %rdi,%rbx
6: 49 bf 00 00 00 00 00 movabs $0xdffffc0000000000,%r15
d: fc ff df
10: e8 e6 76 f2 fc call 0xfcf276fb
15: 48 89 5c 24 10 mov %rbx,0x10(%rsp)
1a: 4c 8d 73 58 lea 0x58(%rbx),%r14
1e: 4c 89 f0 mov %r14,%rax
21: 48 c1 e8 03 shr $0x3,%rax
25: 48 89 04 24 mov %rax,(%rsp)
* 29: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1) <-- trapping instruction
2e: 74 08 je 0x38
30: 4c 89 f7 mov %r14,%rdi
33: e8 d3 2c 5a fd call 0xfd5a2d0b
38: 49 8b 06 mov (%r14),%rax
3b: 65 8b 28 mov %gs:(%rax),%ebp
3e: 41 rex.B
***
general protection fault in tnl_update_pmtu
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: 75cd3beb64d0977009e3d1a2d0c03715d3e5e156
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/8d5f34b6-d9df-4c4a-9d51-7f4f910f379a/config
C repro: https://ci.syzbot.org/findings/2b87e46f-6cd5-4189-a1f4-896ea63e96a0/c_repro
syz repro: https://ci.syzbot.org/findings/2b87e46f-6cd5-4189-a1f4-896ea63e96a0/syz_repro
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000a: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057]
CPU: 0 UID: 0 PID: 5994 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:skb_dst_update_pmtu_no_confirm include/net/dst.h:565 [inline]
RIP: 0010:tnl_update_pmtu+0x52b/0x1190 net/ipv4/ip_tunnel.c:533
Code: c1 e8 03 42 80 3c 38 00 74 08 48 89 df e8 0d 3a 2a f8 4c 8b 3b 49 83 c7 50 4c 89 f8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 ff e8 e7 39 2a f8 4d 8b 3f 4d 85 ff 8b 5c
RSP: 0018:ffffc90004ef6f68 EFLAGS: 00010206
RAX: 000000000000000a RBX: ffffffff9a2dcec8 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffffff9a2dcec0 RDI: 0000000000000000
RBP: ffffffff9a2dcec0 R08: ffffffff89db11f3 R09: ffffffff8e35a3a0
R10: ffffc90004ef6f20 R11: fffff520009dede6 R12: ffff888112583800
R13: ffff888112583858 R14: 1ffff110224b070b R15: 0000000000000050
FS: 000055557643a500(0000) GS:ffff88818e328000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30363fff CR3: 00000001744e0000 CR4: 00000000000006f0
Call Trace:
<TASK>
ip_tunnel_xmit+0xd36/0x2430 net/ipv4/ip_tunnel.c:805
__gre_xmit net/ipv4/ip_gre.c:490 [inline]
ipgre_xmit+0x8e6/0xc60 net/ipv4/ip_gre.c:694
__netdev_start_xmit include/linux/netdevice.h:5273 [inline]
netdev_start_xmit include/linux/netdevice.h:5282 [inline]
xmit_one net/core/dev.c:3853 [inline]
dev_hard_start_xmit+0x2cd/0x7f0 net/core/dev.c:3869
__dev_queue_xmit+0x14dd/0x32a0 net/core/dev.c:4819
dev_queue_xmit include/linux/netdevice.h:3381 [inline]
__bpf_tx_skb+0x18e/0x260 net/core/filter.c:2153
____bpf_clone_redirect net/core/filter.c:2487 [inline]
bpf_clone_redirect+0x313/0x4b0 net/core/filter.c:2450
bpf_prog_885767c90d177146+0x62/0x6b
bpf_dispatcher_nop_func include/linux/bpf.h:1402 [inline]
__bpf_prog_run include/linux/filter.h:723 [inline]
bpf_prog_run include/linux/filter.h:730 [inline]
bpf_test_run+0x354/0x830 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0xe02/0x1ea0 net/bpf/test_run.c:1164
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4714
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6236
__do_sys_bpf kernel/bpf/syscall.c:6331 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6329 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6329
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fad0c59acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe97cab158 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fad0c815fa0 RCX: 00007fad0c59acb9
RDX: 0000000000000028 RSI: 0000200000000080 RDI: 000000000000000a
RBP: 00007fad0c608bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fad0c815fac R14: 00007fad0c815fa0 R15: 00007fad0c815fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:skb_dst_update_pmtu_no_confirm include/net/dst.h:565 [inline]
RIP: 0010:tnl_update_pmtu+0x52b/0x1190 net/ipv4/ip_tunnel.c:533
Code: c1 e8 03 42 80 3c 38 00 74 08 48 89 df e8 0d 3a 2a f8 4c 8b 3b 49 83 c7 50 4c 89 f8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 ff e8 e7 39 2a f8 4d 8b 3f 4d 85 ff 8b 5c
RSP: 0018:ffffc90004ef6f68 EFLAGS: 00010206
RAX: 000000000000000a RBX: ffffffff9a2dcec8 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffffff9a2dcec0 RDI: 0000000000000000
RBP: ffffffff9a2dcec0 R08: ffffffff89db11f3 R09: ffffffff8e35a3a0
R10: ffffc90004ef6f20 R11: fffff520009dede6 R12: ffff888112583800
R13: ffff888112583858 R14: 1ffff110224b070b R15: 0000000000000050
FS: 000055557643a500(0000) GS:ffff88818e328000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30363fff CR3: 00000001744e0000 CR4: 00000000000006f0
----------------
Code disassembly (best guess):
0: c1 e8 03 shr $0x3,%eax
3: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1)
8: 74 08 je 0x12
a: 48 89 df mov %rbx,%rdi
d: e8 0d 3a 2a f8 call 0xf82a3a1f
12: 4c 8b 3b mov (%rbx),%r15
15: 49 83 c7 50 add $0x50,%r15
19: 4c 89 f8 mov %r15,%rax
1c: 48 c1 e8 03 shr $0x3,%rax
20: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
27: fc ff df
* 2a: 80 3c 08 00 cmpb $0x0,(%rax,%rcx,1) <-- trapping instruction
2e: 74 08 je 0x38
30: 4c 89 ff mov %r15,%rdi
33: e8 e7 39 2a f8 call 0xf82a3a1f
38: 4d 8b 3f mov (%r15),%r15
3b: 4d 85 ff test %r15,%r15
3e: 8b .byte 0x8b
3f: 5c pop %rsp
***
general protection fault in xfrm_lookup_with_ifid
tree: bpf-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next.git
base: 75cd3beb64d0977009e3d1a2d0c03715d3e5e156
arch: amd64
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config: https://ci.syzbot.org/builds/8d5f34b6-d9df-4c4a-9d51-7f4f910f379a/config
C repro: https://ci.syzbot.org/findings/5c4a2d70-b003-439e-8039-496b9009f1e9/c_repro
syz repro: https://ci.syzbot.org/findings/5c4a2d70-b003-439e-8039-496b9009f1e9/syz_repro
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 0 UID: 0 PID: 5985 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:xfrm_lookup_with_ifid+0xe1/0x1af0 net/xfrm/xfrm_policy.c:3181
Code: 24 20 4d 8d 66 08 4c 89 e0 48 c1 e8 03 4d 89 ee 42 80 3c 28 00 74 08 4c 89 e7 e8 ba 20 17 f8 4d 8b 24 24 4c 89 e0 48 c1 e8 03 <42> 0f b6 04 30 84 c0 0f 85 94 17 00 00 41 0f b7 04 24 89 44 24 28
RSP: 0018:ffffc90003e96fe0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffc90003e97080 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc90003e97090
RBP: ffffc90003e970f8 R08: ffffc90003e9708f R09: 0000000000000000
R10: ffffc90003e97080 R11: fffff520007d2e12 R12: 0000000000000000
R13: dffffc0000000000 R14: dffffc0000000000 R15: 0000000000000000
FS: 000055558c0ab500(0000) GS:ffff88818e328000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30363fff CR3: 00000001b9fc8000 CR4: 00000000000006f0
Call Trace:
<TASK>
xfrm_lookup net/xfrm/xfrm_policy.c:3336 [inline]
xfrm_lookup_route+0x3c/0x1c0 net/xfrm/xfrm_policy.c:3347
vti_xmit net/ipv4/ip_vti.c:217 [inline]
vti_tunnel_xmit+0x48e/0x18f0 net/ipv4/ip_vti.c:307
__netdev_start_xmit include/linux/netdevice.h:5273 [inline]
netdev_start_xmit include/linux/netdevice.h:5282 [inline]
xmit_one net/core/dev.c:3853 [inline]
dev_hard_start_xmit+0x2cd/0x7f0 net/core/dev.c:3869
__dev_queue_xmit+0x14dd/0x32a0 net/core/dev.c:4819
dev_queue_xmit include/linux/netdevice.h:3381 [inline]
__bpf_tx_skb+0x18e/0x260 net/core/filter.c:2153
____bpf_clone_redirect net/core/filter.c:2487 [inline]
bpf_clone_redirect+0x313/0x4b0 net/core/filter.c:2450
bpf_prog_e16758452f539c38+0x5f/0x68
bpf_dispatcher_nop_func include/linux/bpf.h:1402 [inline]
__bpf_prog_run include/linux/filter.h:723 [inline]
bpf_prog_run include/linux/filter.h:730 [inline]
bpf_test_run+0x354/0x830 net/bpf/test_run.c:423
bpf_prog_test_run_skb+0xe02/0x1ea0 net/bpf/test_run.c:1164
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4714
__sys_bpf+0x643/0x950 kernel/bpf/syscall.c:6236
__do_sys_bpf kernel/bpf/syscall.c:6331 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6329 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6329
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe30af9acb9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffa3d1a918 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fe30b215fa0 RCX: 00007fe30af9acb9
RDX: 000000000000002c RSI: 0000200000000080 RDI: 000000000000000a
RBP: 00007fe30b008bf7 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fe30b215fac R14: 00007fe30b215fa0 R15: 00007fe30b215fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:xfrm_lookup_with_ifid+0xe1/0x1af0 net/xfrm/xfrm_policy.c:3181
Code: 24 20 4d 8d 66 08 4c 89 e0 48 c1 e8 03 4d 89 ee 42 80 3c 28 00 74 08 4c 89 e7 e8 ba 20 17 f8 4d 8b 24 24 4c 89 e0 48 c1 e8 03 <42> 0f b6 04 30 84 c0 0f 85 94 17 00 00 41 0f b7 04 24 89 44 24 28
RSP: 0018:ffffc90003e96fe0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffc90003e97080 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffc90003e97090
RBP: ffffc90003e970f8 R08: ffffc90003e9708f R09: 0000000000000000
R10: ffffc90003e97080 R11: fffff520007d2e12 R12: 0000000000000000
R13: dffffc0000000000 R14: dffffc0000000000 R15: 0000000000000000
FS: 000055558c0ab500(0000) GS:ffff88818e328000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30363fff CR3: 00000001b9fc8000 CR4: 00000000000006f0
----------------
Code disassembly (best guess):
0: 24 20 and $0x20,%al
2: 4d 8d 66 08 lea 0x8(%r14),%r12
6: 4c 89 e0 mov %r12,%rax
9: 48 c1 e8 03 shr $0x3,%rax
d: 4d 89 ee mov %r13,%r14
10: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1)
15: 74 08 je 0x1f
17: 4c 89 e7 mov %r12,%rdi
1a: e8 ba 20 17 f8 call 0xf81720d9
1f: 4d 8b 24 24 mov (%r12),%r12
23: 4c 89 e0 mov %r12,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax <-- trapping instruction
2f: 84 c0 test %al,%al
31: 0f 85 94 17 00 00 jne 0x17cb
37: 41 0f b7 04 24 movzwl (%r12),%eax
3c: 89 44 24 28 mov %eax,0x28(%rsp)
***
If these findings have caused you to resend the series or submit a
separate fix, please add the following tag to your commit message:
Tested-by: syzbot@syzkaller.appspotmail.com
---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-09 7:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 1:51 [PATCH v4] bpf: test_run: Fix the null pointer dereference issue in bpf_lwt_xmit_push_encap Feng Yang
2026-02-09 7:30 ` [syzbot ci] " syzbot ci
-- strict thread matches above, loose matches on Subject: below --
2026-02-06 5:51 [PATCH v3] " Feng Yang
2026-02-06 11:02 ` [syzbot ci] " syzbot ci
2026-02-05 9:22 [PATCH v2] " Feng Yang
2026-02-05 15:44 ` [syzbot ci] " syzbot ci
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox