syzbot


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

Status: upstream: reported C repro on 2024/04/19 05:30
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+0fe06c9a4c97621dd4bf@syzkaller.appspotmail.com
First crash: 66d, last: 1d00h
Fix commit to backport (bisect log) :
tree: upstream
commit 7cd7a36ab44d3e8c1dee7185ef407b9831a8220b
Author: Jan Kara <jack@suse.cz>
Date: Tue Oct 4 13:00:15 2022 +0000

  udf: Convert udf_readdir() to new directory iteration

  
Bug presence (2)
Date Name Commit Repro Result
2024/04/20 linux-6.1.y (ToT) 6741e066ec76 C [report] KASAN: slab-out-of-bounds Write in udf_readdir
2024/04/20 upstream (ToT) 13a2e429f644 C Didn't crash
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: slab-out-of-bounds Write in udf_readdir origin:lts-only C done 283 1d06h 70d 0/3 upstream: reported C repro on 2024/04/15 06:11
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2024/05/04 09:50 8h01m fix candidate upstream job log (1)

Sample crash report:
loop0: detected capacity change from 0 to 2048
UDF-fs: error (device loop0): udf_read_tagged: tag checksum failed, block 160: 0x52 != 0x00
UDF-fs: INFO Mounting volume 'LiuxUDF', timestamp 2022/11/22 14:59 (1000)
==================================================================
BUG: KASAN: slab-out-of-bounds in udf_readdir+0xc5f/0x2240 fs/udf/dir.c:182
Write of size 201 at addr ffff888013a64636 by task syz-executor378/3544

CPU: 0 PID: 3544 Comm: syz-executor378 Not tainted 6.1.87-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
 memcpy+0x3c/0x60 mm/kasan/shadow.c:66
 udf_readdir+0xc5f/0x2240 fs/udf/dir.c:182
 iterate_dir+0x224/0x560
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f94dca6dab9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 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:00007fffaba83f68 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f94dca6dab9
RDX: 0000000000000ff9 RSI: 0000000020001280 RDI: 0000000000000005
RBP: 00007f94dcae1610 R08: 0000000000000000 R09: 00007fffaba84138
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007fffaba84128 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Allocated by task 3544:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:556 [inline]
 udf_readdir+0xb78/0x2240 fs/udf/dir.c:172
 iterate_dir+0x224/0x560
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

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

The buggy address belongs to the physical page:
page:ffffea00004e9900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13a64
head:ffffea00004e9900 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff80000010200(slab|head|node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000010200 ffffea00004e9a80 dead000000000002 ffff888012441b40
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 2528782905, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
 prep_new_page mm/page_alloc.c:2520 [inline]
 get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2115
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975
 __do_krealloc mm/slab_common.c:1348 [inline]
 krealloc+0x61/0xf0 mm/slab_common.c:1381
 add_sysfs_param+0xca/0x7f0 kernel/params.c:651
 kernel_add_sysfs_param+0xb0/0x126 kernel/params.c:812
 param_sysfs_builtin+0x16a/0x1e2 kernel/params.c:851
 param_sysfs_init+0x66/0x6a kernel/params.c:970
 do_one_initcall+0x265/0x8f0 init/main.c:1297
 do_initcall_level+0x157/0x207 init/main.c:1370
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888013a64580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888013a64600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888013a64680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06
                                                                ^
 ffff888013a64700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888013a64780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/19 05:56 linux-6.1.y 6741e066ec76 af24b050 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/06/23 22:05 linux-6.1.y eb44d83053d6 edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/05/20 04:44 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/05/20 04:43 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/05/18 20:47 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/05/18 20:45 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/05/18 20:45 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/05/18 20:42 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/05/18 20:42 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/04/24 12:07 linux-6.1.y 6741e066ec76 21339d7b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/04/23 23:53 linux-6.1.y 6741e066ec76 21339d7b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/04/21 05:08 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/04/20 23:19 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/04/20 11:14 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
2024/04/19 05:30 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Write in udf_readdir
* Struck through repros no longer work on HEAD.