syzbot


KASAN: slab-out-of-bounds Write in hfs_asc2mac

Status: fixed on 2023/02/24 13:50
Subsystems: hfs
[Documentation on labels]
Reported-by: syzbot+dc3b1cf9111ab5fe98e7@syzkaller.appspotmail.com
Fix commit: c53ed55cb275 hfs: Fix OOB Write in hfs_asc2mac
First crash: 462d, last: 444d
Cause bisection: failed (error log, bisect log)
  
Discussions (4)
Title Replies (including bot) Last reply
[PATCH v2] hfs: Fix OOB Write in hfs_asc2mac 1 (1) 2022/12/02 03:00
[PATCH] hfs: Fix OOB Write in hfs_asc2mac 6 (6) 2022/12/01 23:09
[PATCH v2] hfs: Fix OOB Write in hfs_asc2mac 1 (1) 2022/11/29 09:07
[syzbot] KASAN: slab-out-of-bounds Write in hfs_asc2mac 0 (1) 2022/11/25 09:45
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: slab-out-of-bounds Write in hfs_asc2mac hfs C 9 362d 454d 0/1 upstream: reported C repro on 2022/12/02 20:22
linux-4.19 KASAN: slab-out-of-bounds Write in hfs_asc2mac hfs C 73 362d 461d 0/1 upstream: reported C repro on 2022/11/26 02:11

Sample crash report:
loop0: detected capacity change from 0 to 64
==================================================================
BUG: KASAN: slab-out-of-bounds in hfs_asc2mac+0x693/0x720 fs/hfs/trans.c:133
Write of size 1 at addr ffff8880220d5ace by task syz-executor203/3632

CPU: 0 PID: 3632 Comm: syz-executor203 Not tainted 6.1.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:395
 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495
 hfs_asc2mac+0x693/0x720 fs/hfs/trans.c:133
 hfs_cat_build_key+0xc4/0x170 fs/hfs/catalog.c:28
 hfs_lookup+0x1c6/0x310 fs/hfs/dir.c:31
 lookup_open.isra.0+0x76a/0x12a0 fs/namei.c:3391
 open_last_lookups fs/namei.c:3481 [inline]
 path_openat+0x996/0x2860 fs/namei.c:3711
 do_filp_open+0x1ba/0x410 fs/namei.c:3741
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_openat fs/open.c:1342 [inline]
 __se_sys_openat fs/open.c:1337 [inline]
 __x64_sys_openat+0x143/0x1f0 fs/open.c:1337
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fa80a1aeec9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 14 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdbe5ebbb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007ffdbe5ebbc8 RCX: 00007fa80a1aeec9
RDX: 000000000000275a RSI: 0000000020000300 RDI: 00000000ffffff9c
RBP: 00007ffdbe5ebbc0 R08: 00007ffdbe5ebbc0 R09: 00007fa80a16c480
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 3632:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 ____kasan_kmalloc mm/kasan/common.c:330 [inline]
 __kasan_kmalloc+0xa5/0xb0 mm/kasan/common.c:380
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc+0x5a/0xd0 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 hfs_find_init+0x95/0x240 fs/hfs/bfind.c:21
 hfs_lookup+0x102/0x310 fs/hfs/dir.c:28
 lookup_open.isra.0+0x76a/0x12a0 fs/namei.c:3391
 open_last_lookups fs/namei.c:3481 [inline]
 path_openat+0x996/0x2860 fs/namei.c:3711
 do_filp_open+0x1ba/0x410 fs/namei.c:3741
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_openat fs/open.c:1342 [inline]
 __se_sys_openat fs/open.c:1337 [inline]
 __x64_sys_openat+0x143/0x1f0 fs/open.c:1337
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff8880220d5a80
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 78 bytes inside of
 96-byte region [ffff8880220d5a80, ffff8880220d5ae0)

The buggy address belongs to the physical page:
page:ffffea0000883540 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x220d5
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888012041780
raw: 0000000000000000 0000000080200020 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 1, tgid 1 (swapper/0), ts 7851050128, free_ts 7430834663
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291
 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558
 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2118
 alloc_pages+0x233/0x270 mm/mempolicy.c:2280
 alloc_slab_page mm/slub.c:1794 [inline]
 allocate_slab+0x25f/0x350 mm/slub.c:1939
 new_slab mm/slub.c:1992 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3180
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x199/0x3e0 mm/slub.c:3437
 kmalloc_trace+0x26/0x60 mm/slab_common.c:1045
 kmalloc include/linux/slab.h:553 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 dev_pm_qos_expose_flags+0x9c/0x310 drivers/base/power/qos.c:782
 usb_hub_create_port_device+0x9c5/0xd70 drivers/usb/core/port.c:715
 hub_configure drivers/usb/core/hub.c:1659 [inline]
 hub_probe.cold+0x2534/0x2aa3 drivers/usb/core/hub.c:1896
 usb_probe_interface+0x30f/0x7f0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:560 [inline]
 really_probe+0x249/0xb90 drivers/base/dd.c:639
 __driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:808
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509
 free_unref_page_prepare mm/page_alloc.c:3387 [inline]
 free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483
 __vunmap+0x85d/0xd30 mm/vmalloc.c:2713
 free_work+0x5c/0x80 mm/vmalloc.c:97
 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
 worker_thread+0x669/0x1090 kernel/workqueue.c:2436
 kthread+0x2e8/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Memory state around the buggy address:
 ffff8880220d5980: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8880220d5a00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
>ffff8880220d5a80: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
                                              ^
 ffff8880220d5b00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
 ffff8880220d5b80: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
==================================================================

Crashes (161):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/12 22:18 upstream 830b3c68c1fb 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/12 17:45 upstream 830b3c68c1fb 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 01:10 upstream 3ecc37918c80 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/10 03:05 upstream 0d1409e4ff08 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/11/28 17:31 upstream b7b275e60bcd 247de55b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/11/27 15:38 upstream faf68e3523c2 f4470a7b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/11/27 03:58 upstream 644e9524388a f4470a7b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/11/26 09:15 upstream 08ad43d554ba f4470a7b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/11/25 01:46 upstream 4312098baf37 ff68ff8f .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/13 06:40 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/13 05:26 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/13 00:35 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/12 20:53 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/12 14:59 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/12 07:30 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/12 06:14 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/12 05:01 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/12 01:34 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 20:00 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 18:58 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 16:53 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 15:37 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 12:02 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 09:23 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/11 07:46 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/10 18:56 upstream 3ecc37918c80 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/10 05:34 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/09 23:08 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/09 20:47 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/09 18:25 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/09 06:15 upstream f3e8416619ce 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/09 01:32 upstream 479174d402bc 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/08 20:55 upstream 479174d402bc 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/08 13:40 upstream 479174d402bc d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/08 11:59 upstream 479174d402bc d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/08 09:41 upstream 479174d402bc d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/08 07:38 upstream 479174d402bc d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/07 20:12 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/07 18:25 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/07 16:13 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/07 15:00 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/07 02:58 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/06 14:34 upstream bce9332220bd 045cbb84 .config console log report info ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/06 12:40 upstream bce9332220bd 045cbb84 .config console log report info ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/06 11:22 upstream bce9332220bd 045cbb84 .config console log report info ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/06 09:56 upstream bce9332220bd 045cbb84 .config console log report info ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/06 01:34 upstream 76dcd734eca2 045cbb84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/05 23:50 upstream 76dcd734eca2 045cbb84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/05 22:19 upstream 76dcd734eca2 045cbb84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/05 16:53 upstream 76dcd734eca2 045cbb84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/05 10:37 upstream c2bf05db6c78 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/05 00:25 upstream c2bf05db6c78 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/04 12:28 upstream 97ee9d1c1696 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/12/02 19:55 upstream a4412fdd49dc e080de16 .config console log report info ci-qemu-upstream KASAN: slab-out-of-bounds Write in hfs_asc2mac
2022/11/25 01:29 upstream 4312098baf37 ff68ff8f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Write in hfs_asc2mac
* Struck through repros no longer work on HEAD.