syzbot


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

Status: fixed on 2024/02/15 11:44
Subsystems: hfs
[Documentation on labels]
Reported-by: syzbot+4b52080e97cde107939d@syzkaller.appspotmail.com
Fix commit: 6f861765464f fs: Block writes to mounted block devices
First crash: 286d, last: 58d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: KASAN: slab-out-of-bounds Read in generic_perform_write (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
Date: Wed Nov 1 17:43:10 2023 +0000

  fs: Block writes to mounted block devices

  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [hfs?] KASAN: slab-use-after-free Read in hfsplus_read_wrapper 1 (3) 2024/02/09 11:45
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/01/22 09:49 30m retest repro upstream OK log
2024/01/22 09:49 19m retest repro linux-next error OK
2024/01/10 20:20 1h35m retest repro upstream OK log
2024/01/10 20:20 22m retest repro upstream OK log
2024/01/10 20:20 22m retest repro upstream OK log
2023/12/27 17:31 19m retest repro upstream report log
2023/12/27 17:31 14m retest repro upstream report log
2023/11/11 17:19 13m retest repro upstream report log
2023/11/11 14:25 1h45m retest repro linux-next error OK
2023/09/25 13:46 14m retest repro upstream report log
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2024/02/09 02:15 7h25m bisect fix upstream job log (1)
2023/10/26 11:56 2h36m bisect fix upstream job log (0) log
2023/07/17 08:02 2h13m bisect fix upstream job log (0) log
Cause bisection attempts (2)
Created Duration User Patch Repo Result
2023/09/22 19:28 3h46m bisect upstream job log (0) log
2023/05/14 21:52 8h14m bisect linux-next error job log (0)
marked invalid by nogikh@google.com

Sample crash report:
loop0: detected capacity change from 0 to 1024
==================================================================
BUG: KASAN: slab-use-after-free in hfsplus_read_wrapper+0xf82/0x1070 fs/hfsplus/wrapper.c:225
Read of size 2 at addr ffff888016be8400 by task syz-executor733/5148

CPU: 1 PID: 5148 Comm: syz-executor733 Not tainted 6.7.0-rc3-syzkaller-00284-g815fb87b7530 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/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:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 hfsplus_read_wrapper+0xf82/0x1070 fs/hfsplus/wrapper.c:225
 hfsplus_fill_super+0x352/0x1bc0 fs/hfsplus/super.c:413
 mount_bdev+0x1f3/0x2e0 fs/super.c:1650
 legacy_get_tree+0x109/0x220 fs/fs_context.c:662
 vfs_get_tree+0x8c/0x370 fs/super.c:1771
 do_new_mount fs/namespace.c:3337 [inline]
 path_mount+0x1492/0x1ed0 fs/namespace.c:3664
 do_mount fs/namespace.c:3677 [inline]
 __do_sys_mount fs/namespace.c:3886 [inline]
 __se_sys_mount fs/namespace.c:3863 [inline]
 __x64_sys_mount+0x293/0x310 fs/namespace.c:3863
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7fad8295061a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007ffd1c9cc438 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fad8295061a
RDX: 0000000020000100 RSI: 00000000200002c0 RDI: 00007ffd1c9cc480
RBP: 0000000000000004 R08: 00007ffd1c9cc4c0 R09: 0000000000000672
R10: 0000000000814054 R11: 0000000000000286 R12: 00007ffd1c9cc480
R13: 00007ffd1c9cc4c0 R14: 0000000000080000 R15: 0000000000000003
 </TASK>

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

The buggy address belongs to the physical page:
page:ffffea00005afa00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16be8
head:ffffea00005afa00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
ksm flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888013041c80 ffffea00006ad400 dead000000000003
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 279, tgid 279 (kworker/u4:2), ts 5519926174, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1537
 prep_new_page mm/page_alloc.c:1544 [inline]
 get_page_from_freelist+0xa25/0x36d0 mm/page_alloc.c:3312
 __alloc_pages+0x22e/0x2420 mm/page_alloc.c:4568
 alloc_pages_mpol+0x258/0x5f0 mm/mempolicy.c:2133
 alloc_slab_page mm/slub.c:1870 [inline]
 allocate_slab mm/slub.c:2017 [inline]
 new_slab+0x283/0x3c0 mm/slub.c:2070
 ___slab_alloc+0x979/0x1500 mm/slub.c:3223
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
 __slab_alloc_node mm/slub.c:3375 [inline]
 slab_alloc_node mm/slub.c:3468 [inline]
 __kmem_cache_alloc_node+0x131/0x310 mm/slub.c:3517
 kmalloc_trace+0x25/0x60 mm/slab_common.c:1098
 kmalloc include/linux/slab.h:600 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 alloc_bprm+0x51/0xb00 fs/exec.c:1512
 kernel_execve+0xaf/0x4e0 fs/exec.c:1987
 call_usermodehelper_exec_async+0x256/0x4c0 kernel/umh.c:110
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888016be8300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888016be8380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888016be8400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888016be8480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888016be8500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/12/02 20:04 upstream 815fb87b7530 f819d6f7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in hfsplus_read_wrapper
2023/11/14 18:04 upstream 9bacdd8996c7 cb976f63 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in hfsplus_read_wrapper
2023/05/14 12:46 linux-next e922ba281a8d 2b9ba477 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in hfsplus_read_wrapper
2023/12/13 17:31 upstream 88035e5694a8 ebcad15c .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-badwrites-root KASAN: slab-use-after-free Read in hfsplus_read_wrapper
2023/11/21 17:26 upstream 98b1cc82c4af cb976f63 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-badwrites-root KASAN: slab-use-after-free Read in hfsplus_read_wrapper
2023/06/16 09:59 upstream 62d8779610bb f3921d4d .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in hfsplus_read_wrapper
2023/06/13 10:17 upstream fd37b884003c 749afb64 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in hfsplus_read_wrapper
* Struck through repros no longer work on HEAD.