syzbot


KASAN: use-after-free Read in tw_timer_handler

Status: premoderation: reported syz repro on 2025/06/10 23:40
Reported-by: syzbot+df389216c9cf4eb640fd@syzkaller.appspotmail.com
First crash: 32d, last: 5d18h
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in tw_timer_handler 19 3 27d 34d 0/2 premoderation: reported on 2025/06/08 18:56
linux-4.14 KASAN: use-after-free Read in tw_timer_handler 19 4 2007d 2112d 0/1 auto-closed as invalid on 2020/05/12 09:52
Last patch testing requests (1)
Created Duration User Patch Repo Result
2025/07/04 21:38 15m retest repro android13-5.10-lts report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in tw_timer_handler+0x8f/0xf0 include/net/net_namespace.h:-1
Read of size 8 at addr ffff888128c12810 by task syz.0.4835/10169

CPU: 1 PID: 10169 Comm: syz.0.4835 Tainted: G        W         5.10.238-syzkaller-00282-gd76d4cd0623a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <IRQ>
 __dump_stack+0x21/0x24 lib/dump_stack.c:77
 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0xe2/0x130 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 tw_timer_handler+0x8f/0xf0 include/net/net_namespace.h:-1
 call_timer_fn+0x38/0x290 kernel/time/timer.c:1450
 expire_timers kernel/time/timer.c:1495 [inline]
 __run_timers+0x639/0x9a0 kernel/time/timer.c:1789
 run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1802
 __do_softirq+0x255/0x563 kernel/softirq.c:309
 asm_call_irq_on_stack+0xf/0x20
 </IRQ>
 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
 run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
 do_softirq_own_stack+0x60/0x80 arch/x86/kernel/irq_64.c:77
 invoke_softirq kernel/softirq.c:405 [inline]
 __irq_exit_rcu+0x128/0x150 kernel/softirq.c:435
 irq_exit_rcu+0x9/0x10 kernel/softirq.c:447
 sysvec_apic_timer_interrupt+0xbf/0xe0 arch/x86/kernel/apic/apic.c:1106
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:635
RIP: 0010:instrument_atomic_read include/linux/instrumented.h:71 [inline]
RIP: 0010:atomic64_read include/asm-generic/atomic-instrumented.h:837 [inline]
RIP: 0010:atomic_long_read include/asm-generic/atomic-long.h:29 [inline]
RIP: 0010:__mutex_owner kernel/locking/mutex.c:77 [inline]
RIP: 0010:mutex_spin_on_owner+0x230/0x2e0 kernel/locking/mutex.c:571
Code: 00 00 e8 93 b5 52 00 48 8b 45 a0 42 80 3c 38 00 74 08 4c 89 ef e8 a0 b3 52 00 49 f7 45 00 01 00 00 00 0f 85 8b 00 00 00 f3 90 <4c> 89 ef be 08 00 00 00 e8 63 b5 52 00 48 8b 45 a0 42 80 3c 38 00
RSP: 0018:ffffc90000f87260 EFLAGS: 00000246
RAX: ffff8881f7000000 RBX: ffff888115070000 RCX: ffffffff814acfc9
RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000000
RBP: ffffc90000f872f0 R08: dffffc0000000000 R09: ffffed1023587769
R10: ffffed1023587769 R11: 1ffff11023587768 R12: ffffffff868f59b0
R13: ffffffff868f59a0 R14: ffffffff868f59b0 R15: dffffc0000000000
 mutex_optimistic_spin kernel/locking/mutex.c:688 [inline]
 __mutex_lock_common kernel/locking/mutex.c:976 [inline]
 __mutex_lock+0x2be/0xc50 kernel/locking/mutex.c:1117
 __mutex_lock_slowpath+0xe/0x10 kernel/locking/mutex.c:1379
 mutex_lock+0xcf/0xe0 kernel/locking/mutex.c:299
 genl_lock net/netlink/genetlink.c:33 [inline]
 genl_rcv_msg+0x12d/0x1090 net/netlink/genetlink.c:798
 netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2485
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:811
 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline]
 netlink_unicast+0x87c/0xa40 net/netlink/af_netlink.c:1333
 netlink_sendmsg+0x88d/0xb30 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2376
 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2430
 __sys_sendmsg net/socket.c:2459 [inline]
 __do_sys_sendmsg net/socket.c:2468 [inline]
 __se_sys_sendmsg net/socket.c:2466 [inline]
 __x64_sys_sendmsg+0x1e2/0x2a0 net/socket.c:2466
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f5981e57929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f59818c8038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f598207efa0 RCX: 00007f5981e57929
RDX: 0000000000000000 RSI: 00002000000001c0 RDI: 0000000000000004
RBP: 00007f5981ed9b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f598207efa0 R15: 00007ffca505c398

Allocated by task 352:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:430 [inline]
 __kasan_slab_alloc+0xbd/0xf0 mm/kasan/common.c:463
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x5d/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x165/0x2e0 mm/slub.c:2960
 kmem_cache_zalloc include/linux/slab.h:654 [inline]
 net_alloc net/core/net_namespace.c:421 [inline]
 copy_net_ns+0x13f/0x520 net/core/net_namespace.c:473
 create_new_namespaces+0x3a2/0x650 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x120/0x170 kernel/nsproxy.c:231
 ksys_unshare+0x4ac/0x7d0 kernel/fork.c:3156
 __do_sys_unshare kernel/fork.c:3224 [inline]
 __se_sys_unshare kernel/fork.c:3222 [inline]
 __x64_sys_unshare+0x38/0x40 kernel/fork.c:3222
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888128c12680
 which belongs to the cache net_namespace of size 4672
The buggy address is located 400 bytes inside of
 4672-byte region [ffff888128c12680, ffff888128c138c0)
The buggy address belongs to the page:
page:ffffea0004a30400 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888128c12680 pfn:0x128c10
head:ffffea0004a30400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 ffffea000498b600 0000000200000002 ffff888107fdd800
raw: ffff888128c12680 0000000080060000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 323, ts 30767217477, free_ts 30751480220
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x179/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5357
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x84/0x3f0 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x2a6/0x450 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x1af/0x2e0 mm/slub.c:2960
 kmem_cache_zalloc include/linux/slab.h:654 [inline]
 net_alloc net/core/net_namespace.c:421 [inline]
 copy_net_ns+0x13f/0x520 net/core/net_namespace.c:473
 create_new_namespaces+0x3a2/0x650 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x120/0x170 kernel/nsproxy.c:231
 ksys_unshare+0x4ac/0x7d0 kernel/fork.c:3156
 __do_sys_unshare kernel/fork.c:3224 [inline]
 __se_sys_unshare kernel/fork.c:3222 [inline]
 __x64_sys_unshare+0x38/0x40 kernel/fork.c:3222
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 free_pcp_prepare mm/page_alloc.c:1421 [inline]
 free_unref_page_prepare+0x2b7/0x2d0 mm/page_alloc.c:3336
 free_unref_page mm/page_alloc.c:3391 [inline]
 free_the_page mm/page_alloc.c:5416 [inline]
 __free_pages+0x14b/0x380 mm/page_alloc.c:5427
 __vunmap+0x84d/0x9d0 mm/vmalloc.c:2301
 __vfree mm/vmalloc.c:2350 [inline]
 vfree+0x61/0x90 mm/vmalloc.c:2381
 kcov_put kernel/kcov.c:408 [inline]
 kcov_close+0x2b/0x50 kernel/kcov.c:510
 __fput+0x2fb/0x770 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:314
 task_work_run+0x127/0x190 kernel/task_work.c:189
 exit_task_work include/linux/task_work.h:33 [inline]
 do_exit+0xa27/0x2470 kernel/exit.c:863
 do_group_exit+0x141/0x310 kernel/exit.c:985
 get_signal+0xf7d/0x12e0 kernel/signal.c:2793
 arch_do_signal_or_restart+0xbf/0x10f0 arch/x86/kernel/signal.c:805
 handle_signal_work kernel/entry/common.c:145 [inline]
 exit_to_user_mode_loop+0xa2/0xe0 kernel/entry/common.c:169
 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
 syscall_exit_to_user_mode+0x68/0x90 kernel/entry/common.c:274
 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff888128c12700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888128c12780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888128c12800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff888128c12880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888128c12900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	e8 93 b5 52 00       	call   0x52b59a
   7:	48 8b 45 a0          	mov    -0x60(%rbp),%rax
   b:	42 80 3c 38 00       	cmpb   $0x0,(%rax,%r15,1)
  10:	74 08                	je     0x1a
  12:	4c 89 ef             	mov    %r13,%rdi
  15:	e8 a0 b3 52 00       	call   0x52b3ba
  1a:	49 f7 45 00 01 00 00 	testq  $0x1,0x0(%r13)
  21:	00
  22:	0f 85 8b 00 00 00    	jne    0xb3
  28:	f3 90                	pause
* 2a:	4c 89 ef             	mov    %r13,%rdi <-- trapping instruction
  2d:	be 08 00 00 00       	mov    $0x8,%esi
  32:	e8 63 b5 52 00       	call   0x52b59a
  37:	48 8b 45 a0          	mov    -0x60(%rbp),%rax
  3b:	42 80 3c 38 00       	cmpb   $0x0,(%rax,%r15,1)

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/17 14:54 android13-5.10-lts d76d4cd0623a cfebc887 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/07/07 11:21 android13-5.10-lts 59e9a7228857 4f67c4ae .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/06/20 01:15 android13-5.10-lts d76d4cd0623a ed3e87f7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/06/17 08:26 android13-5.10-lts d76d4cd0623a cfebc887 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/06/15 12:36 android13-5.10-lts d76d4cd0623a 5f4b362d .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/06/13 04:46 android13-5.10-lts d76d4cd0623a 98683f8f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/06/12 20:34 android13-5.10-lts d76d4cd0623a 98683f8f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/06/11 01:37 android13-5.10-lts d76d4cd0623a 5d7e17ca .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
2025/06/10 23:39 android13-5.10-lts d76d4cd0623a 5d7e17ca .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in tw_timer_handler
* Struck through repros no longer work on HEAD.