syzbot


KASAN: use-after-free Read in rcu_cblist_dequeue

Status: auto-closed as invalid on 2022/02/24 12:16
Reported-by: syzbot+1d58ba8172c1deed79c0@syzkaller.appspotmail.com
First crash: 1121d, last: 1121d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in rcu_cblist_dequeue kernel 1 2415d 2415d 0/28 closed as invalid on 2018/04/12 23:01

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rcu_cblist_dequeue+0x6c/0xb0 kernel/rcu/rcu_segcblist.c:75
Read of size 8 at addr ffff888110a304a0 by task syz-executor.3/29881

CPU: 0 PID: 29881 Comm: syz-executor.3 Tainted: G        W         5.10.75-syzkaller-01082-g234d53d2bb60 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x8d/0x3d0 mm/kasan/report.c:233
 __kasan_report+0x142/0x220 mm/kasan/report.c:419
 kasan_report+0x51/0x70 mm/kasan/report.c:436
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 rcu_cblist_dequeue+0x6c/0xb0 kernel/rcu/rcu_segcblist.c:75
 rcu_do_batch+0x44e/0xb40 kernel/rcu/tree.c:2473
 rcu_core+0x822/0x10d0 kernel/rcu/tree.c:2721
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2734
 __do_softirq+0x27e/0x598 kernel/softirq.c:305
 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
 do_softirq kernel/softirq.c:355 [inline]
 __local_bh_enable_ip+0x158/0x170 kernel/softirq.c:190
 local_bh_enable+0x1f/0x30 include/linux/bottom_half.h:32
 rcu_read_unlock_bh include/linux/rcupdate.h:740 [inline]
 ip_finish_output2+0xbd2/0x17d0 net/ipv4/ip_output.c:231
 __ip_finish_output+0x411/0x750 net/ipv4/ip_output.c:252
 ip_finish_output+0x3f/0x1e0 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:293 [inline]
 ip_output+0x1e9/0x410 net/ipv4/ip_output.c:432
 dst_output include/net/dst.h:443 [inline]
 ip_local_out net/ipv4/ip_output.c:126 [inline]
 ip_send_skb+0xb0/0x140 net/ipv4/ip_output.c:1573
 udp_send_skb+0x9aa/0x1330 net/ipv4/udp.c:950
 udp_sendmsg+0x1c3e/0x2e00 net/ipv4/udp.c:1238
 inet_sendmsg+0xa1/0xc0 net/ipv4/af_inet.c:821
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg net/socket.c:672 [inline]
 ____sys_sendmsg+0x5b9/0x910 net/socket.c:2343
 ___sys_sendmsg net/socket.c:2397 [inline]
 __sys_sendmmsg+0x5ae/0x7f0 net/socket.c:2487
 __do_sys_sendmmsg net/socket.c:2516 [inline]
 __se_sys_sendmmsg net/socket.c:2513 [inline]
 __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2513
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f43ade86a39
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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f43abbdc188 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f43adf8a020 RCX: 00007f43ade86a39
RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000003
RBP: 00007f43adee0e8f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdfdad0f5f R14: 00007f43abbdc300 R15: 0000000000022000

Allocated by task 29863:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:428 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516
 kasan_kmalloc include/linux/kasan.h:269 [inline]
 kmem_cache_alloc_trace+0x210/0x3a0 mm/slub.c:2968
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 percpu_ref_init+0xd5/0x310 lib/percpu-refcount.c:75
 io_ring_ctx_alloc fs/io_uring.c:1205 [inline]
 io_uring_create+0x637/0x3490 fs/io_uring.c:9411
 io_uring_setup fs/io_uring.c:9554 [inline]
 __do_sys_io_uring_setup fs/io_uring.c:9560 [inline]
 __se_sys_io_uring_setup fs/io_uring.c:9557 [inline]
 __x64_sys_io_uring_setup+0x1ce/0x290 fs/io_uring.c:9557
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 13526:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357
 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:360
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:1596 [inline]
 slab_free_freelist_hook+0xb2/0x180 mm/slub.c:1621
 slab_free mm/slub.c:3195 [inline]
 kfree+0xca/0x310 mm/slub.c:4183
 percpu_ref_exit+0x1bd/0x1e0 lib/percpu-refcount.c:144
 io_ring_ctx_free+0x819/0xa80 fs/io_uring.c:8464
 io_ring_exit_work+0x4e/0x60 fs/io_uring.c:8541
 process_one_work+0x6b4/0xfb0 kernel/workqueue.c:2289
 worker_thread+0xb15/0x1600 kernel/workqueue.c:2435
 kthread+0x371/0x390 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345
 __call_rcu kernel/rcu/tree.c:2962 [inline]
 call_rcu+0x134/0x1470 kernel/rcu/tree.c:3036
 __percpu_ref_switch_to_atomic lib/percpu-refcount.c:226 [inline]
 __percpu_ref_switch_mode+0x34d/0x640 lib/percpu-refcount.c:273
 percpu_ref_kill_and_confirm+0xa0/0x200 lib/percpu-refcount.c:387
 percpu_ref_kill include/linux/percpu-refcount.h:149 [inline]
 io_ring_ctx_wait_and_kill+0xb1/0x670 fs/io_uring.c:8557
 io_uring_release+0x5b/0x70 fs/io_uring.c:8602
 __fput+0x348/0x7d0 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:314
 task_work_run+0x147/0x1b0 kernel/task_work.c:154
 exit_task_work include/linux/task_work.h:30 [inline]
 do_exit+0x70e/0x23a0 kernel/exit.c:813
 do_group_exit+0x16a/0x2d0 kernel/exit.c:910
 get_signal+0x133e/0x1f80 kernel/signal.c:2790
 arch_do_signal+0x8d/0x620 arch/x86/kernel/signal.c:805
 exit_to_user_mode_loop kernel/entry/common.c:161 [inline]
 exit_to_user_mode_prepare+0xaa/0xe0 kernel/entry/common.c:191
 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266
 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345
 __call_rcu kernel/rcu/tree.c:2962 [inline]
 call_rcu+0x134/0x1470 kernel/rcu/tree.c:3036
 __percpu_ref_switch_to_atomic lib/percpu-refcount.c:226 [inline]
 __percpu_ref_switch_mode+0x34d/0x640 lib/percpu-refcount.c:273
 percpu_ref_kill_and_confirm+0xa0/0x200 lib/percpu-refcount.c:387
 percpu_ref_kill include/linux/percpu-refcount.h:149 [inline]
 __io_uring_register fs/io_uring.c:9737 [inline]
 __do_sys_io_uring_register+0x1e7/0x4480 fs/io_uring.c:9878
 __se_sys_io_uring_register fs/io_uring.c:9860 [inline]
 __x64_sys_io_uring_register+0x9a/0xb0 fs/io_uring.c:9860
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff888110a30480
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 32 bytes inside of
 64-byte region [ffff888110a30480, ffff888110a304c0)
The buggy address belongs to the page:
page:ffffea0004428c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x110a30
flags: 0x8000000000000200(slab)
raw: 8000000000000200 dead000000000100 dead000000000122 ffff888100043800
raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 174, ts 3991625098, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2385 [inline]
 prep_new_page mm/page_alloc.c:2391 [inline]
 get_page_from_freelist+0xa74/0xa90 mm/page_alloc.c:4063
 __alloc_pages_nodemask+0x3c8/0x820 mm/page_alloc.c:5106
 alloc_slab_page mm/slub.c:1800 [inline]
 allocate_slab+0x6b/0x350 mm/slub.c:1802
 new_slab mm/slub.c:1863 [inline]
 new_slab_objects mm/slub.c:2622 [inline]
 ___slab_alloc+0x143/0x2f0 mm/slub.c:2785
 __slab_alloc mm/slub.c:2825 [inline]
 slab_alloc_node mm/slub.c:2907 [inline]
 slab_alloc mm/slub.c:2949 [inline]
 kmem_cache_alloc_trace+0x278/0x3a0 mm/slub.c:2966
 kmalloc include/linux/slab.h:552 [inline]
 kernfs_get_open_node fs/kernfs/file.c:552 [inline]
 kernfs_fop_open+0x805/0xac0 fs/kernfs/file.c:698
 do_dentry_open+0x7a5/0x1090 fs/open.c:819
 vfs_open+0x73/0x80 fs/open.c:942
 do_open fs/namei.c:3327 [inline]
 path_openat+0x264d/0x3500 fs/namei.c:3444
 do_filp_open+0x200/0x440 fs/namei.c:3471
 do_sys_openat2+0x13b/0x470 fs/open.c:1211
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888110a30380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888110a30400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888110a30480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                               ^
 ffff888110a30500: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff888110a30580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
BUG: unable to handle page fault for address: ffffde2060f461d0
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 10002a067 P4D 10002a067 PUD 0 
Oops: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 29881 Comm: syz-executor.3 Tainted: G    B   W         5.10.75-syzkaller-01082-g234d53d2bb60 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:percpu_ref_switch_to_atomic_rcu+0x13b/0x5b0 lib/percpu-refcount.c:175
Code: 00 00 fc ff df 80 3c 08 00 74 08 48 89 df e8 cc eb 52 ff 48 8b 1b 4c 01 fb 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 a7 eb 52 ff 4c 03 23 44 89 ef 48 c7
RSP: 0018:ffffc90000007be8 EFLAGS: 00010a02
RAX: 1fffe22060f461d0 RBX: ffff110307a30e80 RCX: dffffc0000000000
RDX: 0000000000000101 RSI: 0000000000000000 RDI: 0000000000000008
RBP: ffffc90000007c30 R08: ffffffff8253df1f R09: fffffbfff0dc79b9
R10: fffffbfff0dc79b9 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 1ffffffff0d7f9d3 R15: ffff888110a30e80
FS:  00007f43abbdc700(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffde2060f461d0 CR3: 0000000149a51000 CR4: 00000000003526b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 rcu_do_batch+0x4cd/0xb40 kernel/rcu/tree.c:2484
 rcu_core+0x822/0x10d0 kernel/rcu/tree.c:2721
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2734
 __do_softirq+0x27e/0x598 kernel/softirq.c:305
 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
 do_softirq kernel/softirq.c:355 [inline]
 __local_bh_enable_ip+0x158/0x170 kernel/softirq.c:190
 local_bh_enable+0x1f/0x30 include/linux/bottom_half.h:32
 rcu_read_unlock_bh include/linux/rcupdate.h:740 [inline]
 ip_finish_output2+0xbd2/0x17d0 net/ipv4/ip_output.c:231
 __ip_finish_output+0x411/0x750 net/ipv4/ip_output.c:252
 ip_finish_output+0x3f/0x1e0 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:293 [inline]
 ip_output+0x1e9/0x410 net/ipv4/ip_output.c:432
 dst_output include/net/dst.h:443 [inline]
 ip_local_out net/ipv4/ip_output.c:126 [inline]
 ip_send_skb+0xb0/0x140 net/ipv4/ip_output.c:1573
 udp_send_skb+0x9aa/0x1330 net/ipv4/udp.c:950
 udp_sendmsg+0x1c3e/0x2e00 net/ipv4/udp.c:1238
 inet_sendmsg+0xa1/0xc0 net/ipv4/af_inet.c:821
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg net/socket.c:672 [inline]
 ____sys_sendmsg+0x5b9/0x910 net/socket.c:2343
 ___sys_sendmsg net/socket.c:2397 [inline]
 __sys_sendmmsg+0x5ae/0x7f0 net/socket.c:2487
 __do_sys_sendmmsg net/socket.c:2516 [inline]
 __se_sys_sendmmsg net/socket.c:2513 [inline]
 __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2513
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f43ade86a39
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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f43abbdc188 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f43adf8a020 RCX: 00007f43ade86a39
RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000003
RBP: 00007f43adee0e8f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdfdad0f5f R14: 00007f43abbdc300 R15: 0000000000022000
Modules linked in:
CR2: ffffde2060f461d0
---[ end trace 5504986c04825da6 ]---
RIP: 0010:percpu_ref_switch_to_atomic_rcu+0x13b/0x5b0 lib/percpu-refcount.c:175
Code: 00 00 fc ff df 80 3c 08 00 74 08 48 89 df e8 cc eb 52 ff 48 8b 1b 4c 01 fb 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 48 89 df e8 a7 eb 52 ff 4c 03 23 44 89 ef 48 c7
RSP: 0018:ffffc90000007be8 EFLAGS: 00010a02
RAX: 1fffe22060f461d0 RBX: ffff110307a30e80 RCX: dffffc0000000000
RDX: 0000000000000101 RSI: 0000000000000000 RDI: 0000000000000008
RBP: ffffc90000007c30 R08: ffffffff8253df1f R09: fffffbfff0dc79b9
R10: fffffbfff0dc79b9 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 1ffffffff0d7f9d3 R15: ffff888110a30e80
FS:  00007f43abbdc700(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffde2060f461d0 CR3: 0000000149a51000 CR4: 00000000003526b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 4 bytes skipped:
   0:	df 80 3c 08 00 74    	filds  0x7400083c(%rax)
   6:	08 48 89             	or     %cl,-0x77(%rax)
   9:	df e8                	fucomip %st(0),%st
   b:	cc                   	int3
   c:	eb 52                	jmp    0x60
   e:	ff 48 8b             	decl   -0x75(%rax)
  11:	1b 4c 01 fb          	sbb    -0x5(%rcx,%rax,1),%ecx
  15:	48 89 d8             	mov    %rbx,%rax
  18:	48 c1 e8 03          	shr    $0x3,%rax
  1c:	48 b9 00 00 00 00 00 	movabs $0xdffffc0000000000,%rcx
  23:	fc ff df
* 26:	80 3c 08 00          	cmpb   $0x0,(%rax,%rcx,1) <-- trapping instruction
  2a:	74 08                	je     0x34
  2c:	48 89 df             	mov    %rbx,%rdi
  2f:	e8 a7 eb 52 ff       	callq  0xff52ebdb
  34:	4c 03 23             	add    (%rbx),%r12
  37:	44 89 ef             	mov    %r13d,%edi
  3a:	48                   	rex.W
  3b:	c7                   	.byte 0xc7

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/10/27 12:16 android12-5.10-lts 234d53d2bb60 d50eb50a .config console log report info ci2-android-5-10 KASAN: use-after-free Read in rcu_cblist_dequeue
* Struck through repros no longer work on HEAD.