syzbot


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

Status: auto-closed as invalid on 2021/10/12 21:28
Reported-by: syzbot+2cc8170bf3401fadbbfd@syzkaller.appspotmail.com
First crash: 799d, last: 591d
similar bugs (5):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: use-after-free Read in iput 1 1450d 1383d 0/3 auto-closed as invalid on 2019/08/05 02:50
upstream KASAN: use-after-free Read in iput C 2 1745d 1744d 9/24 fixed on 2018/07/08 03:16
android-5-10 BUG: Dentry still in use in unmount C done 1184 337d 349d 2/2 fixed on 2022/02/25 03:20
android-54 BUG: Dentry still in use [unmount of ramfs ramfs] C 476 356d 678d 0/2 upstream: reported C repro on 2021/03/19 07:18
upstream KASAN: stack-out-of-bounds Read in iput C unreliable 10 5d10h 128d 0/24 upstream: reported C repro on 2022/09/20 10:35

Sample crash report:
gfs2: fsid=syz:syz.0: can't lock local "sc" file: -5
==================================================================
BUG: KASAN: use-after-free in iput+0x6b/0x70 fs/inode.c:1676
Read of size 8 at addr ffff88808bee80d8 by task syz-executor.3/13570

CPU: 0 PID: 13570 Comm: syz-executor.3 Not tainted 5.13.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
 iput+0x6b/0x70 fs/inode.c:1676
 init_statfs fs/gfs2/ops_fstype.c:701 [inline]
 init_journal fs/gfs2/ops_fstype.c:805 [inline]
 init_inodes+0x20e6/0x2610 fs/gfs2/ops_fstype.c:874
 gfs2_fill_super+0x1b4a/0x2680 fs/gfs2/ops_fstype.c:1204
 get_tree_bdev+0x440/0x760 fs/super.c:1293
 gfs2_get_tree+0x4a/0x270 fs/gfs2/ops_fstype.c:1273
 vfs_get_tree+0x89/0x2f0 fs/super.c:1498
 do_new_mount fs/namespace.c:2905 [inline]
 path_mount+0x132a/0x1fa0 fs/namespace.c:3235
 do_mount fs/namespace.c:3248 [inline]
 __do_sys_mount fs/namespace.c:3456 [inline]
 __se_sys_mount fs/namespace.c:3433 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3433
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x467afa
Code: 48 c7 c2 bc ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffae7922fa8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 0000000000467afa
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffae7923000
RBP: 00007ffae7923040 R08: 00007ffae7923040 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 00007ffae7923000 R15: 0000000020047a20

Allocated by task 13570:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:428 [inline]
 __kasan_slab_alloc+0x84/0xa0 mm/kasan/common.c:461
 kasan_slab_alloc include/linux/kasan.h:236 [inline]
 slab_post_alloc_hook mm/slab.h:524 [inline]
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2921 [inline]
 kmem_cache_alloc+0x152/0x3a0 mm/slub.c:2926
 gfs2_alloc_inode+0x38/0x1a0 fs/gfs2/super.c:1499
 alloc_inode+0x61/0x230 fs/inode.c:233
 iget5_locked fs/inode.c:1154 [inline]
 iget5_locked+0x1e7/0x2e0 fs/inode.c:1147
 gfs2_iget fs/gfs2/inode.c:64 [inline]
 gfs2_inode_lookup+0x104/0xb10 fs/gfs2/inode.c:140
 gfs2_dir_search+0x20f/0x2c0 fs/gfs2/dir.c:1665
 gfs2_lookupi+0x475/0x640 fs/gfs2/inode.c:332
 gfs2_lookup_simple+0x99/0xe0 fs/gfs2/inode.c:273
 init_statfs fs/gfs2/ops_fstype.c:658 [inline]
 init_journal fs/gfs2/ops_fstype.c:805 [inline]
 init_inodes+0x16a0/0x2610 fs/gfs2/ops_fstype.c:874
 gfs2_fill_super+0x1b4a/0x2680 fs/gfs2/ops_fstype.c:1204
 get_tree_bdev+0x440/0x760 fs/super.c:1293
 gfs2_get_tree+0x4a/0x270 fs/gfs2/ops_fstype.c:1273
 vfs_get_tree+0x89/0x2f0 fs/super.c:1498
 do_new_mount fs/namespace.c:2905 [inline]
 path_mount+0x132a/0x1fa0 fs/namespace.c:3235
 do_mount fs/namespace.c:3248 [inline]
 __do_sys_mount fs/namespace.c:3456 [inline]
 __se_sys_mount fs/namespace.c:3433 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3433
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 19:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
 ____kasan_slab_free mm/kasan/common.c:360 [inline]
 ____kasan_slab_free mm/kasan/common.c:325 [inline]
 __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368
 kasan_slab_free include/linux/kasan.h:212 [inline]
 slab_free_hook mm/slub.c:1582 [inline]
 slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1607
 slab_free mm/slub.c:3167 [inline]
 kmem_cache_free+0x8a/0x740 mm/slub.c:3183
 i_callback+0x3f/0x70 fs/inode.c:222
 rcu_do_batch kernel/rcu/tree.c:2558 [inline]
 rcu_core+0x7ab/0x13b0 kernel/rcu/tree.c:2793
 __do_softirq+0x29b/0x9f6 kernel/softirq.c:559

Last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:345
 __call_rcu kernel/rcu/tree.c:3038 [inline]
 call_rcu+0xb1/0x750 kernel/rcu/tree.c:3113
 destroy_inode+0x129/0x1b0 fs/inode.c:288
 iput_final fs/inode.c:1660 [inline]
 iput.part.0+0x57e/0x810 fs/inode.c:1686
 iput+0x58/0x70 fs/inode.c:1676
 init_statfs fs/gfs2/ops_fstype.c:689 [inline]
 init_journal fs/gfs2/ops_fstype.c:805 [inline]
 init_inodes+0x19aa/0x2610 fs/gfs2/ops_fstype.c:874
 gfs2_fill_super+0x1b4a/0x2680 fs/gfs2/ops_fstype.c:1204
 get_tree_bdev+0x440/0x760 fs/super.c:1293
 gfs2_get_tree+0x4a/0x270 fs/gfs2/ops_fstype.c:1273
 vfs_get_tree+0x89/0x2f0 fs/super.c:1498
 do_new_mount fs/namespace.c:2905 [inline]
 path_mount+0x132a/0x1fa0 fs/namespace.c:3235
 do_mount fs/namespace.c:3248 [inline]
 __do_sys_mount fs/namespace.c:3456 [inline]
 __se_sys_mount fs/namespace.c:3433 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3433
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Second to last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:345
 __call_rcu kernel/rcu/tree.c:3038 [inline]
 call_rcu+0xb1/0x750 kernel/rcu/tree.c:3113
 destroy_inode+0x129/0x1b0 fs/inode.c:288
 iput_final fs/inode.c:1660 [inline]
 iput.part.0+0x57e/0x810 fs/inode.c:1686
 iput+0x58/0x70 fs/inode.c:1676
 init_statfs fs/gfs2/ops_fstype.c:689 [inline]
 init_journal fs/gfs2/ops_fstype.c:805 [inline]
 init_inodes+0x19aa/0x2610 fs/gfs2/ops_fstype.c:874
 gfs2_fill_super+0x1b4a/0x2680 fs/gfs2/ops_fstype.c:1204
 get_tree_bdev+0x440/0x760 fs/super.c:1293
 gfs2_get_tree+0x4a/0x270 fs/gfs2/ops_fstype.c:1273
 vfs_get_tree+0x89/0x2f0 fs/super.c:1498
 do_new_mount fs/namespace.c:2905 [inline]
 path_mount+0x132a/0x1fa0 fs/namespace.c:3235
 do_mount fs/namespace.c:3248 [inline]
 __do_sys_mount fs/namespace.c:3456 [inline]
 __se_sys_mount fs/namespace.c:3433 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3433
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88808bee8000
 which belongs to the cache gfs2_inode of size 1512
The buggy address is located 216 bytes inside of
 1512-byte region [ffff88808bee8000, ffff88808bee85e8)
The buggy address belongs to the page:
page:ffffea00022fba00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8bee8
head:ffffea00022fba00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00022f6a00 0000000300000003 ffff8881403c8500
raw: 0000000000000000 0000000080130013 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 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 8143, ts 1756543314506, free_ts 1709211703634
 prep_new_page mm/page_alloc.c:2358 [inline]
 get_page_from_freelist+0x1033/0x2b60 mm/page_alloc.c:3994
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5200
 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272
 alloc_slab_page mm/slub.c:1645 [inline]
 allocate_slab+0x2c5/0x4c0 mm/slub.c:1785
 new_slab mm/slub.c:1848 [inline]
 new_slab_objects mm/slub.c:2594 [inline]
 ___slab_alloc+0x4a1/0x810 mm/slub.c:2757
 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2797
 slab_alloc_node mm/slub.c:2879 [inline]
 slab_alloc mm/slub.c:2921 [inline]
 kmem_cache_alloc+0x34b/0x3a0 mm/slub.c:2926
 gfs2_alloc_inode+0x38/0x1a0 fs/gfs2/super.c:1499
 alloc_inode+0x61/0x230 fs/inode.c:233
 iget5_locked fs/inode.c:1154 [inline]
 iget5_locked+0x1e7/0x2e0 fs/inode.c:1147
 gfs2_iget fs/gfs2/inode.c:64 [inline]
 gfs2_inode_lookup+0x104/0xb10 fs/gfs2/inode.c:140
 gfs2_dir_search+0x20f/0x2c0 fs/gfs2/dir.c:1665
 gfs2_lookupi+0x475/0x640 fs/gfs2/inode.c:332
 gfs2_lookup_simple+0x99/0xe0 fs/gfs2/inode.c:273
 init_statfs fs/gfs2/ops_fstype.c:658 [inline]
 init_journal fs/gfs2/ops_fstype.c:805 [inline]
 init_inodes+0x16a0/0x2610 fs/gfs2/ops_fstype.c:874
 gfs2_fill_super+0x1b4a/0x2680 fs/gfs2/ops_fstype.c:1204
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1298 [inline]
 __free_pages_ok+0x476/0xce0 mm/page_alloc.c:1572
 qlink_free mm/kasan/quarantine.c:146 [inline]
 qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
 __kasan_slab_alloc+0x8e/0xa0 mm/kasan/common.c:438
 kasan_slab_alloc include/linux/kasan.h:236 [inline]
 slab_post_alloc_hook mm/slab.h:524 [inline]
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2921 [inline]
 kmem_cache_alloc+0x219/0x3a0 mm/slub.c:2926
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
 getname_flags include/linux/audit.h:319 [inline]
 getname+0x8e/0xd0 fs/namei.c:209
 do_sys_openat2+0xf5/0x420 fs/open.c:1181
 do_sys_open fs/open.c:1203 [inline]
 __do_sys_open fs/open.c:1211 [inline]
 __se_sys_open fs/open.c:1207 [inline]
 __x64_sys_open+0x119/0x1c0 fs/open.c:1207
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff88808bee7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88808bee8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808bee8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff88808bee8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808bee8180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2021/06/14 21:27 upstream 009c9aa5be65 1ba81399 .config console log report info KASAN: use-after-free Read in iput
ci-upstream-kasan-gce-root 2021/05/14 14:52 upstream 315d99318179 8bdd5343 .config console log report info KASAN: use-after-free Read in iput
ci-upstream-kasan-gce-root 2021/05/01 07:16 upstream d2b6f8a17919 77e2b668 .config console log report info KASAN: use-after-free Read in iput
ci-upstream-kasan-gce-root 2021/04/17 14:48 upstream 9cdbf6467424 7e2b734b .config console log report info KASAN: use-after-free Read in iput
ci-upstream-kasan-gce-root 2021/01/16 23:32 upstream 1d94330a437a 65a7a854 .config console log report info
ci-upstream-linux-next-kasan-gce-root 2020/11/18 19:26 linux-next 205292332779 09323409 .config console log report info
* Struck through repros no longer work on HEAD.