[syzbot] [ocfs2?] KASAN: slab-out-of-bounds Read in ocfs2_dx_dir_lookup_rec

12 views
Skip to first unread message

syzbot

unread,
Nov 28, 2024, 4:44:24 AM11/28/24
to jl...@evilplan.org, jose...@linux.alibaba.com, linux-...@vger.kernel.org, ma...@fasheh.com, ocfs2...@lists.linux.dev, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 2f87d0916ce0 Merge tag 'trace-ringbuffer-v6.12-rc3' of git..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14ec545f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=cfbd94c114a3d407
dashboard link: https://syzkaller.appspot.com/bug?extid=20282c1b2184a857ac4c
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-2f87d091.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2704ba6867a8/vmlinux-2f87d091.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9f7121fd532b/bzImage-2f87d091.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+20282c...@syzkaller.appspotmail.com

loop0: detected capacity change from 32768 to 32767
==================================================================
BUG: KASAN: slab-out-of-bounds in ocfs2_dx_dir_lookup_rec+0x206/0x810 fs/ocfs2/dir.c:805
Read of size 4 at addr ffff88801181b2c0 by task syz.0.0/5107

CPU: 0 UID: 0 PID: 5107 Comm: syz.0.0 Not tainted 6.12.0-rc3-syzkaller-00044-g2f87d0916ce0 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
ocfs2_dx_dir_lookup_rec+0x206/0x810 fs/ocfs2/dir.c:805
ocfs2_dx_dir_lookup+0x163/0x930 fs/ocfs2/dir.c:860
ocfs2_dx_dir_search fs/ocfs2/dir.c:920 [inline]
ocfs2_find_entry_dx fs/ocfs2/dir.c:1034 [inline]
ocfs2_find_entry+0x1338/0x2780 fs/ocfs2/dir.c:1070
ocfs2_find_files_on_disk+0xff/0x360 fs/ocfs2/dir.c:1981
ocfs2_lookup_ino_from_name+0xb1/0x1e0 fs/ocfs2/dir.c:2003
ocfs2_lookup+0x292/0xa60 fs/ocfs2/namei.c:122
lookup_open fs/namei.c:3573 [inline]
open_last_lookups fs/namei.c:3694 [inline]
path_openat+0x11a7/0x3590 fs/namei.c:3930
do_filp_open+0x235/0x490 fs/namei.c:3960
do_sys_openat2+0x13e/0x1d0 fs/open.c:1415
do_sys_open fs/open.c:1430 [inline]
__do_sys_openat fs/open.c:1446 [inline]
__se_sys_openat fs/open.c:1441 [inline]
__x64_sys_openat+0x247/0x2a0 fs/open.c:1441
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fefd797dff9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fefd881f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fefd7b36058 RCX: 00007fefd797dff9
RDX: 000000000000275a RSI: 0000000020000280 RDI: ffffffffffffff9c
RBP: 00007fefd79f0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fefd7b36058 R15: 00007ffe17f0ea68
</TASK>

Allocated by task 5105:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:319 [inline]
__kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
kasan_slab_alloc include/linux/kasan.h:247 [inline]
slab_post_alloc_hook mm/slub.c:4085 [inline]
slab_alloc_node mm/slub.c:4134 [inline]
kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4141
getname_flags+0xb7/0x540 fs/namei.c:139
getname fs/namei.c:225 [inline]
__do_sys_symlinkat fs/namei.c:4657 [inline]
__se_sys_symlinkat fs/namei.c:4654 [inline]
__x64_sys_symlinkat+0x87/0xb0 fs/namei.c:4654
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5105:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:2342 [inline]
slab_free mm/slub.c:4579 [inline]
kmem_cache_free+0x1a2/0x420 mm/slub.c:4681
do_symlinkat+0x34c/0x3a0 fs/namei.c:4649
__do_sys_symlinkat fs/namei.c:4657 [inline]
__se_sys_symlinkat fs/namei.c:4654 [inline]
__x64_sys_symlinkat+0x95/0xb0 fs/namei.c:4654
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88801181a200
which belongs to the cache names_cache of size 4096
The buggy address is located 192 bytes to the right of
allocated 4096-byte region [ffff88801181a200, ffff88801181b200)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11818
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff888030407780 ffffea000046a400 dead000000000002
raw: 0000000000000000 0000000000070007 00000001f5000000 0000000000000000
head: 00fff00000000040 ffff888030407780 ffffea000046a400 dead000000000002
head: 0000000000000000 0000000000070007 00000001f5000000 0000000000000000
head: 00fff00000000003 ffffea0000460601 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 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 5023, tgid 5023 (rm), ts 59547676990, free_ts 44085069973
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537
prep_new_page mm/page_alloc.c:1545 [inline]
get_page_from_freelist+0x3045/0x3190 mm/page_alloc.c:3457
__alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4733
alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
alloc_slab_page+0x6a/0x120 mm/slub.c:2412
allocate_slab+0x5a/0x2f0 mm/slub.c:2578
new_slab mm/slub.c:2631 [inline]
___slab_alloc+0xcd1/0x14b0 mm/slub.c:3818
__slab_alloc+0x58/0xa0 mm/slub.c:3908
__slab_alloc_node mm/slub.c:3961 [inline]
slab_alloc_node mm/slub.c:4122 [inline]
kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4141
getname_flags+0xb7/0x540 fs/namei.c:139
user_path_at+0x24/0x60 fs/namei.c:3015
user_statfs+0xd6/0x460 fs/statfs.c:103
__do_sys_statfs fs/statfs.c:195 [inline]
__se_sys_statfs fs/statfs.c:192 [inline]
__x64_sys_statfs+0xe8/0x1a0 fs/statfs.c:192
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 4795 tgid 4795 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1108 [inline]
free_unref_page+0xcfb/0xf20 mm/page_alloc.c:2638
__slab_free+0x31b/0x3d0 mm/slub.c:4490
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329
kasan_slab_alloc include/linux/kasan.h:247 [inline]
slab_post_alloc_hook mm/slub.c:4085 [inline]
slab_alloc_node mm/slub.c:4134 [inline]
__do_kmalloc_node mm/slub.c:4263 [inline]
__kmalloc_noprof+0x1a6/0x400 mm/slub.c:4276
kmalloc_noprof include/linux/slab.h:882 [inline]
tomoyo_add_entry security/tomoyo/common.c:2023 [inline]
tomoyo_supervisor+0xe0d/0x11f0 security/tomoyo/common.c:2095
tomoyo_audit_path_log security/tomoyo/file.c:168 [inline]
tomoyo_path_permission+0x243/0x360 security/tomoyo/file.c:587
tomoyo_check_open_permission+0x2fb/0x500 security/tomoyo/file.c:777
security_bprm_check+0x86/0x250 security/security.c:1297
search_binary_handler fs/exec.c:1740 [inline]
exec_binprm fs/exec.c:1794 [inline]
bprm_execve+0xa56/0x1770 fs/exec.c:1845
do_execveat_common+0x55f/0x6f0 fs/exec.c:1952
do_execve fs/exec.c:2026 [inline]
__do_sys_execve fs/exec.c:2102 [inline]
__se_sys_execve fs/exec.c:2097 [inline]
__x64_sys_execve+0x92/0xb0 fs/exec.c:2097
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
ffff88801181b180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801181b200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801181b280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88801181b300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801181b380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Mar 9, 2025, 7:40:27 AM3/9/25
to jl...@evilplan.org, jose...@linux.alibaba.com, linux-...@vger.kernel.org, ma...@fasheh.com, ocfs2...@lists.linux.dev, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: b7c90e3e717a Merge tag 'x86-urgent-2025-03-08' of git://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14f8fa54580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2040405600e83619
dashboard link: https://syzkaller.appspot.com/bug?extid=20282c1b2184a857ac4c
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17c58664580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17b1d878580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-b7c90e3e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b1f83f46f4b5/vmlinux-b7c90e3e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7d502ab93205/bzImage-b7c90e3e.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/e57bf738b48c/mount_7.gz
fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=171a1fa0580000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+20282c...@syzkaller.appspotmail.com

On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
OCFS2: File system is now read-only.
(syz-executor398,5304,0):ocfs2_find_entry_dx:1029 ERROR: status = -30
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 0 UID: 0 PID: 5304 Comm: syz-executor398 Not tainted 6.14.0-rc5-syzkaller-00234-gb7c90e3e717a #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:ocfs2_dx_dir_lookup_rec+0x325/0x810 fs/ocfs2/dir.c:812
Code: 20 48 83 c3 40 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 4a 4b 6f fe 48 8b 03 48 89 44 24 30 4c 89 e0 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 c0 03 00 00 45 8b 3c 24 4c 89 f0 48 c1
RSP: 0018:ffffc9000d14eb40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff8880447788b8 RCX: ffff8880006f2440
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8880447788a0
RBP: ffffc9000d14ec50 R08: ffffffff83b9ce2e R09: ffffc9000d14ece0
R10: 23ec6d672c196c9a R11: 608b7c562adf3b03 R12: 0000000000000000
R13: dffffc0000000000 R14: ffff8880491092c0 R15: ffff8880491092c0
FS: 000055556a600380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055721be84000 CR3: 000000003ef6e000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
ocfs2_dx_dir_lookup+0x163/0x930 fs/ocfs2/dir.c:860
ocfs2_dx_dir_search fs/ocfs2/dir.c:920 [inline]
ocfs2_find_entry_dx fs/ocfs2/dir.c:1034 [inline]
ocfs2_find_entry+0x1309/0x2570 fs/ocfs2/dir.c:1071
ocfs2_check_dir_for_entry+0x17b/0x4a0 fs/ocfs2/dir.c:2040
ocfs2_mknod+0x83c/0x2b30 fs/ocfs2/namei.c:288
ocfs2_create+0x1ab/0x470 fs/ocfs2/namei.c:673
lookup_open fs/namei.c:3651 [inline]
open_last_lookups fs/namei.c:3750 [inline]
path_openat+0x193c/0x3590 fs/namei.c:3986
do_filp_open+0x27f/0x4e0 fs/namei.c:4016
do_sys_openat2+0x13e/0x1d0 fs/open.c:1428
do_sys_open fs/open.c:1443 [inline]
__do_sys_openat fs/open.c:1459 [inline]
__se_sys_openat fs/open.c:1454 [inline]
__x64_sys_openat+0x247/0x2a0 fs/open.c:1454
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f4c42698bf9
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:00007ffef4145088 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f4c426649e3 RCX: 00007f4c42698bf9
RDX: 0000000000105042 RSI: 0000400000000080 RDI: 00000000ffffff9c
RBP: 0000400000000040 R08: 00000000000b45f8 R09: 00000000000b45f8
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffef4145258 R14: 0000000000000001 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:ocfs2_dx_dir_lookup_rec+0x325/0x810 fs/ocfs2/dir.c:812
Code: 20 48 83 c3 40 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 4a 4b 6f fe 48 8b 03 48 89 44 24 30 4c 89 e0 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 c0 03 00 00 45 8b 3c 24 4c 89 f0 48 c1
RSP: 0018:ffffc9000d14eb40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff8880447788b8 RCX: ffff8880006f2440
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8880447788a0
RBP: ffffc9000d14ec50 R08: ffffffff83b9ce2e R09: ffffc9000d14ece0
R10: 23ec6d672c196c9a R11: 608b7c562adf3b03 R12: 0000000000000000
R13: dffffc0000000000 R14: ffff8880491092c0 R15: ffff8880491092c0
FS: 000055556a600380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055721bea2000 CR3: 000000003ef6e000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 20 48 83 and %cl,-0x7d(%rax)
3: c3 ret
4: 40 rex
5: 48 89 d8 mov %rbx,%rax
8: 48 c1 e8 03 shr $0x3,%rax
c: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1)
11: 74 08 je 0x1b
13: 48 89 df mov %rbx,%rdi
16: e8 4a 4b 6f fe call 0xfe6f4b65
1b: 48 8b 03 mov (%rbx),%rax
1e: 48 89 44 24 30 mov %rax,0x30(%rsp)
23: 4c 89 e0 mov %r12,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax <-- trapping instruction
2f: 84 c0 test %al,%al
31: 0f 85 c0 03 00 00 jne 0x3f7
37: 45 8b 3c 24 mov (%r12),%r15d
3b: 4c 89 f0 mov %r14,%rax
3e: 48 rex.W
3f: c1 .byte 0xc1


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages