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: 146d, last: 68d

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

CPU: 0 PID: 25004 Comm: syz-executor Tainted: G        W         5.10.237-syzkaller-00309-g7e2543346ff7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 __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
 dentry_revalidate+0x13e/0x350 fs/incfs/vfs.c:1554
 d_revalidate fs/namei.c:780 [inline]
 lookup_fast+0x3f1/0x700 fs/namei.c:1589
 walk_component+0x80/0x460 fs/namei.c:1948
 lookup_last fs/namei.c:2403 [inline]
 path_lookupat+0x180/0x490 fs/namei.c:2427
 filename_lookup+0x1d5/0x600 fs/namei.c:2460
 user_path_at_empty+0x43/0x50 fs/namei.c:2740
 user_path_at include/linux/namei.h:60 [inline]
 vfs_statx+0xff/0x520 fs/stat.c:193
 vfs_fstatat fs/stat.c:215 [inline]
 __do_sys_newfstatat fs/stat.c:383 [inline]
 __se_sys_newfstatat+0xc6/0x340 fs/stat.c:377
 __x64_sys_newfstatat+0x9b/0xb0 fs/stat.c:377
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f766158f17a
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:00007fffb5711888 EFLAGS: 00000286 ORIG_RAX: 0000000000000106
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f766158f17a
RDX: 00007fffb57118b0 RSI: 00007fffb5711940 RDI: 00000000ffffff9c
RBP: 00007fffb5711940 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000286 R12: 00007fffb5712a30
R13: 00007f766161289d R14: 000055556624d4a8 R15: 00007fffb5713b00

Allocated by task 4662:
 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
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2779 [inline]
 f2fs_alloc_inode+0x26/0x410 fs/f2fs/super.c:1373
 alloc_inode fs/inode.c:233 [inline]
 iget_locked+0x146/0x7d0 fs/inode.c:1275
 f2fs_iget+0x55/0x4dc0 fs/f2fs/inode.c:498
 f2fs_fill_super+0x468e/0x6c70 fs/f2fs/super.c:4309
 mount_bdev+0x28b/0x3a0 fs/super.c:1442
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:4548
 legacy_get_tree+0xed/0x190 fs/fs_context.c:593
 vfs_get_tree+0x89/0x260 fs/super.c:1572
 do_new_mount+0x25a/0xa20 fs/namespace.c:2918
 path_mount+0x572/0xc80 fs/namespace.c:3248
 do_mount fs/namespace.c:3261 [inline]
 __do_sys_mount fs/namespace.c:3469 [inline]
 __se_sys_mount+0x318/0x380 fs/namespace.c:3446
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3446
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/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+0x105/0x1040 kernel/rcu/tree.c:3050
 destroy_inode fs/inode.c:288 [inline]
 evict+0x857/0x910 fs/inode.c:629
 dispose_list fs/inode.c:647 [inline]
 evict_inodes+0x5d4/0x640 fs/inode.c:701
 generic_shutdown_super+0x96/0x320 fs/super.c:454
 kill_block_super+0x7f/0xf0 fs/super.c:1469
 kill_f2fs_super+0x2e7/0x390 fs/f2fs/super.c:4580
 deactivate_locked_super+0xa0/0x100 fs/super.c:335
 deactivate_super+0xaf/0xe0 fs/super.c:366
 cleanup_mnt+0x446/0x500 fs/namespace.c:1118
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125
 task_work_run+0x127/0x190 kernel/task_work.c:189
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172
 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

Second to last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/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+0x105/0x1040 kernel/rcu/tree.c:3050
 destroy_inode fs/inode.c:288 [inline]
 evict+0x857/0x910 fs/inode.c:629
 iput_final fs/inode.c:1736 [inline]
 iput+0x638/0x7c0 fs/inode.c:1762
 f2fs_put_super+0x68a/0xc00 fs/f2fs/super.c:1614
 generic_shutdown_super+0x149/0x320 fs/super.c:465
 kill_block_super+0x7f/0xf0 fs/super.c:1469
 kill_f2fs_super+0x2e7/0x390 fs/f2fs/super.c:4580
 deactivate_locked_super+0xa0/0x100 fs/super.c:335
 deactivate_super+0xaf/0xe0 fs/super.c:366
 cleanup_mnt+0x446/0x500 fs/namespace.c:1118
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125
 task_work_run+0x127/0x190 kernel/task_work.c:189
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172
 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

The buggy address belongs to the object at ffff88812b9e99c0
 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 [ffff88812b9e99c0, ffff88812b9e9fb0)
The buggy address belongs to the page:
page:ffffea0004ae7a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88812b9eb9f0 pfn:0x12b9e8
head:ffffea0004ae7a00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000100000001 ffff8881029cd380
raw: ffff88812b9eb9f0 0000000080130002 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 827, ts 82570199000, free_ts 0
 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:5349
 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
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2779 [inline]
 f2fs_alloc_inode+0x26/0x410 fs/f2fs/super.c:1373
 alloc_inode fs/inode.c:233 [inline]
 iget_locked+0x146/0x7d0 fs/inode.c:1275
 f2fs_iget+0x55/0x4dc0 fs/f2fs/inode.c:498
 f2fs_fill_super+0x45ba/0x6c70 fs/f2fs/super.c:4301
 mount_bdev+0x28b/0x3a0 fs/super.c:1442
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:4548
 legacy_get_tree+0xed/0x190 fs/fs_context.c:593
 vfs_get_tree+0x89/0x260 fs/super.c:1572
 do_new_mount+0x25a/0xa20 fs/namespace.c:2918
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88812b9e9f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88812b9e9f80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
>ffff88812b9ea000: fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 00
                               ^
 ffff88812b9ea080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88812b9ea100: 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: 25004 Comm: syz-executor Tainted: G    B   W         5.10.237-syzkaller-00309-g7e2543346ff7 #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+0x123/0xac0 fs/f2fs/node.c:1425
Code: 80 3c 08 00 74 08 4c 89 f7 e8 49 58 96 ff 48 89 5d b8 49 8b 3e 48 8d 47 18 48 89 c1 48 c1 e9 03 49 be 00 00 00 00 00 fc ff df <42> 0f b6 0c 31 84 c9 0f 85 04 08 00 00 8b 4f 18 4c 89 fe ba 07 00
RSP: 0018:ffffc90000d67838 EFLAGS: 00010206
RAX: 0000000000000018 RBX: ffff8881288058b8 RCX: 0000000000000003
RDX: ffff88811576bb40 RSI: 0000000000000003 RDI: 0000000000000000
RBP: ffffc90000d67890 R08: dffffc0000000000 R09: ffffc90000d67a20
R10: fffff520001acf46 R11: 1ffff920001acf44 R12: ffff888128805800
R13: 0000000000000000 R14: dffffc0000000000 R15: 0000000000000003
FS:  000055556624d500(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555566278528 CR3: 00000001041e8000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 f2fs_get_node_page fs/f2fs/node.c:1478 [inline]
 f2fs_get_dnode_of_data+0x244/0x1760 fs/f2fs/node.c:779
 f2fs_get_read_data_page+0x23d/0x790 fs/f2fs/data.c:1221
 f2fs_find_data_page+0x18f/0x3f0 fs/f2fs/data.c:1279
 f2fs_readdir+0x435/0x940 fs/f2fs/dir.c:1153
 iterate_dir+0x260/0x570 fs/readdir.c:-1
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0xe5/0x240 fs/readdir.c:354
 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f76615c32d3
Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 52 3e f8 ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 a8 ff ff ff f7 d8
RSP: 002b:00007fffb5710758 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000555566270520 RCX: 00007f76615c32d3
RDX: 0000000000008000 RSI: 0000555566270520 RDI: 0000000000000006
RBP: 00005555662704f4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffa8
R13: 0000000000000016 R14: 00005555662704f0 R15: 00007fffb5713b00
Modules linked in:
---[ end trace c541a60e937e35d4 ]---
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+0x123/0xac0 fs/f2fs/node.c:1425
Code: 80 3c 08 00 74 08 4c 89 f7 e8 49 58 96 ff 48 89 5d b8 49 8b 3e 48 8d 47 18 48 89 c1 48 c1 e9 03 49 be 00 00 00 00 00 fc ff df <42> 0f b6 0c 31 84 c9 0f 85 04 08 00 00 8b 4f 18 4c 89 fe ba 07 00
RSP: 0018:ffffc90000d67838 EFLAGS: 00010206
RAX: 0000000000000018 RBX: ffff8881288058b8 RCX: 0000000000000003
RDX: ffff88811576bb40 RSI: 0000000000000003 RDI: 0000000000000000
RBP: ffffc90000d67890 R08: dffffc0000000000 R09: ffffc90000d67a20
R10: fffff520001acf46 R11: 1ffff920001acf44 R12: ffff888128805800
R13: 0000000000000000 R14: dffffc0000000000 R15: 0000000000000003
FS:  000055556624d500(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f81ccc5b338 CR3: 00000001041e8000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	80 3c 08 00          	cmpb   $0x0,(%rax,%rcx,1)
   4:	74 08                	je     0xe
   6:	4c 89 f7             	mov    %r14,%rdi
   9:	e8 49 58 96 ff       	call   0xff965857
   e:	48 89 5d b8          	mov    %rbx,-0x48(%rbp)
  12:	49 8b 3e             	mov    (%r14),%rdi
  15:	48 8d 47 18          	lea    0x18(%rdi),%rax
  19:	48 89 c1             	mov    %rax,%rcx
  1c:	48 c1 e9 03          	shr    $0x3,%rcx
  20:	49 be 00 00 00 00 00 	movabs $0xdffffc0000000000,%r14
  27:	fc ff df
* 2a:	42 0f b6 0c 31       	movzbl (%rcx,%r14,1),%ecx <-- trapping instruction
  2f:	84 c9                	test   %cl,%cl
  31:	0f 85 04 08 00 00    	jne    0x83b
  37:	8b 4f 18             	mov    0x18(%rdi),%ecx
  3a:	4c 89 fe             	mov    %r15,%rsi
  3d:	ba                   	.byte 0xba
  3e:	07                   	(bad)

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/19 14:14 android13-5.10-lts 7e2543346ff7 b84f0537 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in dentry_revalidate
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.