syzbot


KASAN: use-after-free Read in ocfs2_get_next_id

Status: upstream: reported C repro on 2025/01/12 23:44
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+a14aec508f735d7e36eb@syzkaller.appspotmail.com
First crash: 2d12h, last: 1d16h
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_get_next_id
2025/01/13 upstream (ToT) c45323b7560e 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_get_next_id origin:lts-only C 4 2d02h 2d12h 0/3 upstream: reported C repro on 2025/01/12 23:53
upstream KASAN: slab-use-after-free Read in ocfs2_get_next_id ocfs2 C 4 10d 6d14h 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+0x250/0x944 fs/ocfs2/quota_global.c:888
Read of size 8 at addr ffff0000c4f51028 by task syz-executor296/4292

CPU: 0 PID: 4292 Comm: syz-executor296 Not tainted 6.1.124-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:427
 kasan_report+0xd4/0x130 mm/kasan/report.c:531
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 ocfs2_lock_global_qf fs/ocfs2/quota_global.c:303 [inline]
 ocfs2_get_next_id+0x250/0x944 fs/ocfs2/quota_global.c:888
 dquot_get_next_dqblk+0x7c/0x348 fs/quota/dquot.c:2717
 quota_getnextquota+0x264/0x650 fs/quota/quota.c:250
 do_quotactl+0x52c/0x698 fs/quota/quota.c:800
 __do_sys_quotactl fs/quota/quota.c:960 [inline]
 __se_sys_quotactl fs/quota/quota.c:916 [inline]
 __arm64_sys_quotactl+0x2d8/0x7a0 fs/quota/quota.c:916
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Allocated by task 4292:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x7c/0x94 mm/slab_common.c:1031
 kmalloc include/linux/slab.h:563 [inline]
 ocfs2_local_read_info+0x1b8/0x15bc fs/ocfs2/quota_local.c:696
 dquot_load_quota_sb+0x6f0/0xb1c fs/quota/dquot.c:2470
 dquot_load_quota_inode+0x280/0x4f4 fs/quota/dquot.c:2507
 ocfs2_enable_quotas+0x1d4/0x3cc fs/ocfs2/super.c:926
 ocfs2_fill_super+0x3aa4/0x48c4 fs/ocfs2/super.c:1139
 mount_bdev+0x274/0x370 fs/super.c:1443
 ocfs2_mount+0x44/0x58 fs/ocfs2/super.c:1186
 legacy_get_tree+0xd4/0x16c fs/fs_context.c:632
 vfs_get_tree+0x90/0x274 fs/super.c:1573
 do_new_mount+0x278/0x8fc fs/namespace.c:3056
 path_mount+0x590/0xe5c fs/namespace.c:3386
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount fs/namespace.c:3584 [inline]
 __arm64_sys_mount+0x45c/0x594 fs/namespace.c:3584
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 4292:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 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+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:988
 ocfs2_local_free_info+0x720/0x8a4 fs/ocfs2/quota_local.c:869
 dquot_disable+0xebc/0x17c0 fs/quota/dquot.c:2316
 dquot_suspend include/linux/quotaops.h:85 [inline]
 ocfs2_susp_quotas+0x1f0/0x2d4 fs/ocfs2/super.c:892
 ocfs2_remount+0x464/0x9cc fs/ocfs2/super.c:647
 legacy_reconfigure+0xfc/0x114 fs/fs_context.c:655
 reconfigure_super+0x318/0x7a4 fs/super.c:977
 do_remount fs/namespace.c:2712 [inline]
 path_mount+0xc70/0xe5c fs/namespace.c:3378
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount fs/namespace.c:3584 [inline]
 __arm64_sys_mount+0x45c/0x594 fs/namespace.c:3584
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

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

The buggy address belongs to the physical page:
page:000000009369a4a1 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104f50
head:000000009369a4a1 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 dead000000000100 dead000000000122 ffff0000c0002780
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000c4f50f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000c4f50f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000c4f51000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff0000c4f51080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c4f51100: 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 02:59 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-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
2025/01/13 00:05 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-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
2025/01/12 23:43 linux-6.1.y c63962be84ef 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
2025/01/12 23:43 linux-6.1.y c63962be84ef 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ocfs2_get_next_id
* Struck through repros no longer work on HEAD.