[v5.15] KASAN: use-after-free Read in search_by_entry_key

0 views
Skip to first unread message

syzbot

unread,
Apr 8, 2023, 5:36:45 AM4/8/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d86dfc4d95cd Linux 5.15.106
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=171dce53c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=639d55ab480652c5
dashboard link: https://syzkaller.appspot.com/bug?extid=6c3babb20f9e8bcadd25
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b2a94107dd69/disk-d86dfc4d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/398f8d288cb9/vmlinux-d86dfc4d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9b790c7e7c8c/Image-d86dfc4d.gz.xz

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

REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
==================================================================
BUG: KASAN: use-after-free in bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
BUG: KASAN: use-after-free in search_by_entry_key+0x45c/0xe88 fs/reiserfs/namei.c:165
Read of size 4 at addr ffff00010c2b0fc4 by task syz-executor.0/17512

CPU: 1 PID: 17512 Comm: syz-executor.0 Not tainted 5.15.106-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
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_load_n_noabort+0x40/0x4c mm/kasan/report_generic.c:319
bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
search_by_entry_key+0x45c/0xe88 fs/reiserfs/namei.c:165
reiserfs_find_entry+0x2a8/0x1624 fs/reiserfs/namei.c:322
reiserfs_lookup+0x184/0x3c4 fs/reiserfs/namei.c:368
__lookup_slow+0x250/0x388 fs/namei.c:1659
lookup_one_len+0x178/0x28c fs/namei.c:2688
reiserfs_lookup_privroot+0x8c/0x204 fs/reiserfs/xattr.c:980
reiserfs_fill_super+0x1aec/0x1e8c fs/reiserfs/super.c:2178
mount_bdev+0x26c/0x368 fs/super.c:1378
get_super_block+0x44/0x58 fs/reiserfs/super.c:2608
legacy_get_tree+0xd4/0x16c fs/fs_context.c:610
vfs_get_tree+0x90/0x274 fs/super.c:1508
do_new_mount+0x25c/0x8c8 fs/namespace.c:2994
path_mount+0x590/0x104c fs/namespace.c:3324
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount fs/namespace.c:3522 [inline]
__arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
__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:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the page:
page:000000006bda214a refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x14c2b0
flags: 0x5ffc00000000000(node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000000 fffffc00042cef88 fffffc0004dbc808 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff00010c2b0e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff00010c2b0f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff00010c2b0f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff00010c2b1000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff00010c2b1080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
REISERFS warning (device loop0): jdm-13090 reiserfs_new_inode: ACLs aren't enabled in the fs, but vfs thinks they are!
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.


---
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.

syzbot

unread,
May 14, 2023, 12:47:47 PM5/14/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: b0ece631f84a Linux 5.15.111
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=129cb492280000
kernel config: https://syzkaller.appspot.com/x/.config?x=db3750b003ff805e
dashboard link: https://syzkaller.appspot.com/bug?extid=6c3babb20f9e8bcadd25
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17c8b0ba280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14bcf4ba280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/eded75b6c3f9/disk-b0ece631.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/20e5ae802010/vmlinux-b0ece631.xz
kernel image: https://storage.googleapis.com/syzbot-assets/05d665c869f3/Image-b0ece631.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/c4b23176d0ff/mount_0.gz

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

REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
==================================================================
BUG: KASAN: use-after-free in bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
BUG: KASAN: use-after-free in search_by_entry_key+0x45c/0xe88 fs/reiserfs/namei.c:165
Read of size 4 at addr ffff0000ddad7004 by task syz-executor898/3963

CPU: 1 PID: 3963 Comm: syz-executor898 Not tainted 5.15.111-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
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_load_n_noabort+0x40/0x4c mm/kasan/report_generic.c:319
bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
search_by_entry_key+0x45c/0xe88 fs/reiserfs/namei.c:165
reiserfs_find_entry+0xdbc/0x1624 fs/reiserfs/namei.c:322
reiserfs_lookup+0x184/0x3c4 fs/reiserfs/namei.c:368
__lookup_slow+0x250/0x388 fs/namei.c:1659
lookup_one_len+0x178/0x28c fs/namei.c:2688
reiserfs_lookup_privroot+0x8c/0x204 fs/reiserfs/xattr.c:980
reiserfs_fill_super+0x1494/0x1e8c fs/reiserfs/super.c:2196
mount_bdev+0x26c/0x368 fs/super.c:1378
get_super_block+0x44/0x58 fs/reiserfs/super.c:2608
legacy_get_tree+0xd4/0x16c fs/fs_context.c:610
vfs_get_tree+0x90/0x274 fs/super.c:1508
do_new_mount+0x25c/0x8c8 fs/namespace.c:2994
path_mount+0x590/0x104c fs/namespace.c:3324
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount fs/namespace.c:3522 [inline]
__arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
__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:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the page:
page:000000004299556a refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x11dad7
flags: 0x5ffc00000000000(node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000000 fffffc000376b608 ffff0001b4836860 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000ddad6f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff0000ddad6f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff0000ddad7000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff0000ddad7080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff0000ddad7100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
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