syzbot


KASAN: use-after-free Read in relay_switch_subbuf (2)

Status: auto-obsoleted due to no activity on 2024/01/17 02:38
Reported-by: syzbot+4437fb96bc73c84ded13@syzkaller.appspotmail.com
First crash: 409d, last: 409d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in relay_switch_subbuf block trace C done error 93 754d 2248d 0/28 auto-obsoleted due to no activity on 2023/04/20 06:56
linux-5.15 KASAN: use-after-free Read in relay_switch_subbuf 2 567d 587d 0/3 auto-obsoleted due to no activity on 2023/08/23 09:04
linux-4.19 KASAN: use-after-free Read in relay_switch_subbuf 10 1609d 2033d 0/1 auto-closed as invalid on 2020/10/24 01:02
linux-4.14 KASAN: use-after-free Read in relay_switch_subbuf C done unreliable 5 800d 1842d 0/1 upstream: reported C repro on 2019/11/05 17:36
linux-4.19 KASAN: use-after-free Read in relay_switch_subbuf (2) 23 648d 1130d 0/1 upstream: reported on 2021/10/17 18:33

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in d_inode include/linux/dcache.h:526 [inline]
BUG: KASAN: use-after-free in relay_switch_subbuf+0x285/0x6e0 kernel/relay.c:676
Read of size 8 at addr ffff8880905ec7c0 by task syz-executor.0/3543

CPU: 0 PID: 3543 Comm: syz-executor.0 Not tainted 5.15.134-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 d_inode include/linux/dcache.h:526 [inline]
 relay_switch_subbuf+0x285/0x6e0 kernel/relay.c:676
 relay_reserve include/linux/relay.h:248 [inline]
 trace_note+0x553/0x6f0 kernel/trace/blktrace.c:95
 trace_note_tsk+0xa9/0x140 kernel/trace/blktrace.c:126
 __blk_add_trace+0x9f5/0xd70 kernel/trace/blktrace.c:267
 blk_add_trace_bio+0x280/0x2d0 kernel/trace/blktrace.c:905
 trace_block_bio_queue include/trace/events/block.h:332 [inline]
 submit_bio_checks+0x182c/0x1920 block/blk-core.c:893
 __submit_bio+0x5a1/0x850 block/blk-core.c:917
 __submit_bio_noacct_mq block/blk-core.c:1003 [inline]
 submit_bio_noacct+0x955/0xb30 block/blk-core.c:1033
 submit_bio+0x2dd/0x560 block/blk-core.c:1095
 submit_bio_wait+0x102/0x200 block/bio.c:1229
 blkdev_issue_flush+0x17e/0x230 block/blk-flush.c:460
 nilfs_flush_device fs/nilfs2/the_nilfs.h:380 [inline]
 nilfs_sync_fs+0x604/0x760 fs/nilfs2/super.c:536
 sync_filesystem+0x1bc/0x220 fs/sync.c:66
 generic_shutdown_super+0x6e/0x2c0 fs/super.c:448
 kill_block_super+0x7a/0xe0 fs/super.c:1414
 deactivate_locked_super+0xa0/0x110 fs/super.c:335
 cleanup_mnt+0x44e/0x500 fs/namespace.c:1143
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fa2e4e91e17
Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffd698b3828 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007fa2e4e91e17
RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffd698b38e0
RBP: 00007ffd698b38e0 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffd698b49a0
R13: 00007fa2e4edb3b9 R14: 00000000000a1de3 R15: 0000000000000003
 </TASK>

Allocated by task 3552:
 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:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 __d_alloc+0x2a/0x700 fs/dcache.c:1744
 d_alloc_pseudo+0x19/0x70 fs/dcache.c:1873
 alloc_file_pseudo+0x131/0x2f0 fs/file_table.c:225
 sock_alloc_file+0xb4/0x240 net/socket.c:462
 sock_map_fd net/socket.c:486 [inline]
 __sys_socket+0x194/0x370 net/socket.c:1564
 __do_sys_socket net/socket.c:1569 [inline]
 __se_sys_socket net/socket.c:1567 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1567
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 3552:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 __dentry_kill+0x4f4/0x650 fs/dcache.c:596
 dentry_kill+0xbb/0x290
 dput+0x1f1/0x420 fs/dcache.c:888
 __fput+0x5ec/0x890 fs/file_table.c:288
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3074
 __dentry_kill+0x4f4/0x650 fs/dcache.c:596
 shrink_dentry_list+0x398/0x6a0 fs/dcache.c:1176
 shrink_dcache_parent+0xc9/0x480
 vfs_rmdir+0x34e/0x460 fs/namei.c:4082
 do_rmdir+0x362/0x670 fs/namei.c:4139
 __do_sys_unlinkat fs/namei.c:4319 [inline]
 __se_sys_unlinkat fs/namei.c:4313 [inline]
 __x64_sys_unlinkat+0xdc/0xf0 fs/namei.c:4313
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3074
 __dentry_kill+0x4f4/0x650 fs/dcache.c:596
 shrink_dentry_list+0x398/0x6a0 fs/dcache.c:1176
 shrink_dcache_parent+0xc9/0x480
 vfs_rmdir+0x34e/0x460 fs/namei.c:4082
 do_rmdir+0x362/0x670 fs/namei.c:4139
 __do_sys_unlinkat fs/namei.c:4319 [inline]
 __se_sys_unlinkat fs/namei.c:4313 [inline]
 __x64_sys_unlinkat+0xdc/0xf0 fs/namei.c:4313
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff8880905ec758
 which belongs to the cache dentry of size 312
The buggy address is located 104 bytes inside of
 312-byte region [ffff8880905ec758, ffff8880905ec890)
The buggy address belongs to the page:
page:ffffea0002417b00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x905ec
head:ffffea0002417b00 order:1 compound_mapcount:0
memcg:ffff888021b95c01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888140007640
raw: 0000000000000000 0000000000150015 00000001ffffffff ffff888021b95c01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 3554, ts 286160186057, free_ts 0
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 __d_alloc+0x2a/0x700 fs/dcache.c:1744
 d_alloc fs/dcache.c:1823 [inline]
 d_alloc_parallel+0xca/0x1390 fs/dcache.c:2575
 __lookup_slow+0x111/0x3d0 fs/namei.c:1644
 lookup_one_len+0x187/0x2d0 fs/namei.c:2688
 start_creating+0x17f/0x310 fs/debugfs/inode.c:352
 __debugfs_create_file+0x73/0x530 fs/debugfs/inode.c:397
 cfg80211_debugfs_rdev_add+0xb3/0xe0 net/wireless/debugfs.c:109
 wiphy_register+0x1edb/0x2bb0 net/wireless/core.c:930
 ieee80211_register_hw+0x2986/0x39d0 net/mac80211/main.c:1299
 mac80211_hwsim_new_radio+0x223d/0x4200 drivers/net/wireless/mac80211_hwsim.c:3374
 hwsim_new_radio_nl+0xbae/0x1090 drivers/net/wireless/mac80211_hwsim.c:3950
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880905ec680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880905ec700: fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb
>ffff8880905ec780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff8880905ec800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880905ec880: fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/10/09 02:37 linux-5.15.y 1edcec18cfb7 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in relay_switch_subbuf
* Struck through repros no longer work on HEAD.