syzbot


KASAN: use-after-free Read in ocfs2_get_next_id

Status: upstream: reported C repro on 2025/01/12 23:53
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+7bbc287dbb8308afda1e@syzkaller.appspotmail.com
First crash: 2d08h, last: 1d23h
Bug presence (2)
Date Name Commit Repro Result
2025/01/13 linux-5.15.y (ToT) 4735586da88e C [report] KASAN: use-after-free Read in ocfs2_get_next_id
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-6.1 KASAN: use-after-free Read in ocfs2_get_next_id origin:lts-only C 4 1d12h 2d08h 0/3 upstream: reported C repro on 2025/01/12 23:44
upstream KASAN: slab-use-after-free Read in ocfs2_get_next_id ocfs2 C 4 10d 6d10h 0/28 upstream: reported C repro on 2025/01/08 21:46

Sample crash report:
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 fs/ocfs2/quota_global.c:303 [inline]
BUG: KASAN: use-after-free in ocfs2_get_next_id+0x22c/0x8ac fs/ocfs2/quota_global.c:888
Read of size 8 at addr ffff0000caf40028 by task syz-executor291/4023

CPU: 1 PID: 4023 Comm: syz-executor291 Not tainted 5.15.176-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
 ocfs2_lock_global_qf fs/ocfs2/quota_global.c:303 [inline]
 ocfs2_get_next_id+0x22c/0x8ac fs/ocfs2/quota_global.c:888
 dquot_get_next_dqblk+0x7c/0x348 fs/quota/dquot.c:2710
 quota_getnextquota+0x264/0x674 fs/quota/quota.c:249
 do_quotactl+0x52c/0x698 fs/quota/quota.c:799
 __do_sys_quotactl fs/quota/quota.c:959 [inline]
 __se_sys_quotactl fs/quota/quota.c:915 [inline]
 __arm64_sys_quotactl+0x2d8/0x7a4 fs/quota/quota.c:915
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 4023:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 ocfs2_local_read_info+0x1b8/0x15bc fs/ocfs2/quota_local.c:696
 dquot_load_quota_sb+0x6f0/0xb1c fs/quota/dquot.c:2463
 dquot_load_quota_inode+0x280/0x4f4 fs/quota/dquot.c:2500
 ocfs2_enable_quotas+0x1d4/0x3cc fs/ocfs2/super.c:927
 ocfs2_fill_super+0x37bc/0x4abc fs/ocfs2/super.c:1140
 mount_bdev+0x274/0x370 fs/super.c:1400
 ocfs2_mount+0x44/0x58 fs/ocfs2/super.c:1187
 legacy_get_tree+0xd4/0x16c fs/fs_context.c:611
 vfs_get_tree+0x90/0x274 fs/super.c:1530
 do_new_mount+0x278/0x8fc fs/namespace.c:3012
 path_mount+0x594/0x101c fs/namespace.c:3342
 do_mount fs/namespace.c:3355 [inline]
 __do_sys_mount fs/namespace.c:3563 [inline]
 __se_sys_mount fs/namespace.c:3540 [inline]
 __arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3540
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 4023:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0x178/0x410 mm/slub.c:4559
 ocfs2_local_free_info+0x720/0x8a4 fs/ocfs2/quota_local.c:869
 dquot_disable+0xefc/0x1800 fs/quota/dquot.c:2309
 dquot_suspend include/linux/quotaops.h:84 [inline]
 ocfs2_susp_quotas+0x1f0/0x2d4 fs/ocfs2/super.c:893
 ocfs2_remount+0x464/0x9cc fs/ocfs2/super.c:648
 legacy_reconfigure+0xfc/0x114 fs/fs_context.c:634
 reconfigure_super+0x1d0/0x6ec fs/super.c:938
 do_remount fs/namespace.c:2668 [inline]
 path_mount+0xbec/0x101c fs/namespace.c:3334
 do_mount fs/namespace.c:3355 [inline]
 __do_sys_mount fs/namespace.c:3563 [inline]
 __se_sys_mount fs/namespace.c:3540 [inline]
 __arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3540
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000caf40000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 40 bytes inside of
 1024-byte region [ffff0000caf40000, ffff0000caf40400)
The buggy address belongs to the page:
page:000000004fc827b8 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10af40
head:000000004fc827b8 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000122 ffff0000c0002780
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000caf3ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000caf3ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000caf40000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff0000caf40080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000caf40100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/13 03:59 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
2025/01/13 00:11 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
2025/01/12 23:55 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
2025/01/12 23:53 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
* Struck through repros no longer work on HEAD.