syzbot


KASAN: use-after-free Write in dir_mkdir

Status: auto-closed as invalid on 2022/05/19 15:24
Reported-by: syzbot+bb30ad48bc2ce11293a1@syzkaller.appspotmail.com
First crash: 744d, last: 744d

Sample crash report:
incfs: ino conflict with backing FS 9
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic64_cmpxchg_release include/asm-generic/atomic-instrumented.h:1484 [inline]
BUG: KASAN: use-after-free in atomic_long_cmpxchg_release include/asm-generic/atomic-long.h:425 [inline]
BUG: KASAN: use-after-free in __mutex_unlock_fast kernel/locking/mutex.c:183 [inline]
BUG: KASAN: use-after-free in mutex_unlock+0x1d/0x40 kernel/locking/mutex.c:752
Write of size 8 at addr ffff888115642850 by task syz-executor.4/5386

CPU: 0 PID: 5386 Comm: syz-executor.4 Not tainted 5.10.101-syzkaller-00961-gc194212a0332 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __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
 check_region_inline mm/kasan/generic.c:135 [inline]
 kasan_check_range+0x2b6/0x2f0 mm/kasan/generic.c:186
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic64_cmpxchg_release include/asm-generic/atomic-instrumented.h:1484 [inline]
 atomic_long_cmpxchg_release include/asm-generic/atomic-long.h:425 [inline]
 __mutex_unlock_fast kernel/locking/mutex.c:183 [inline]
 mutex_unlock+0x1d/0x40 kernel/locking/mutex.c:752
 dir_mkdir+0x495/0x570 fs/incfs/vfs.c:1088
 vfs_mkdir+0x435/0x610 fs/namei.c:3725
 do_mkdirat+0x1f0/0x330 fs/namei.c:3748
 __do_sys_mkdir fs/namei.c:3764 [inline]
 __se_sys_mkdir fs/namei.c:3762 [inline]
 __x64_sys_mkdir+0x60/0x70 fs/namei.c:3762
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f8c37c75059
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8c36d88168 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007f8c37d881d0 RCX: 00007f8c37c75059
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000180
RBP: 00007f8c37ccf08d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff213e80df R14: 00007f8c36d88300 R15: 0000000000022000

Allocated by task 5381:
 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:2981
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 incfs_alloc_mount_info+0x5b/0x540 fs/incfs/data_mgmt.c:56
 incfs_mount_fs+0x3eb/0x8f0 fs/incfs/vfs.c:1806
 legacy_get_tree+0xf0/0x190 fs/fs_context.c:592
 vfs_get_tree+0x89/0x270 fs/super.c:1549
 do_new_mount fs/namespace.c:2899 [inline]
 path_mount+0x1975/0x2ab0 fs/namespace.c:3229
 do_mount fs/namespace.c:3242 [inline]
 __do_sys_mount fs/namespace.c:3450 [inline]
 __se_sys_mount+0x2f7/0x3b0 fs/namespace.c:3427
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3427
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 5387:
 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:1602 [inline]
 slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1628
 slab_free mm/slub.c:3210 [inline]
 kfree+0xd5/0x320 mm/slub.c:4198
 incfs_free_mount_info+0x201/0x210 fs/incfs/data_mgmt.c:179
 incfs_mount_fs+0x7ce/0x8f0 fs/incfs/vfs.c:1866
 legacy_get_tree+0xf0/0x190 fs/fs_context.c:592
 vfs_get_tree+0x89/0x270 fs/super.c:1549
 do_new_mount fs/namespace.c:2899 [inline]
 path_mount+0x1975/0x2ab0 fs/namespace.c:3229
 do_mount fs/namespace.c:3242 [inline]
 __do_sys_mount fs/namespace.c:3450 [inline]
 __se_sys_mount+0x2f7/0x3b0 fs/namespace.c:3427
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3427
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

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
 insert_work+0x56/0x330 kernel/workqueue.c:1348
 __queue_work+0x951/0xda0 kernel/workqueue.c:1514
 queue_work_on+0xef/0x150 kernel/workqueue.c:1541
 queue_work include/linux/workqueue.h:513 [inline]
 schedule_work include/linux/workqueue.h:574 [inline]
 bpf_prog_free+0x139/0x150 kernel/bpf/core.c:2217
 __bpf_prog_put_rcu+0x145/0x170 kernel/bpf/syscall.c:1747
 rcu_do_batch+0x4cd/0xb40 kernel/rcu/tree.c:2485
 rcu_core+0x822/0x10d0 kernel/rcu/tree.c:2722
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2735
 __do_softirq+0x27e/0x598 kernel/softirq.c:305

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:2963 [inline]
 call_rcu+0x12f/0x1500 kernel/rcu/tree.c:3037
 __bpf_prog_put_noref kernel/bpf/syscall.c:1760 [inline]
 __bpf_prog_put kernel/bpf/syscall.c:1773 [inline]
 bpf_prog_put+0x2b7/0x390 kernel/bpf/syscall.c:1779
 bpf_link_free kernel/bpf/syscall.c:2348 [inline]
 bpf_link_put+0x200/0x270 kernel/bpf/syscall.c:2373
 bpf_link_release+0x3b/0x40 kernel/bpf/syscall.c:2381
 __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
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:164 [inline]
 exit_to_user_mode_prepare+0xc3/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

The buggy address belongs to the object at ffff888115642800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 80 bytes inside of
 1024-byte region [ffff888115642800, ffff888115642c00)
The buggy address belongs to the page:
page:ffffea0004559000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x115640
head:ffffea0004559000 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 0000000000000000 0000000100000001 ffff888100042f00
raw: 0000000000000000 0000000000100010 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 1984, ts 125591524904, free_ts 125584287205
 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:5107
 alloc_slab_page mm/slub.c:1813 [inline]
 allocate_slab+0x6b/0x350 mm/slub.c:1815
 new_slab mm/slub.c:1876 [inline]
 new_slab_objects mm/slub.c:2635 [inline]
 ___slab_alloc+0x143/0x2f0 mm/slub.c:2798
 __slab_alloc mm/slub.c:2838 [inline]
 slab_alloc_node mm/slub.c:2920 [inline]
 slab_alloc mm/slub.c:2962 [inline]
 __kmalloc_track_caller+0x299/0x3b0 mm/slub.c:4543
 __kmalloc_reserve net/core/skbuff.c:143 [inline]
 __alloc_skb+0xb7/0x580 net/core/skbuff.c:211
 alloc_skb_fclone include/linux/skbuff.h:1151 [inline]
 tipc_buf_acquire net/tipc/msg.c:74 [inline]
 tipc_msg_build+0xbd/0x1be0 net/tipc/msg.c:390
 tipc_send_group_bcast+0x9d2/0xd30 net/tipc/socket.c:1108
 __tipc_sendmsg+0x1308/0x2d90 net/tipc/socket.c:1166
 tipc_sendmsg+0x55/0x70 net/tipc/socket.c:1390
 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
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1331 [inline]
 __free_pages_ok+0xbe7/0xc20 mm/page_alloc.c:1611
 free_the_page mm/page_alloc.c:5168 [inline]
 __free_pages+0x2d6/0x4a0 mm/page_alloc.c:5174
 __free_slab+0xdf/0x1a0 mm/slub.c:1901
 free_slab mm/slub.c:1916 [inline]
 discard_slab mm/slub.c:1922 [inline]
 unfreeze_partials+0x17d/0x1b0 mm/slub.c:2416
 put_cpu_partial+0xc8/0x190 mm/slub.c:2452
 __slab_free+0x2eb/0x4e0 mm/slub.c:3102
 do_slab_free mm/slub.c:3198 [inline]
 ___cache_free+0x131/0x150 mm/slub.c:3217
 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146
 qlist_free_all mm/kasan/quarantine.c:165 [inline]
 kasan_quarantine_reduce+0x178/0x1d0 mm/kasan/quarantine.c:272
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438
 kasan_slab_alloc include/linux/kasan.h:259 [inline]
 slab_post_alloc_hook mm/slab.h:583 [inline]
 slab_alloc_node mm/slub.c:2954 [inline]
 slab_alloc mm/slub.c:2962 [inline]
 __kmalloc+0x1c7/0x3d0 mm/slub.c:4036
 kmalloc include/linux/slab.h:557 [inline]
 inotify_handle_inode_event+0x151/0x4d0 fs/notify/inotify/inotify_fsnotify.c:88
 fsnotify_handle_inode_event fs/notify/fsnotify.c:263 [inline]
 fsnotify_handle_event fs/notify/fsnotify.c:310 [inline]
 send_to_group fs/notify/fsnotify.c:364 [inline]
 fsnotify+0x1a01/0x21f0 fs/notify/fsnotify.c:541
 __fsnotify_parent+0x445/0x680 fs/notify/fsnotify.c:232
 fsnotify_parent include/linux/fsnotify.h:68 [inline]
 fsnotify_file include/linux/fsnotify.h:90 [inline]
 fsnotify_close include/linux/fsnotify.h:315 [inline]
 __fput+0x238/0x7d0 fs/file_table.c:267
 ____fput+0x15/0x20 fs/file_table.c:314

Memory state around the buggy address:
 ffff888115642700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888115642780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888115642800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888115642880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888115642900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/02/18 15:15 android12-5.10-lts c194212a0332 3cd800e4 .config console log report info ci2-android-5-10 KASAN: use-after-free Write in dir_mkdir
* Struck through repros no longer work on HEAD.