syzbot


KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl

Status: upstream: reported C repro on 2024/02/02 04:49
Subsystems: v9fs
[Documentation on labels]
Reported-by: syzbot+7a3d75905ea1a830dbe5@syzkaller.appspotmail.com
Fix commit: 11763a8598f8 fs/9p: fix uaf in in v9fs_stat2inode_dotl
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-net-next-test-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 89d, last: 30d
Cause bisection: introduced by (bisect log) :
commit 724a08450f74b02bd89078a596fd24857827c012
Author: Eric Van Hensbergen <ericvh@kernel.org>
Date: Fri Jan 5 22:25:39 2024 +0000

  fs/9p: simplify iget to remove unnecessary paths

Crash: KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl (log)
Repro: C syz .config
  
Discussions (4)
Title Replies (including bot) Last reply
[PATCH next] fs/9p: fix uaf in in v9fs_stat2inode_dotl 8 (8) 2024/03/27 19:02
[syzbot] Monthly v9fs report (Mar 2024) 0 (1) 2024/03/19 07:26
[syzbot] Monthly v9fs report (Feb 2024) 0 (1) 2024/02/16 13:23
[syzbot] [v9fs?] KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl 2 (5) 2024/02/02 12:08
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/03/03 07:56 24m retest repro linux-next error OK
2024/02/02 08:41 2h03m lizhi.xu@windriver.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master OK log
2024/02/02 08:35 23m lizhi.xu@windriver.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master OK log

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in v9fs_stat2inode_dotl+0xb3f/0xce0 fs/9p/vfs_inode_dotl.c:569
Read of size 8 at addr ffff8880172d4bb0 by task syz-executor117/5063

CPU: 1 PID: 5063 Comm: syz-executor117 Not tainted 6.8.0-rc1-next-20240129-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:488
 kasan_report+0xd9/0x110 mm/kasan/report.c:601
 v9fs_stat2inode_dotl+0xb3f/0xce0 fs/9p/vfs_inode_dotl.c:569
 v9fs_fid_iget_dotl+0x1cb/0x260 fs/9p/vfs_inode_dotl.c:85
 v9fs_get_inode_from_fid fs/9p/v9fs.h:230 [inline]
 v9fs_mount+0x515/0xa90 fs/9p/vfs_super.c:142
 legacy_get_tree+0x109/0x220 fs/fs_context.c:662
 vfs_get_tree+0x8f/0x380 fs/super.c:1784
 do_new_mount fs/namespace.c:3352 [inline]
 path_mount+0x14e6/0x1f20 fs/namespace.c:3679
 do_mount fs/namespace.c:3692 [inline]
 __do_sys_mount fs/namespace.c:3898 [inline]
 __se_sys_mount fs/namespace.c:3875 [inline]
 __x64_sys_mount+0x297/0x320 fs/namespace.c:3875
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f88a76d7b69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 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:00007fff734da2a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f88a76d7b69
RDX: 0000000020004500 RSI: 00000000200002c0 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000020000300 R09: 00007fff734da2e0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff734da2e0
R13: 00007fff734da568 R14: 431bde82d7b634db R15: 00007f88a7720074
 </TASK>

Allocated by task 5063:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:372 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:389
 kmalloc include/linux/slab.h:590 [inline]
 p9_client_getattr_dotl+0x4c/0x1e0 net/9p/client.c:1726
 v9fs_fid_iget_dotl+0xe7/0x260 fs/9p/vfs_inode_dotl.c:73
 v9fs_get_inode_from_fid fs/9p/v9fs.h:230 [inline]
 v9fs_mount+0x515/0xa90 fs/9p/vfs_super.c:142
 legacy_get_tree+0x109/0x220 fs/fs_context.c:662
 vfs_get_tree+0x8f/0x380 fs/super.c:1784
 do_new_mount fs/namespace.c:3352 [inline]
 path_mount+0x14e6/0x1f20 fs/namespace.c:3679
 do_mount fs/namespace.c:3692 [inline]
 __do_sys_mount fs/namespace.c:3898 [inline]
 __se_sys_mount fs/namespace.c:3875 [inline]
 __x64_sys_mount+0x297/0x320 fs/namespace.c:3875
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75

Freed by task 5063:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640
 poison_slab_object mm/kasan/common.c:241 [inline]
 __kasan_slab_free+0x121/0x1c0 mm/kasan/common.c:257
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2122 [inline]
 slab_free mm/slub.c:4296 [inline]
 kfree+0x129/0x370 mm/slub.c:4406
 v9fs_fid_iget_dotl+0x195/0x260 fs/9p/vfs_inode_dotl.c:81
 v9fs_get_inode_from_fid fs/9p/v9fs.h:230 [inline]
 v9fs_mount+0x515/0xa90 fs/9p/vfs_super.c:142
 legacy_get_tree+0x109/0x220 fs/fs_context.c:662
 vfs_get_tree+0x8f/0x380 fs/super.c:1784
 do_new_mount fs/namespace.c:3352 [inline]
 path_mount+0x14e6/0x1f20 fs/namespace.c:3679
 do_mount fs/namespace.c:3692 [inline]
 __do_sys_mount fs/namespace.c:3898 [inline]
 __se_sys_mount fs/namespace.c:3875 [inline]
 __x64_sys_mount+0x297/0x320 fs/namespace.c:3875
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75

The buggy address belongs to the object at ffff8880172d4bb0
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes inside of
 freed 192-byte region [ffff8880172d4bb0, ffff8880172d4c70)

The buggy address belongs to the physical page:
page:ffffea00005cb500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x172d4
flags: 0xfff80000000800(slab|node=0|zone=1|lastcpupid=0xfff)
page_type: 0xffffffff()
raw: 00fff80000000800 ffff888014c41a00 ffffea00005fa5c0 dead000000000004
raw: 0000000000000000 00000000800f000f 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 7, tgid 7 (kworker/0:0), ts 3076962571, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1539
 prep_new_page mm/page_alloc.c:1546 [inline]
 get_page_from_freelist+0xa19/0x3740 mm/page_alloc.c:3353
 __alloc_pages+0x22e/0x2420 mm/page_alloc.c:4609
 __alloc_pages_node include/linux/gfp.h:238 [inline]
 alloc_pages_node include/linux/gfp.h:261 [inline]
 alloc_slab_page mm/slub.c:2191 [inline]
 allocate_slab mm/slub.c:2354 [inline]
 new_slab+0xcc/0x3a0 mm/slub.c:2407
 ___slab_alloc+0x66d/0x17a0 mm/slub.c:3541
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3626
 __slab_alloc_node mm/slub.c:3679 [inline]
 slab_alloc_node mm/slub.c:3851 [inline]
 kmalloc_node_trace+0x113/0x390 mm/slub.c:4021
 kmalloc_node include/linux/slab.h:606 [inline]
 kzalloc_node include/linux/slab.h:722 [inline]
 alloc_worker+0x40/0x1b0 kernel/workqueue.c:2078
 create_worker+0xf3/0x730 kernel/workqueue.c:2186
 maybe_create_worker kernel/workqueue.c:2468 [inline]
 manage_workers kernel/workqueue.c:2520 [inline]
 worker_thread+0xca1/0x1290 kernel/workqueue.c:2766
 kthread+0x2c1/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:242
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880172d4a80: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880172d4b00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff8880172d4b80: fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb
                                     ^
 ffff8880172d4c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
 ffff8880172d4c80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================

Crashes (585):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/01/29 11:31 linux-next 596764183be8 cc4a4020 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 06:23 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 05:20 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 04:18 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 02:36 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 00:35 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 22:55 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 20:36 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 19:44 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 17:26 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 16:25 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 15:21 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 08:46 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 07:43 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 06:31 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 05:28 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 04:01 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 03:01 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 21:29 upstream 928a87efa423 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 19:06 upstream 928a87efa423 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 17:37 upstream 928a87efa423 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 16:07 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 15:05 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 13:28 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 13:10 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 12:07 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 06:47 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 03:44 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/28 01:50 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 23:21 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 21:53 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 14:03 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 13:16 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 12:03 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 11:01 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 09:49 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 09:47 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 01:58 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/27 01:03 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 23:42 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 20:18 upstream 928a87efa423 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 18:05 upstream 928a87efa423 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 14:48 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/03/26 10:56 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
2024/02/18 05:19 linux-next 2c3b09aac00d 578f7538 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in v9fs_stat2inode_dotl
* Struck through repros no longer work on HEAD.