syzbot


KASAN: slab-use-after-free Read in __dquot_initialize

Status: auto-obsoleted due to no activity on 2023/07/29 07:27
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+e365f9547b2452e771c6@syzkaller.appspotmail.com
First crash: 361d, last: 332d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [fs?] KASAN: slab-use-after-free Read in __dquot_initialize 0 (1) 2023/03/03 05:33

Sample crash report:
ext4 filesystem being mounted at /root/syzkaller-testdir89354433/syzkaller.xLBA5d/1414/file1 supports timestamps until 2038 (0x7fffffff)
==================================================================
BUG: KASAN: slab-use-after-free in __dquot_initialize+0x214/0xe20 fs/quota/dquot.c:1470
Read of size 8 at addr ffff888075681588 by task syz-executor.4/10963

CPU: 1 PID: 10963 Comm: syz-executor.4 Not tainted 6.3.0-rc4-syzkaller-00051-g8bb95a1662f8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:319 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:430
 kasan_report+0x176/0x1b0 mm/kasan/report.c:536
 __dquot_initialize+0x214/0xe20 fs/quota/dquot.c:1470
 reiserfs_setattr+0x33c/0x1140 fs/reiserfs/inode.c:3280
 notify_change+0xc8b/0xf40 fs/attr.c:482
 chown_common+0x500/0x850 fs/open.c:774
 do_fchownat+0x16d/0x240 fs/open.c:805
 __do_sys_fchownat fs/open.c:820 [inline]
 __se_sys_fchownat fs/open.c:817 [inline]
 __x64_sys_fchownat+0xb5/0xd0 fs/open.c:817
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fcaa188c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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:00007fcaa260b168 EFLAGS: 00000246 ORIG_RAX: 0000000000000104
RAX: ffffffffffffffda RBX: 00007fcaa19abf80 RCX: 00007fcaa188c0f9
RDX: 0000000000000000 RSI: 0000000020000240 RDI: ffffffffffffff9c
RBP: 00007fcaa18e7b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe2ca9895f R14: 00007fcaa260b300 R15: 0000000000022000
 </TASK>

Allocated by task 28752:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x66/0x70 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:769
 slab_alloc_node mm/slub.c:3452 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc_lru+0x11f/0x2e0 mm/slub.c:3483
 alloc_inode_sb include/linux/fs.h:2686 [inline]
 reiserfs_alloc_inode+0x2a/0xc0 fs/reiserfs/super.c:642
 alloc_inode fs/inode.c:260 [inline]
 new_inode_pseudo+0x65/0x1d0 fs/inode.c:1019
 new_inode+0x29/0x1d0 fs/inode.c:1047
 reiserfs_mkdir+0x1c0/0x8f0 fs/reiserfs/namei.c:815
 xattr_mkdir fs/reiserfs/xattr.c:76 [inline]
 create_privroot fs/reiserfs/xattr.c:882 [inline]
 reiserfs_xattr_init+0x34c/0x730 fs/reiserfs/xattr.c:1005
 reiserfs_fill_super+0x2207/0x2620 fs/reiserfs/super.c:2175
 mount_bdev+0x271/0x3a0 fs/super.c:1380
 legacy_get_tree+0xef/0x190 fs/fs_context.c:610
 vfs_get_tree+0x8c/0x270 fs/super.c:1510
 do_new_mount+0x28f/0xae0 fs/namespace.c:3042
 do_mount fs/namespace.c:3385 [inline]
 __do_sys_mount fs/namespace.c:3594 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3571
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Last potentially related work creation:
 kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491
 __call_rcu_common kernel/rcu/tree.c:2622 [inline]
 call_rcu+0x167/0xa70 kernel/rcu/tree.c:2736
 reiserfs_new_inode+0x7c1/0x1da0 fs/reiserfs/inode.c:2156
 reiserfs_mkdir+0x5b0/0x8f0 fs/reiserfs/namei.c:845
 xattr_mkdir fs/reiserfs/xattr.c:76 [inline]
 create_privroot fs/reiserfs/xattr.c:882 [inline]
 reiserfs_xattr_init+0x34c/0x730 fs/reiserfs/xattr.c:1005
 reiserfs_fill_super+0x2207/0x2620 fs/reiserfs/super.c:2175
 mount_bdev+0x271/0x3a0 fs/super.c:1380
 legacy_get_tree+0xef/0x190 fs/fs_context.c:610
 vfs_get_tree+0x8c/0x270 fs/super.c:1510
 do_new_mount+0x28f/0xae0 fs/namespace.c:3042
 do_mount fs/namespace.c:3385 [inline]
 __do_sys_mount fs/namespace.c:3594 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3571
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff8880756813e0
 which belongs to the cache reiser_inode_cache of size 1568
The buggy address is located 424 bytes inside of
 freed 1568-byte region [ffff8880756813e0, ffff888075681a00)

The buggy address belongs to the physical page:
page:ffffea0001d5a000 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888075682120 pfn:0x75680
head:ffffea0001d5a000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff888023888f01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff8881457313c0 dead000000000122 0000000000000000
raw: ffff888075682120 000000008013000f 00000001ffffffff ffff888023888f01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 5899, tgid 5891 (syz-executor.5), ts 242900630142, free_ts 242326716531
 prep_new_page mm/page_alloc.c:2553 [inline]
 get_page_from_freelist+0x3246/0x33c0 mm/page_alloc.c:4326
 __alloc_pages+0x255/0x670 mm/page_alloc.c:5592
 alloc_slab_page+0x6a/0x160 mm/slub.c:1851
 allocate_slab mm/slub.c:1998 [inline]
 new_slab+0x84/0x2f0 mm/slub.c:2051
 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3193
 __slab_alloc mm/slub.c:3292 [inline]
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc_lru+0x1b9/0x2e0 mm/slub.c:3483
 alloc_inode_sb include/linux/fs.h:2686 [inline]
 reiserfs_alloc_inode+0x2a/0xc0 fs/reiserfs/super.c:642
 alloc_inode fs/inode.c:260 [inline]
 iget5_locked+0xa0/0x270 fs/inode.c:1242
 reiserfs_fill_super+0x12e4/0x2620 fs/reiserfs/super.c:2053
 mount_bdev+0x271/0x3a0 fs/super.c:1380
 legacy_get_tree+0xef/0x190 fs/fs_context.c:610
 vfs_get_tree+0x8c/0x270 fs/super.c:1510
 do_new_mount+0x28f/0xae0 fs/namespace.c:3042
 do_mount fs/namespace.c:3385 [inline]
 __do_sys_mount fs/namespace.c:3594 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3571
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1454 [inline]
 free_pcp_prepare mm/page_alloc.c:1504 [inline]
 free_unref_page_prepare+0xe2f/0xe70 mm/page_alloc.c:3388
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:3483
 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:769
 slab_alloc_node mm/slub.c:3452 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc+0x11f/0x2e0 mm/slub.c:3476
 kmem_cache_zalloc include/linux/slab.h:710 [inline]
 locks_alloc_lock fs/locks.c:271 [inline]
 flock_lock_inode+0x307/0x19e0 fs/locks.c:1024
 flock_lock_inode_wait fs/locks.c:2010 [inline]
 locks_lock_inode_wait+0x108/0x460 fs/locks.c:2037
 locks_lock_file_wait include/linux/filelock.h:346 [inline]
 __do_sys_flock fs/locks.c:2107 [inline]
 __se_sys_flock+0x500/0x6b0 fs/locks.c:2061
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888075681480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888075681500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888075681580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff888075681600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888075681680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/03/31 07:26 upstream 8bb95a1662f8 f325deb0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in __dquot_initialize
2023/03/02 23:36 upstream 04a357b1f6f0 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in __dquot_initialize
* Struck through repros no longer work on HEAD.