syzbot


general protection fault in xdp_do_redirect

Status: fixed on 2024/08/14 03:44
Subsystems: bpf net
[Documentation on labels]
Reported-by: syzbot+0b5c75599f1d872bea6f@syzkaller.appspotmail.com
Fix commit: fecef4cd42c6 tun: Assign missing bpf_net_context.
First crash: 169d, last: 159d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH net-net] tun: Assign missing bpf_net_context. 18 (18) 2024/09/16 10:19
[syzbot] [bpf?] [net?] general protection fault in xdp_do_redirect 0 (1) 2024/07/01 23:53

Sample crash report:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000007: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000038-0x000000000000003f]
CPU: 1 UID: 0 PID: 6147 Comm: syz.0.195 Not tainted 6.10.0-rc6-next-20240703-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
RIP: 0010:bpf_net_ctx_get_ri include/linux/filter.h:788 [inline]
RIP: 0010:xdp_do_redirect+0x63/0xb40 net/core/filter.c:4440
Code: c3 00 18 00 00 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 9c 38 90 f8 4c 8b 23 4d 8d 74 24 38 4c 89 f3 48 c1 eb 03 <42> 0f b6 04 2b 84 c0 0f 85 fc 07 00 00 41 8b 2e 89 ee 83 e6 02 31
RSP: 0018:ffffc9000448f828 EFLAGS: 00010202
RAX: 1ffff11004a48a80 RBX: 0000000000000007 RCX: 0000000000040000
RDX: ffffc90003d69000 RSI: 00000000000001c0 RDI: 00000000000001c1
RBP: ffffc9000448f9b0 R08: 0000000000000005 R09: ffffffff866bc849
R10: 0000000000000005 R11: ffff888025243c00 R12: 0000000000000000
R13: dffffc0000000000 R14: 0000000000000038 R15: ffffc9000448faf0
FS:  00007f1f5262e6c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000110c40e5b5 CR3: 000000007c2fc000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 tun_xdp_act+0xe9/0xb70 drivers/net/tun.c:1626
 tun_build_skb drivers/net/tun.c:1716 [inline]
 tun_get_user+0x346d/0x4560 drivers/net/tun.c:1819
 tun_chr_write_iter+0x113/0x1f0 drivers/net/tun.c:2048
 new_sync_write fs/read_write.c:497 [inline]
 vfs_write+0xa72/0xc90 fs/read_write.c:590
 ksys_write+0x1a0/0x2c0 fs/read_write.c:643
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1f5177475f
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 29 8c 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 7c 8c 02 00 48
RSP: 002b:00007f1f5262e010 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f1f51903f60 RCX: 00007f1f5177475f
RDX: 0000000000000016 RSI: 00000000200000c0 RDI: 00000000000000c8
RBP: 00007f1f517e4aa1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000016 R11: 0000000000000293 R12: 0000000000000000
R13: 000000000000000b R14: 00007f1f51903f60 R15: 00007ffed3dfd958
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bpf_net_ctx_get_ri include/linux/filter.h:788 [inline]
RIP: 0010:xdp_do_redirect+0x63/0xb40 net/core/filter.c:4440
Code: c3 00 18 00 00 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 9c 38 90 f8 4c 8b 23 4d 8d 74 24 38 4c 89 f3 48 c1 eb 03 <42> 0f b6 04 2b 84 c0 0f 85 fc 07 00 00 41 8b 2e 89 ee 83 e6 02 31
RSP: 0018:ffffc9000448f828 EFLAGS: 00010202
RAX: 1ffff11004a48a80 RBX: 0000000000000007 RCX: 0000000000040000
RDX: ffffc90003d69000 RSI: 00000000000001c0 RDI: 00000000000001c1
RBP: ffffc9000448f9b0 R08: 0000000000000005 R09: ffffffff866bc849
R10: 0000000000000005 R11: ffff888025243c00 R12: 0000000000000000
R13: dffffc0000000000 R14: 0000000000000038 R15: ffffc9000448faf0
FS:  00007f1f5262e6c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000110c40e5b5 CR3: 000000007c2fc000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	c3                   	ret
   1:	00 18                	add    %bl,(%rax)
   3:	00 00                	add    %al,(%rax)
   5:	48 89 d8             	mov    %rbx,%rax
   8:	48 c1 e8 03          	shr    $0x3,%rax
   c:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1)
  11:	74 08                	je     0x1b
  13:	48 89 df             	mov    %rbx,%rdi
  16:	e8 9c 38 90 f8       	call   0xf89038b7
  1b:	4c 8b 23             	mov    (%rbx),%r12
  1e:	4d 8d 74 24 38       	lea    0x38(%r12),%r14
  23:	4c 89 f3             	mov    %r14,%rbx
  26:	48 c1 eb 03          	shr    $0x3,%rbx
* 2a:	42 0f b6 04 2b       	movzbl (%rbx,%r13,1),%eax <-- trapping instruction
  2f:	84 c0                	test   %al,%al
  31:	0f 85 fc 07 00 00    	jne    0x833
  37:	41 8b 2e             	mov    (%r14),%ebp
  3a:	89 ee                	mov    %ebp,%esi
  3c:	83 e6 02             	and    $0x2,%esi
  3f:	31                   	.byte 0x31

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/08 09:36 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/07 12:17 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/07 12:16 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/07 03:36 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/07 03:34 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/06 14:08 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/05 07:00 linux-next 0b58e108042b dc6bbff0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/05 06:59 linux-next 0b58e108042b dc6bbff0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/04 18:38 linux-next 0b58e108042b dc6bbff0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/07/04 18:38 linux-next 0b58e108042b dc6bbff0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/06/28 06:16 linux-next 642a16ca7994 b62c7d46 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/06/28 06:15 linux-next 642a16ca7994 b62c7d46 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/06/28 00:04 linux-next 642a16ca7994 b62c7d46 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/06/27 23:51 linux-next 642a16ca7994 b62c7d46 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
2024/06/27 23:51 linux-next 642a16ca7994 b62c7d46 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root general protection fault in xdp_do_redirect
* Struck through repros no longer work on HEAD.