syzbot


KASAN: slab-use-after-free Read in bq_xmit_all

Status: fixed on 2024/08/23 02:59
Subsystems: bpf net
[Documentation on labels]
Reported-by: syzbot+707d98c8649695eaf329@syzkaller.appspotmail.com
Fix commit: 9da49aa80d68 tun: Add missing bpf_net_ctx_clear() in do_xdp_generic()
First crash: 55d, last: 37d
Cause bisection: introduced by (bisect log) :
commit fecef4cd42c689a200bdd39e6fffa71475904bc1
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu Jul 4 14:48:15 2024 +0000

  tun: Assign missing bpf_net_context.

Crash: BUG: unable to handle kernel paging request in __dev_flush (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH net] tun: Add missing bpf_net_ctx_clear() in do_xdp_generic() 7 (7) 2024/07/29 10:08
[syzbot] [bpf?] [net?] KASAN: slab-use-after-free Read in bq_xmit_all 1 (20) 2024/07/22 09:48
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 BUG: unable to handle kernel NULL pointer dereference in bq_xmit_all 17 2d18h 95d 0/3 upstream: reported on 2024/06/04 09:15
linux-5.15 BUG: unable to handle kernel NULL pointer dereference in bq_xmit_all 3 51d 110d 0/3 upstream: reported on 2024/05/20 11:01
Last patch testing requests (17)
Created Duration User Patch Repo Result
2024/07/22 09:48 22m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 605c96997d89c01c11bbddb4db820ede570581c7 report log
2024/07/22 09:44 2h41m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fecef4cd42c689a200bdd39e6fffa71475904bc1 report log
2024/07/22 09:43 3h13m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3b2aef99221d395ce37efa426d7b50e7dcd621d6 OK log
2024/07/22 09:43 37m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3b2aef99221d395ce37efa426d7b50e7dcd621d6a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69 error
2024/07/21 16:38 23m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69 OK log
2024/07/21 16:36 17m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 605c96997d89c01c11bbddb4db820ede570581c7 report log
2024/07/21 16:35 24m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fd8db07705c55a995c42b1e71afc42faad675b0b OK log
2024/07/21 15:47 0m aha310510@gmail.com patch git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git upstream error
2024/07/21 15:13 23m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d839a73179ae91c07f5f2f97ccb9c69b2b7c3306 OK log
2024/07/21 15:04 26m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3f9fe37d9e16a6cfd5f4d1f536686ea71db3196f OK log
2024/07/21 14:44 24m aha310510@gmail.com patch upstream report log
2024/07/21 13:29 17m aha310510@gmail.com patch upstream report log
2024/07/21 13:16 19m aha310510@gmail.com patch upstream report log
2024/07/21 11:37 18m aha310510@gmail.com patch upstream report log
2024/07/21 10:45 23m aha310510@gmail.com patch upstream report log
2024/07/21 08:52 27m aha310510@gmail.com upstream report log
2024/07/21 03:28 46m aha310510@gmail.com upstream report log

Sample crash report:
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in ./kernel/bpf/devmap.c:385:28
index 16 is out of range for type 'struct xdp_frame *[16]'
CPU: 0 UID: 0 PID: 5225 Comm: syz-executor121 Not tainted 6.10.0-syzkaller-12708-g2f8c4f506285 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 ubsan_epilogue lib/ubsan.c:231 [inline]
 __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:429
 bq_xmit_all+0x157/0x11d0 kernel/bpf/devmap.c:385
 __dev_flush+0x81/0x160 kernel/bpf/devmap.c:425
 xdp_do_check_flushed+0x129/0x240 net/core/filter.c:4307
 __napi_poll+0xe4/0x490 net/core/dev.c:6774
 napi_poll net/core/dev.c:6840 [inline]
 net_rx_action+0x89b/0x1240 net/core/dev.c:6962
 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
 common_interrupt+0xaa/0xd0 arch/x86/kernel/irq.c:278
 </IRQ>
 <TASK>
 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x29/0x50 kernel/locking/spinlock.c:202
Code: 90 f3 0f 1e fa 53 48 89 fb 48 83 c7 18 48 8b 74 24 08 e8 7a 26 b9 f5 48 89 df e8 52 69 ba f5 e8 0d 3c e4 f5 fb bf 01 00 00 00 <e8> 22 35 ac f5 65 8b 05 63 2b 4d 74 85 c0 74 06 5b c3 cc cc cc cc
RSP: 0018:ffffc9000347fd48 EFLAGS: 00000286
RAX: 5dae3de087a45100 RBX: ffff88801cb39bc0 RCX: ffffffff94ce1903
RDX: dffffc0000000000 RSI: ffffffff8bead5a0 RDI: 0000000000000001
RBP: ffff88807dd45f70 R08: ffffffff8ff66fef R09: 1ffffffff1fecdfd
R10: dffffc0000000000 R11: fffffbfff1fecdfe R12: 1ffff1100fba8c63
R13: ffff88807dd45a00 R14: ffff88807dd46318 R15: 1ffff1100fba8b46
 spin_unlock_irq include/linux/spinlock.h:401 [inline]
 ptrace_stop+0x414/0x930 kernel/signal.c:2306
 ptrace_do_notify kernel/signal.c:2393 [inline]
 ptrace_notify+0x255/0x380 kernel/signal.c:2405
 ptrace_report_syscall include/linux/ptrace.h:415 [inline]
 ptrace_report_syscall_entry include/linux/ptrace.h:452 [inline]
 syscall_trace_enter+0x5d/0x150 kernel/entry/common.c:45
 syscall_enter_from_user_mode_work include/linux/entry-common.h:168 [inline]
 syscall_enter_from_user_mode include/linux/entry-common.h:198 [inline]
 do_syscall_64+0xcc/0x230 arch/x86/entry/common.c:79
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f046182f020
Code: ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 80 3d 81 e0 07 00 00 74 17 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c
RSP: 002b:00007fff7440f158 EFLAGS: 00000202 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 000000000000001e RCX: 00007f046182f020
RDX: ffffffffffffffb8 RSI: 0000000020000100 RDI: 000000000000001d
RBP: 00007fff7440f1a0 R08: 00007fff7440f180 R09: 00007fff7440f180
R10: 00007fff7440f180 R11: 0000000000000202 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
---[ end trace ]---
----------------
Code disassembly (best guess):
   0:	90                   	nop
   1:	f3 0f 1e fa          	endbr64
   5:	53                   	push   %rbx
   6:	48 89 fb             	mov    %rdi,%rbx
   9:	48 83 c7 18          	add    $0x18,%rdi
   d:	48 8b 74 24 08       	mov    0x8(%rsp),%rsi
  12:	e8 7a 26 b9 f5       	call   0xf5b92691
  17:	48 89 df             	mov    %rbx,%rdi
  1a:	e8 52 69 ba f5       	call   0xf5ba6971
  1f:	e8 0d 3c e4 f5       	call   0xf5e43c31
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 22 35 ac f5       	call   0xf5ac3551 <-- trapping instruction
  2f:	65 8b 05 63 2b 4d 74 	mov    %gs:0x744d2b63(%rip),%eax        # 0x744d2b99
  36:	85 c0                	test   %eax,%eax
  38:	74 06                	je     0x40
  3a:	5b                   	pop    %rbx
  3b:	c3                   	ret
  3c:	cc                   	int3
  3d:	cc                   	int3
  3e:	cc                   	int3
  3f:	cc                   	int3

Crashes (29):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/27 03:23 upstream 2f8c4f506285 46eb10b7 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/19 19:08 upstream 720261cfc732 ee4e11c8 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: stack-out-of-bounds Read in bq_xmit_all
2024/07/20 10:04 upstream 8e5c0abfa02d b88348e9 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/19 05:11 linux-next 73399b58e5e5 ee4e11c8 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/29 11:10 upstream dc1c8034e31b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in bq_xmit_all
2024/07/25 14:27 linux-next 864b1099d16f 32fcf98f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in bq_xmit_all
2024/07/14 22:22 linux-next 3fe121b62282 eaeb5c15 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in bq_xmit_all
2024/08/01 17:32 upstream 21b136cc63d2 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/30 06:39 upstream 94ede2a3e913 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/29 07:04 upstream dc1c8034e31b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/26 06:32 upstream 1722389b0d86 3f86dfed .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root BUG: unable to handle kernel paging request in bq_xmit_all
2024/07/26 00:34 upstream c33ffdb70cc6 32fcf98f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/25 09:18 upstream c33ffdb70cc6 b24754ac .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/24 12:28 upstream 28bbe4ea686a 57b2edb1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/24 00:30 upstream 28bbe4ea686a 57b2edb1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/22 09:01 upstream 7846b618e0a4 b88348e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/21 16:05 upstream 2c9b3512402e b88348e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/08/01 02:15 upstream e4fc196f5ba3 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-386-root KMSAN: uninit-value in bq_xmit_all
2024/08/01 16:11 upstream 21b136cc63d2 1e9c4cf3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: stack-out-of-bounds Read in bq_xmit_all
2024/08/01 15:12 upstream 21b136cc63d2 1e9c4cf3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/08/01 15:12 upstream 21b136cc63d2 1e9c4cf3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/29 21:30 upstream 6b5faec9f564 a4e01e1e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/24 04:10 upstream e9680017b2dc 57b2edb1 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/31 03:06 linux-next 931a3b3bccc9 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/28 16:18 linux-next 668d33c9ff92 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root UBSAN: array-index-out-of-bounds in bq_xmit_all
2024/07/28 12:43 linux-next 668d33c9ff92 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/25 22:51 linux-next 864b1099d16f 32fcf98f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in bq_xmit_all
2024/07/20 02:26 linux-next 41c196e567fb b88348e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in bq_xmit_all
2024/07/16 06:38 linux-next 3fe121b62282 b66b37bd .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in bq_xmit_all
* Struck through repros no longer work on HEAD.