syzbot


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

Status: upstream: reported C repro on 2022/10/10 07:15
Reported-by: syzbot+69c9fdccc6dd08961d34@syzkaller.appspotmail.com
Fix commit: c8af247de385 udf: Fix a slab-out-of-bounds write bug in udf_find_entry()
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-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-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce], missing on: [ci-qemu2-riscv64 ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci2-upstream-usb]
First crash: 112d, last: 80d

Cause bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Write in udf_find_entry C error 10 51d 362d 0/1 upstream: reported C repro on 2022/02/01 19:02
linux-4.14 KASAN: slab-out-of-bounds Write in udf_find_entry C 2 21h44m 66d 0/1 upstream: reported C repro on 2022/11/24 14:45

Sample crash report:
loop0: detected capacity change from 0 to 2048
==================================================================
BUG: KASAN: slab-out-of-bounds in udf_find_entry+0x9f4/0x1230 fs/udf/namei.c:253
Write of size 105 at addr ffff8880126e0896 by task syz-executor238/3606

CPU: 1 PID: 3606 Comm: syz-executor238 Not tainted 6.1.0-rc4-syzkaller-00011-g59f2f4b8a757 #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+0xcd/0x134 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+0xbb/0x1f0 mm/kasan/report.c:495
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
 memcpy+0x39/0x60 mm/kasan/shadow.c:66
 udf_find_entry+0x9f4/0x1230 fs/udf/namei.c:253
 udf_lookup fs/udf/namei.c:309 [inline]
 udf_lookup+0x156/0x270 fs/udf/namei.c:298
 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:3710
 do_filp_open+0x1b6/0x400 fs/namei.c:3740
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_creat fs/open.c:1402 [inline]
 __se_sys_creat fs/open.c:1396 [inline]
 __x64_sys_creat+0xc9/0x120 fs/open.c:1396
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f95326f54d9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd7a5e5568 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f95326f54d9
RDX: 00007f95326f54d9 RSI: 0000000000000000 RDI: 0000000020000180
RBP: 00007f95326b4a10 R08: 0000000000000000 R09: 0000000000000000
R10: 0000555555c3a2c0 R11: 0000000000000246 R12: 00007f95326b4aa0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 3606:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45
 kasan_set_track+0x21/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 ____kasan_kmalloc mm/kasan/common.c:330 [inline]
 __kasan_kmalloc+0xa1/0xb0 mm/kasan/common.c:380
 kmalloc include/linux/slab.h:576 [inline]
 udf_find_entry+0xd45/0x1230 fs/udf/namei.c:243
 udf_lookup fs/udf/namei.c:309 [inline]
 udf_lookup+0x156/0x270 fs/udf/namei.c:298
 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:3710
 do_filp_open+0x1b6/0x400 fs/namei.c:3740
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_creat fs/open.c:1402 [inline]
 __se_sys_creat fs/open.c:1396 [inline]
 __x64_sys_creat+0xc9/0x120 fs/open.c:1396
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff8880126e0800
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 150 bytes inside of
 256-byte region [ffff8880126e0800, ffff8880126e0900)

The buggy address belongs to the physical page:
page:ffffea000049b800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x126e0
head:ffffea000049b800 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea000049b600 dead000000000002 ffff888011841b40
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 1579917180, free_ts 0
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288
 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5555
 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2118
 alloc_pages+0x22f/0x270 mm/mempolicy.c:2280
 alloc_slab_page mm/slub.c:1794 [inline]
 allocate_slab+0x213/0x300 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+0x191/0x3e0 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc_node_track_caller+0x45/0xc0 mm/slab_common.c:975
 __do_krealloc mm/slab_common.c:1350 [inline]
 krealloc+0x8c/0xf0 mm/slab_common.c:1383
 add_sysfs_param+0xca/0x960 kernel/params.c:651
 kernel_add_sysfs_param kernel/params.c:812 [inline]
 param_sysfs_builtin kernel/params.c:851 [inline]
 param_sysfs_init+0x301/0x43b kernel/params.c:970
 do_one_initcall+0x13d/0x780 init/main.c:1303
 do_initcall_level init/main.c:1376 [inline]
 do_initcalls init/main.c:1392 [inline]
 do_basic_setup init/main.c:1411 [inline]
 kernel_init_freeable+0x6ff/0x788 init/main.c:1631
 kernel_init+0x1a/0x1d0 init/main.c:1519
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880126e0780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880126e0800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880126e0880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06
                                                                ^
 ffff8880126e0900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880126e0980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (19):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/11/08 17:17 upstream 59f2f4b8a757 881db35d .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/30 10:01 upstream b229b6ca5abb 2a71366b .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: slab-out-of-bounds Write in udf_find_entry
ci-upstream-kasan-gce-root 2022/10/19 00:46 upstream 55be6084c8e0 b31320fc .config strace log report syz C [disk image] [vmlinux] [mounted in repro #1] [mounted in repro #2] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/16 07:25 upstream 493ffd6605b2 67cb024c .config strace log report syz C [disk image] [vmlinux] [mounted in repro] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/09 11:53 upstream a6afa4199d3d aea5da89 .config strace log report syz C [disk image] [vmlinux] [mounted in repro #1] [mounted in repro #2] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/11/10 15:56 upstream f67dd6ce0723 3ead01ad .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/11/08 11:20 upstream 59f2f4b8a757 6feb842b .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci-upstream-kasan-gce-selinux-root 2022/11/07 22:35 upstream f0c4d9fc9cc9 a779b11a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/11/07 09:24 upstream 089d1c31224e 6d752409 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/11/01 13:09 upstream b229b6ca5abb a1d8560a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci-upstream-kasan-gce-selinux-root 2022/10/31 02:13 upstream b229b6ca5abb 2a71366b .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/30 08:17 upstream b229b6ca5abb 2a71366b .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/29 08:01 upstream b229b6ca5abb 899d812a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/26 21:38 upstream 4dc12f37a8e9 86777b7f .config console log report info [disk image] [vmlinux] [kernel image] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/23 05:48 upstream 4da34b7d175d c0b80a55 .config console log report info [disk image] [vmlinux] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/19 15:42 upstream 493ffd6605b2 b31320fc .config console log report info [disk image] [vmlinux] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/15 14:15 upstream 493ffd6605b2 67cb024c .config console log report info [disk image] [vmlinux] KASAN: slab-out-of-bounds Write in udf_find_entry
ci2-upstream-fs 2022/10/09 11:23 upstream a6afa4199d3d aea5da89 .config console log report info [disk image] [vmlinux] KASAN: slab-out-of-bounds Write in udf_find_entry
ci-upstream-linux-next-kasan-gce-root 2022/10/23 06:14 linux-next 4d48f589d294 c0b80a55 .config console log report info [disk image] [vmlinux] KASAN: slab-out-of-bounds Write in udf_find_entry
* Struck through repros no longer work on HEAD.