syzbot


KASAN: slab-out-of-bounds Read in hfsplus_uni2asc

Status: upstream: reported C repro on 2022/11/28 10:02
Reported-by: syzbot+076d963e115823c4b9be@syzkaller.appspotmail.com
First crash: 69d, last: 22h38m

Cause bisection: failed (bisect log)
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Read in hfsplus_uni2asc hfsplus C error 2 46d 70d 0/1 upstream: reported C repro on 2022/11/27 08:50
linux-4.14 KASAN: slab-out-of-bounds Read in hfsplus_uni2asc C 1 6d12h 63d 0/1 upstream: reported C repro on 2022/12/04 03:32
upstream KMSAN: uninit-value in hfsplus_attr_bin_cmp_key hfsplus 5 20d 69d 0/24 upstream: reported on 2022/11/28 10:04

Sample crash report:
loop0: detected capacity change from 0 to 1024
==================================================================
BUG: KASAN: slab-out-of-bounds in hfsplus_uni2asc+0x953/0xa50 fs/hfsplus/unicode.c:179
Read of size 2 at addr ffff8880182bd40c by task syz-executor232/3629

CPU: 0 PID: 3629 Comm: syz-executor232 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
 hfsplus_uni2asc+0x953/0xa50 fs/hfsplus/unicode.c:179
 hfsplus_readdir+0x70d/0xf30 fs/hfsplus/dir.c:207
 iterate_dir+0x56e/0x6f0 fs/readdir.c:65
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64 fs/readdir.c:354 [inline]
 __x64_sys_getdents64+0x13e/0x2c0 fs/readdir.c:354
 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:0x7fd3fef57869
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:00007ffe51f345b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 000000000000003f RCX: 00007fd3fef57869
RDX: 0000000000000061 RSI: 0000000020000340 RDI: 0000000000000004
RBP: 00007fd3fef17100 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd3fef17190
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 3629:
 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]
 hfsplus_find_init+0x95/0x230 fs/hfsplus/bfind.c:21
 hfsplus_readdir+0x21f/0xf30 fs/hfsplus/dir.c:144
 iterate_dir+0x56e/0x6f0 fs/readdir.c:65
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64 fs/readdir.c:354 [inline]
 __x64_sys_getdents64+0x13e/0x2c0 fs/readdir.c:354
 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

Last potentially related work creation:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481
 call_rcu+0x9d/0x820 kernel/rcu/tree.c:2798
 netlink_release+0xf0f/0x1dd0 net/netlink/af_netlink.c:815
 __sock_release+0xcd/0x280 net/socket.c:650
 sock_close+0x1c/0x20 net/socket.c:1365
 __fput+0x27c/0xa90 fs/file_table.c:320
 task_work_run+0x16f/0x270 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:203
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296
 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff8880182bd000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1036 bytes inside of
 2048-byte region [ffff8880182bd000, ffff8880182bd800)

The buggy address belongs to the physical page:
page:ffffea000060ae00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x182b8
head:ffffea000060ae00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888012042000
raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 2338714128, free_ts 0
 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]
 pnp_alloc_dev+0x51/0x380 drivers/pnp/core.c:135
 pnpacpi_add_device drivers/pnp/pnpacpi/core.c:234 [inline]
 pnpacpi_add_device_handler+0x200/0x779 drivers/pnp/pnpacpi/core.c:295
 acpi_ns_get_device_callback drivers/acpi/acpica/nsxfeval.c:740 [inline]
 acpi_ns_get_device_callback+0x3b9/0x415 drivers/acpi/acpica/nsxfeval.c:635
 acpi_ns_walk_namespace+0x250/0x432 drivers/acpi/acpica/nswalk.c:240
 acpi_get_devices+0xdb/0x12e drivers/acpi/acpica/nsxfeval.c:805
 pnpacpi_init+0x99/0xf2 drivers/pnp/pnpacpi/core.c:308
 do_one_initcall+0x141/0x780 init/main.c:1303
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880182bd300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880182bd380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880182bd400: 00 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                      ^
 ffff8880182bd480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880182bd500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (36):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/12/12 21:59 upstream 830b3c68c1fb 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/11/27 15:17 upstream faf68e3523c2 f4470a7b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/30 22:16 upstream 6d796c50f84c b68fb8d6 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/28 22:16 upstream 5af6ce704936 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/22 19:28 upstream 2241ab53cbb5 cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/20 01:24 upstream 081edded9b38 71197f3a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/17 15:35 upstream d532dd102151 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/17 09:17 upstream d532dd102151 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/11 09:14 upstream 40c18f363a08 48bc529a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/09 13:30 upstream 1fe4fd6f5cad 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/08 20:09 upstream 9b43a525db12 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/08 06:54 upstream 0a71553536d2 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/07 20:33 upstream 0a71553536d2 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/04 19:15 upstream 69b41ac87e4a 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/03 22:45 upstream 69b41ac87e4a f0036e18 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2023/01/01 06:18 upstream c8451c141e07 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/31 03:36 upstream bff687b3dad6 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci-upstream-kasan-gce-smack-root 2022/12/24 02:34 upstream a27405b2ed9c 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/21 10:42 upstream 6feb57c2fd7c d3e76707 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci-upstream-kasan-gce-root 2022/12/21 09:14 upstream b6bb9676f216 d3e76707 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci-upstream-kasan-gce-smack-root 2022/12/21 07:08 upstream b6bb9676f216 d3e76707 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/20 15:02 upstream aeba12b26c79 c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/20 06:20 upstream aeba12b26c79 c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/15 09:14 upstream e2ca6ba6ba01 b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/09 21:40 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/07 23:58 upstream 8ed710da2873 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/05 01:24 upstream c2bf05db6c78 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/03 16:06 upstream 97ee9d1c1696 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/12/02 23:53 upstream a4412fdd49dc e080de16 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci2-upstream-fs 2022/11/28 07:05 upstream cf562a45a0d5 f4470a7b .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci-upstream-linux-next-kasan-gce-root 2022/12/21 07:18 linux-next e45fb347b630 d3e76707 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Read in hfsplus_uni2asc
ci-upstream-kmsan-gce-386 2023/02/04 12:51 https://github.com/google/kmsan.git master eda666ff2276 1b2f701a .config console log report info [disk image] [vmlinux] [kernel image] KMSAN: uninit-value in hfsplus_cat_case_cmp_key
ci-upstream-kmsan-gce-386 2023/01/30 19:38 https://github.com/google/kmsan.git master 41c66f470616 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] KMSAN: uninit-value in hfsplus_uni2asc
ci-upstream-kmsan-gce-386 2023/01/08 01:09 https://github.com/google/kmsan.git master 5c6259d6d19f 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KMSAN: uninit-value in hfs_find_1st_rec_by_cnid
ci-upstream-kmsan-gce-386 2022/12/25 21:21 https://github.com/google/kmsan.git master 5c6259d6d19f 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KMSAN: uninit-value in hfsplus_uni2asc
ci-upstream-kmsan-gce-386 2022/12/10 01:14 https://github.com/google/kmsan.git master 30d2727189c5 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] KMSAN: uninit-value in hfsplus_uni2asc
* Struck through repros no longer work on HEAD.