syzbot


KASAN: slab-out-of-bounds Read in dentry_revalidate

Status: premoderation: reported on 2025/03/02 11:22
Reported-by: syzbot+1814eb4c7acc26ca0dd8@syzkaller.appspotmail.com
First crash: 7d04h, last: 7d04h

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in dentry_revalidate+0x12a/0x350 fs/incfs/vfs.c:1554
Read of size 8 at addr ffff88811bfcda10 by task syz-executor/13721

CPU: 0 PID: 13721 Comm: syz-executor Tainted: G        W         5.10.234-syzkaller-00023-g3f5f2283d684 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 dentry_revalidate+0x12a/0x350 fs/incfs/vfs.c:1554
 d_revalidate fs/namei.c:780 [inline]
 lookup_fast+0x481/0x7d0 fs/namei.c:1589
 walk_component+0x115/0x610 fs/namei.c:1948
 lookup_last fs/namei.c:2403 [inline]
 path_lookupat+0x16d/0x450 fs/namei.c:2427
 filename_lookup+0x26a/0x6f0 fs/namei.c:2460
 user_path_at_empty+0x40/0x50 fs/namei.c:2740
 user_path_at include/linux/namei.h:60 [inline]
 vfs_statx+0x106/0x3b0 fs/stat.c:193
 vfs_fstatat fs/stat.c:215 [inline]
 __do_sys_newfstatat fs/stat.c:383 [inline]
 __se_sys_newfstatat+0xc8/0x760 fs/stat.c:377
 __x64_sys_newfstatat+0x9b/0xb0 fs/stat.c:377
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f69369c397a
Code: 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 0b 00 00 00 66 2e 0f 1f 84 00 00 00 00 00 90 41 89 ca b8 06 01 00 00 0f 05 <3d> 00 f0 ff ff 77 07 31 c0 c3 0f 1f 40 00 48 c7 c2 a8 ff ff ff f7
RSP: 002b:00007ffdcd2401a8 EFLAGS: 00000286 ORIG_RAX: 0000000000000106
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f69369c397a
RDX: 00007ffdcd2401d0 RSI: 00007ffdcd240260 RDI: 00000000ffffff9c
RBP: 00007ffdcd240260 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000286 R12: 00007ffdcd241350
R13: 00007f6936a4608c R14: 0000555559cfe4a8 R15: 00007ffdcd242420

Allocated by task 20073:
 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+0xb1/0xe0 mm/kasan/common.c:463
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2779 [inline]
 f2fs_alloc_inode+0x26/0x420 fs/f2fs/super.c:1373
 alloc_inode fs/inode.c:233 [inline]
 iget_locked+0x14f/0x870 fs/inode.c:1275
 f2fs_iget+0x55/0x50a0 fs/f2fs/inode.c:498
 f2fs_fill_super+0x63b6/0x7d90 fs/f2fs/super.c:4301
 mount_bdev+0x262/0x370 fs/super.c:1442
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:4548
 legacy_get_tree+0xf1/0x190 fs/fs_context.c:593
 vfs_get_tree+0x88/0x290 fs/super.c:1572
 do_new_mount+0x2ba/0xb30 fs/namespace.c:2917
 path_mount+0x56f/0xcb0 fs/namespace.c:3247
 do_mount fs/namespace.c:3260 [inline]
 __do_sys_mount fs/namespace.c:3468 [inline]
 __se_sys_mount+0x2c4/0x3b0 fs/namespace.c:3445
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3445
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 12:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kmem_cache_free+0xa9/0x1e0 mm/slub.c:3219
 f2fs_free_inode+0x24/0x30 fs/f2fs/super.c:1528
 i_callback+0x4b/0x70 fs/inode.c:222
 rcu_do_batch+0x597/0xc40 kernel/rcu/tree.c:2494
 rcu_core+0x5ad/0xe40 kernel/rcu/tree.c:2735
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2748
 __do_softirq+0x268/0x5bb kernel/softirq.c:309

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2976 [inline]
 call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050
 destroy_inode fs/inode.c:288 [inline]
 evict+0x8e8/0x9c0 fs/inode.c:629
 iput_final fs/inode.c:1736 [inline]
 iput+0x632/0x7e0 fs/inode.c:1762
 f2fs_put_super+0x5eb/0xb90 fs/f2fs/super.c:1611
 generic_shutdown_super+0x147/0x320 fs/super.c:465
 kill_block_super+0x7e/0xe0 fs/super.c:1469
 kill_f2fs_super+0x2f9/0x3c0 fs/f2fs/super.c:4580
 deactivate_locked_super+0xad/0x110 fs/super.c:335
 deactivate_super+0xbe/0xf0 fs/super.c:366
 cleanup_mnt+0x45c/0x510 fs/namespace.c:1118
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125
 task_work_run+0x129/0x190 kernel/task_work.c:189
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xbf/0xd0 kernel/entry/common.c:172
 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
 syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274
 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2976 [inline]
 call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050
 destroy_inode fs/inode.c:288 [inline]
 evict+0x8e8/0x9c0 fs/inode.c:629
 dispose_list fs/inode.c:647 [inline]
 evict_inodes+0x638/0x6c0 fs/inode.c:701
 generic_shutdown_super+0x97/0x320 fs/super.c:454
 kill_block_super+0x7e/0xe0 fs/super.c:1469
 kill_f2fs_super+0x2f9/0x3c0 fs/f2fs/super.c:4580
 deactivate_locked_super+0xad/0x110 fs/super.c:335
 deactivate_super+0xbe/0xf0 fs/super.c:366
 cleanup_mnt+0x45c/0x510 fs/namespace.c:1118
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125
 task_work_run+0x129/0x190 kernel/task_work.c:189
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xbf/0xd0 kernel/entry/common.c:172
 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
 syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274
 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88811bfcd3b0
 which belongs to the cache f2fs_inode_cache of size 1520
The buggy address is located 112 bytes to the right of
 1520-byte region [ffff88811bfcd3b0, ffff88811bfcd9a0)
The buggy address belongs to the page:
page:ffffea00046ff200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88811bfc8000 pfn:0x11bfc8
head:ffffea00046ff200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000100000001 ffff8881029ce180
raw: ffff88811bfc8000 000000008013000b 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 1641, ts 82807500058, free_ts 79237509324
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 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+0x1b9/0x2e0 mm/slub.c:2960
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2779 [inline]
 f2fs_alloc_inode+0x26/0x420 fs/f2fs/super.c:1373
 alloc_inode fs/inode.c:233 [inline]
 new_inode_pseudo+0x64/0x220 fs/inode.c:968
 new_inode+0x28/0x1c0 fs/inode.c:997
 f2fs_new_inode+0x126/0x14d0 fs/f2fs/namei.c:35
 f2fs_create+0x1f9/0x19a0 fs/f2fs/namei.c:357
 lookup_open fs/namei.c:3247 [inline]
 open_last_lookups fs/namei.c:3317 [inline]
 path_openat+0x1377/0x3000 fs/namei.c:3506
 do_filp_open+0x21c/0x460 fs/namei.c:3536
 do_sys_openat2+0x13f/0x710 fs/open.c:1217
 do_sys_open fs/open.c:1233 [inline]
 __do_sys_open fs/open.c:1241 [inline]
 __se_sys_open fs/open.c:1237 [inline]
 __x64_sys_open+0x221/0x270 fs/open.c:1237
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_pages_ok+0x82c/0x850 mm/page_alloc.c:1629
 free_the_page+0x76/0x370 mm/page_alloc.c:5409
 __free_pages+0x67/0xc0 mm/page_alloc.c:5418
 __free_slab+0xcf/0x190 mm/slub.c:1894
 free_slab mm/slub.c:1909 [inline]
 discard_slab mm/slub.c:1915 [inline]
 unfreeze_partials+0x15e/0x190 mm/slub.c:2410
 put_cpu_partial+0xbf/0x180 mm/slub.c:2446
 __slab_free+0x2c8/0x3a0 mm/slub.c:3095
 do_slab_free mm/slub.c:3191 [inline]
 ___cache_free+0x111/0x130 mm/slub.c:3210
 qlink_free+0x50/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x47/0xb0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:440
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960
 shmem_alloc_inode+0x1a/0x30 mm/shmem.c:3816
 alloc_inode fs/inode.c:233 [inline]
 new_inode_pseudo+0x64/0x220 fs/inode.c:968

Memory state around the buggy address:
 ffff88811bfcd900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811bfcd980: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88811bfcda00: fc fc fc fc 00 00 00 00 00 00 00 00 00 00 00 00
                         ^
 ffff88811bfcda80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88811bfcdb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 PID: 13721 Comm: syz-executor Tainted: G    B   W         5.10.234-syzkaller-00023-g3f5f2283d684 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
RIP: 0010:mapping_gfp_mask include/linux/pagemap.h:106 [inline]
RIP: 0010:grab_cache_page include/linux/pagemap.h:485 [inline]
RIP: 0010:f2fs_grab_cache_page fs/f2fs/f2fs.h:2703 [inline]
RIP: 0010:__get_node_page+0x114/0xb60 fs/f2fs/node.c:1418
Code: c3 30 48 89 d8 48 c1 e8 03 42 80 3c 38 00 74 08 48 89 df e8 7e ee 8a ff 4c 89 75 c0 48 8b 1b 48 8d 7b 18 48 89 f8 48 c1 e8 03 <42> 0f b6 04 38 84 c0 0f 85 3f 08 00 00 8b 4b 18 48 89 df 4c 89 ee
RSP: 0018:ffffc90000bb76b8 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000000 RCX: ffffffff821d785e
RDX: ffff88814745cf00 RSI: 0000000000000004 RDI: 0000000000000018
RBP: ffffc90000bb7710 R08: ffffffff821d6fd7 R09: 0000000000000003
R10: fffff52000176ecc R11: dffffc0000000001 R12: 0000000000000000
R13: 0000000000000004 R14: ffff888125c8a000 R15: dffffc0000000000
FS:  0000555559cfe500(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555559d29528 CR3: 000000013944a000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 f2fs_get_node_page+0x21/0x30 fs/f2fs/node.c:1471
 do_read_inode fs/f2fs/inode.c:358 [inline]
 f2fs_iget+0x6d1/0x50a0 fs/f2fs/inode.c:514
 f2fs_lookup+0x446/0xda0 fs/f2fs/namei.c:544
 __lookup_slow+0x2b9/0x400 fs/namei.c:1640
 lookup_slow+0x5a/0x80 fs/namei.c:1657
 walk_component+0x48c/0x610 fs/namei.c:1952
 lookup_last fs/namei.c:2403 [inline]
 path_lookupat+0x16d/0x450 fs/namei.c:2427
 filename_lookup+0x26a/0x6f0 fs/namei.c:2460
 user_path_at_empty+0x40/0x50 fs/namei.c:2740
 user_path_at include/linux/namei.h:60 [inline]
 ksys_umount fs/namespace.c:1761 [inline]
 __do_sys_umount fs/namespace.c:1769 [inline]
 __se_sys_umount fs/namespace.c:1767 [inline]
 __x64_sys_umount+0xf0/0x170 fs/namespace.c:1767
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f69369c6497
Code: a8 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 a8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffdcd23f0b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: ffffffffffffffda RBX: 00007f6936a4608c RCX: 00007f69369c6497
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffdcd23f170
RBP: 00007ffdcd23f170 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffdcd240260
R13: 00007f6936a4608c R14: 0000555559cfe4a8 R15: 00007ffdcd242420
Modules linked in:
---[ end trace 55cca66a55548f45 ]---
RIP: 0010:mapping_gfp_mask include/linux/pagemap.h:106 [inline]
RIP: 0010:grab_cache_page include/linux/pagemap.h:485 [inline]
RIP: 0010:f2fs_grab_cache_page fs/f2fs/f2fs.h:2703 [inline]
RIP: 0010:__get_node_page+0x114/0xb60 fs/f2fs/node.c:1418
Code: c3 30 48 89 d8 48 c1 e8 03 42 80 3c 38 00 74 08 48 89 df e8 7e ee 8a ff 4c 89 75 c0 48 8b 1b 48 8d 7b 18 48 89 f8 48 c1 e8 03 <42> 0f b6 04 38 84 c0 0f 85 3f 08 00 00 8b 4b 18 48 89 df 4c 89 ee
RSP: 0018:ffffc90000bb76b8 EFLAGS: 00010206
RAX: 0000000000000003 RBX: 0000000000000000 RCX: ffffffff821d785e
RDX: ffff88814745cf00 RSI: 0000000000000004 RDI: 0000000000000018
RBP: ffffc90000bb7710 R08: ffffffff821d6fd7 R09: 0000000000000003
R10: fffff52000176ecc R11: dffffc0000000001 R12: 0000000000000000
R13: 0000000000000004 R14: ffff888125c8a000 R15: dffffc0000000000
FS:  0000555559cfe500(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30419ff8 CR3: 000000013944a000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	c3                   	ret
   1:	30 48 89             	xor    %cl,-0x77(%rax)
   4:	d8 48 c1             	fmuls  -0x3f(%rax)
   7:	e8 03 42 80 3c       	call   0x3c80420f
   c:	38 00                	cmp    %al,(%rax)
   e:	74 08                	je     0x18
  10:	48 89 df             	mov    %rbx,%rdi
  13:	e8 7e ee 8a ff       	call   0xff8aee96
  18:	4c 89 75 c0          	mov    %r14,-0x40(%rbp)
  1c:	48 8b 1b             	mov    (%rbx),%rbx
  1f:	48 8d 7b 18          	lea    0x18(%rbx),%rdi
  23:	48 89 f8             	mov    %rdi,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 0f b6 04 38       	movzbl (%rax,%r15,1),%eax <-- trapping instruction
  2f:	84 c0                	test   %al,%al
  31:	0f 85 3f 08 00 00    	jne    0x876
  37:	8b 4b 18             	mov    0x18(%rbx),%ecx
  3a:	48 89 df             	mov    %rbx,%rdi
  3d:	4c 89 ee             	mov    %r13,%rsi

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/02 11:21 android13-5.10-lts 3f5f2283d684 c3901742 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in dentry_revalidate
* Struck through repros no longer work on HEAD.