[Android 6.1] KASAN: use-after-free Read in pick_link

0 views
Skip to first unread message

syzbot

unread,
3:05 AM (7 hours ago) 3:05 AM
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 8494a7f300cc FROMGIT: mm/tracing: rss_stat: ensure curr is..
git tree: android14-6.1
console output: https://syzkaller.appspot.com/x/log.txt?x=10e4a55a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=19de17fcb07fab22
dashboard link: https://syzkaller.appspot.com/bug?extid=6c9d52b3009b181a9d1c
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=170dcfb2580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=165ad95a580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/77929e511655/disk-8494a7f3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0905848fa07a/vmlinux-8494a7f3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/51d328090662/bzImage-8494a7f3.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/e7173eb8b876/mount_2.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=16b1d722580000)

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

==================================================================
BUG: KASAN: use-after-free in pick_link+0x567/0xe30 fs/namei.c:1799
Read of size 8 at addr ffff888123abd610 by task syz.4.105/781

CPU: 1 PID: 781 Comm: syz.4.105 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
Call Trace:
<TASK>
__dump_stack+0x21/0x24 lib/dump_stack.c:88
dump_stack_lvl+0x110/0x170 lib/dump_stack.c:106
print_address_description+0x71/0x200 mm/kasan/report.c:316
print_report+0x4a/0x60 mm/kasan/report.c:420
kasan_report+0x122/0x150 mm/kasan/report.c:524
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
pick_link+0x567/0xe30 fs/namei.c:1799
step_into+0xc5c/0xf40 fs/namei.c:1875
walk_component fs/namei.c:2011 [inline]
link_path_walk+0x6c1/0xe80 fs/namei.c:2332
path_openat+0x27c/0x2f80 fs/namei.c:3786
do_filp_open+0x1f1/0x430 fs/namei.c:3817
do_sys_openat2+0x15e/0x810 fs/open.c:1343
do_sys_open fs/open.c:1359 [inline]
__do_sys_openat fs/open.c:1375 [inline]
__se_sys_openat fs/open.c:1370 [inline]
__x64_sys_openat+0x136/0x160 fs/open.c:1370
x64_sys_call+0x783/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f4837b9c629
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f48379bd028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f4837e16180 RCX: 00007f4837b9c629
RDX: 0000000000008000 RSI: 0000200000000180 RDI: 0000000000000005
RBP: 00007f4837c32b39 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000004d R11: 0000000000000246 R12: 0000000000000000
R13: 00007f4837e16218 R14: 00007f4837e16180 R15: 00007ffd14571258
</TASK>

Allocated by task 781:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
kasan_save_alloc_info+0x25/0x30 mm/kasan/generic.c:505
__kasan_slab_alloc+0x72/0x80 mm/kasan/common.c:334
kasan_slab_alloc include/linux/kasan.h:202 [inline]
slab_post_alloc_hook+0x4f/0x2d0 mm/slab.h:768
slab_alloc_node mm/slub.c:3382 [inline]
slab_alloc mm/slub.c:3392 [inline]
__kmem_cache_alloc_lru mm/slub.c:3399 [inline]
kmem_cache_alloc_lru+0x104/0x280 mm/slub.c:3415
alloc_inode_sb include/linux/fs.h:3263 [inline]
alloc_inode fs/inode.c:266 [inline]
new_inode_pseudo+0x8f/0x1f0 fs/inode.c:1073
new_inode+0x28/0x1e0 fs/inode.c:1101
bpf_get_inode kernel/bpf/inode.c:116 [inline]
bpf_symlink+0x65/0x270 kernel/bpf/inode.c:394
vfs_symlink+0x261/0x3f0 fs/namei.c:4478
do_symlinkat+0x124/0x5a0 fs/namei.c:4507
__do_sys_symlinkat fs/namei.c:4524 [inline]
__se_sys_symlinkat fs/namei.c:4521 [inline]
__x64_sys_symlinkat+0x99/0xb0 fs/namei.c:4521
x64_sys_call+0x282/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:267
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 777:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
kasan_save_free_info+0x31/0x50 mm/kasan/generic.c:516
____kasan_slab_free+0x132/0x180 mm/kasan/common.c:242
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:250
kasan_slab_free include/linux/kasan.h:178 [inline]
slab_free_hook mm/slub.c:1750 [inline]
slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1776
slab_free mm/slub.c:3712 [inline]
kmem_cache_free+0x12d/0x300 mm/slub.c:3737
free_inode_nonrcu+0x1c/0x20 fs/inode.c:245
bpf_destroy_inode+0x14a/0x170 kernel/bpf/inode.c:621
destroy_inode fs/inode.c:314 [inline]
evict+0x7d0/0x8f0 fs/inode.c:723
iput_final fs/inode.c:1844 [inline]
iput+0x620/0x670 fs/inode.c:1870
do_unlinkat+0x380/0x6d0 fs/namei.c:4404
__do_sys_unlinkat fs/namei.c:4440 [inline]
__se_sys_unlinkat fs/namei.c:4433 [inline]
__x64_sys_unlinkat+0xd8/0xf0 fs/namei.c:4433
x64_sys_call+0x79f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:264
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888123abd380
which belongs to the cache inode_cache of size 704
The buggy address is located 656 bytes inside of
704-byte region [ffff888123abd380, ffff888123abd640)

The buggy address belongs to the physical page:
page:ffffea00048eaf00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x123abc
head:ffffea00048eaf00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea00045c5c00 dead000000000003 ffff8881001ed380
raw: 0000000000000000 0000000080130013 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 289, tgid 289 (syz-executor), ts 86704235187, free_ts 0
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2643
prep_new_page+0x1c/0x110 mm/page_alloc.c:2650
get_page_from_freelist+0x2d12/0x2d80 mm/page_alloc.c:4554
__alloc_pages+0x1d9/0x480 mm/page_alloc.c:5868
alloc_slab_page+0x6e/0xf0 include/linux/gfp.h:-1
allocate_slab mm/slub.c:1967 [inline]
new_slab+0x98/0x3d0 mm/slub.c:2020
___slab_alloc+0x6bd/0xb20 mm/slub.c:3177
__slab_alloc+0x5e/0xa0 mm/slub.c:3263
slab_alloc_node mm/slub.c:3348 [inline]
slab_alloc mm/slub.c:3392 [inline]
__kmem_cache_alloc_lru mm/slub.c:3399 [inline]
kmem_cache_alloc_lru+0x144/0x280 mm/slub.c:3415
alloc_inode_sb include/linux/fs.h:3263 [inline]
alloc_inode fs/inode.c:266 [inline]
new_inode_pseudo+0x8f/0x1f0 fs/inode.c:1073
get_pipe_inode fs/pipe.c:878 [inline]
create_pipe_files+0x4f/0x6c0 fs/pipe.c:918
__do_pipe_flags+0x4f/0x200 fs/pipe.c:967
do_pipe2+0xa7/0x190 fs/pipe.c:1015
__do_sys_pipe2 fs/pipe.c:1033 [inline]
__se_sys_pipe2 fs/pipe.c:1031 [inline]
__x64_sys_pipe2+0x5a/0x70 fs/pipe.c:1031
x64_sys_call+0x258/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:294
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
page_owner free stack trace missing

Memory state around the buggy address:
ffff888123abd500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888123abd580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888123abd600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff888123abd680: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff888123abd700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


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

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
Reply all
Reply to author
Forward
0 new messages