syzbot


KASAN: use-after-free Read in ocfs2_lock_global_qf

Status: upstream: reported C repro on 2025/01/13 01:08
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+8c201eec36608f8c3e19@syzkaller.appspotmail.com
First crash: 2d11h, last: 1d21h
Bug presence (2)
Date Name Commit Repro Result
2025/01/13 linux-6.1.y (ToT) c63962be84ef C [report] KASAN: use-after-free Read in ocfs2_lock_global_qf
2025/01/13 upstream (ToT) 5bc55a333a2f C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in ocfs2_lock_global_qf origin:lts-only C 4 2d05h 2d11h 0/3 upstream: reported C repro on 2025/01/13 01:15
upstream KASAN: slab-use-after-free Read in ocfs2_lock_global_qf ocfs2 C inconclusive 11 13d 65d 24/28 upstream: reported C repro on 2024/11/11 09:46

Sample crash report:
(syz-executor216,4244,1):ocfs2_block_check_validate:402 ERROR: CRC32 failed: stored: 0xb3775c19, computed 0x2dd1c265. Applying ECC.
(syz-executor216,4244,0):ocfs2_block_check_validate:402 ERROR: CRC32 failed: stored: 0xcfdff595, computed 0xefed4a20. Applying ECC.
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
==================================================================
BUG: KASAN: use-after-free in ocfs2_lock_global_qf+0xb4/0x2a0 fs/ocfs2/quota_global.c:303
Read of size 8 at addr ffff888030c72028 by task syz-executor216/4244

CPU: 1 PID: 4244 Comm: syz-executor216 Not tainted 6.1.124-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:427
 kasan_report+0x136/0x160 mm/kasan/report.c:531
 ocfs2_lock_global_qf+0xb4/0x2a0 fs/ocfs2/quota_global.c:303
 ocfs2_get_next_id+0x24d/0x7a0 fs/ocfs2/quota_global.c:888
 dquot_get_next_dqblk+0x6e/0x3a0 fs/quota/dquot.c:2717
 quota_getnextquota+0x2bc/0x6b0 fs/quota/quota.c:250
 __do_sys_quotactl fs/quota/quota.c:960 [inline]
 __se_sys_quotactl+0x2b1/0x770 fs/quota/quota.c:916
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fd9f11f7839
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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:00007ffdfa66c0f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000b3
RAX: ffffffffffffffda RBX: 00007ffdfa66c2d8 RCX: 00007fd9f11f7839
RDX: 000000000000ee01 RSI: 00000000200080c0 RDI: ffffffff80000901
RBP: 00007fd9f126f610 R08: 0000000020000c40 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffdfa66c2c8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Allocated by task 4244:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:563 [inline]
 ocfs2_local_read_info+0x1ea/0x19e0 fs/ocfs2/quota_local.c:696
 dquot_load_quota_sb+0x754/0xb90 fs/quota/dquot.c:2470
 dquot_load_quota_inode+0x318/0x600 fs/quota/dquot.c:2507
 ocfs2_enable_quotas+0x221/0x440 fs/ocfs2/super.c:926
 ocfs2_fill_super+0x4c6a/0x5720 fs/ocfs2/super.c:1139
 mount_bdev+0x2c9/0x3f0 fs/super.c:1443
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:632
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3056
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3584
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4244:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
 ocfs2_local_free_info+0x813/0x990 fs/ocfs2/quota_local.c:869
 dquot_disable+0x110f/0x1c50 fs/quota/dquot.c:2316
 dquot_suspend include/linux/quotaops.h:85 [inline]
 ocfs2_susp_quotas+0x247/0x340 fs/ocfs2/super.c:892
 ocfs2_remount+0x56e/0xc30 fs/ocfs2/super.c:647
 reconfigure_super+0x43a/0x870 fs/super.c:977
 do_remount fs/namespace.c:2712 [inline]
 path_mount+0xe69/0x1090 fs/namespace.c:3378
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3584
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888030c72000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 40 bytes inside of
 1024-byte region [ffff888030c72000, ffff888030c72400)

The buggy address belongs to the physical page:
page:ffffea0000c31c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x30c70
head:ffffea0000c31c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888017c41dc0
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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3967, tgid 3967 (dhcpcd-run-hook), ts 46889846391, free_ts 46879205515
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5605
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc+0xa1/0x230 mm/slab_common.c:949
 kmalloc include/linux/slab.h:568 [inline]
 load_elf_phdrs fs/binfmt_elf.c:481 [inline]
 load_elf_binary+0x2ec/0x2720 fs/binfmt_elf.c:861
 search_binary_handler fs/exec.c:1741 [inline]
 exec_binprm fs/exec.c:1782 [inline]
 bprm_execve+0x96a/0x18a0 fs/exec.c:1851
 do_execveat_common+0x580/0x720 fs/exec.c:1956
 do_execve fs/exec.c:2030 [inline]
 __do_sys_execve fs/exec.c:2106 [inline]
 __se_sys_execve fs/exec.c:2101 [inline]
 __x64_sys_execve+0x8e/0xa0 fs/exec.c:2101
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3479
 free_slab mm/slub.c:2031 [inline]
 discard_slab mm/slub.c:2037 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2586
 put_cpu_partial+0x17b/0x250 mm/slub.c:2662
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
 getname_flags+0xb8/0x4f0 fs/namei.c:139
 vfs_fstatat fs/stat.c:266 [inline]
 __do_sys_newfstatat fs/stat.c:437 [inline]
 __se_sys_newfstatat fs/stat.c:431 [inline]
 __x64_sys_newfstatat+0x130/0x1e0 fs/stat.c:431
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff888030c71f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888030c71f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888030c72000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff888030c72080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888030c72100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/13 01:30 linux-6.1.y c63962be84ef 6dbc6a9b .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: use-after-free Read in ocfs2_lock_global_qf
2025/01/13 01:09 linux-6.1.y c63962be84ef 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in ocfs2_lock_global_qf
2025/01/13 01:07 linux-6.1.y c63962be84ef 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in ocfs2_lock_global_qf
* Struck through repros no longer work on HEAD.