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

7 views
Skip to first unread message

syzbot

unread,
Nov 24, 2022, 9:45:40 AM11/24/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e911713e40ca Linux 4.14.299
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15a3cd9b880000
kernel config: https://syzkaller.appspot.com/x/.config?x=1d7ed9728cc57838
dashboard link: https://syzkaller.appspot.com/bug?extid=533cd0b18fadb8a01a15
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c8588259d654/disk-e911713e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/700d08072e5e/vmlinux-e911713e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/844ad5da2ed5/bzImage-e911713e.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+533cd0...@syzkaller.appspotmail.com

audit: type=1800 audit(1669301109.098:8): pid=9754 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name=789CECDD4F6C1CD77D07F0DF1B922229B715133B8ADDC6C5A62D5299B15CFD8BA95885BBAA69B601649908C5DC02704552EAC214499054231B69C1F4D2430F018AA2879C08B44681140D8CA6087A645B17482E3E1439F544B4B011143DB045809C020633FB565C5294458BA444DA9F8F4D7D6767DF9B796F663C230B7AF302 dev="loop4" ino=1318 res=0
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:376 [inline]
BUG: KASAN: slab-out-of-bounds in udf_find_entry+0x8fb/0xef0 fs/udf/namei.c:250
Write of size 165 at addr ffff8880a5b0dc1a by task syz-executor.4/9783

CPU: 1 PID: 9783 Comm: syz-executor.4 Not tainted 4.14.299-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report+0x6f/0x80 mm/kasan/report.c:409
memcpy+0x35/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:376 [inline]
udf_find_entry+0x8fb/0xef0 fs/udf/namei.c:250
udf_lookup fs/udf/namei.c:321 [inline]
udf_lookup+0x11b/0x210 fs/udf/namei.c:295
lookup_open+0x5c4/0x1750 fs/namei.c:3220
do_last fs/namei.c:3334 [inline]
path_openat+0xe08/0x2970 fs/namei.c:3571
do_filp_open+0x179/0x3c0 fs/namei.c:3605
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Allocated by task 9783:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
udf_find_entry+0x959/0xef0 fs/udf/namei.c:240
udf_lookup fs/udf/namei.c:321 [inline]
udf_lookup+0x11b/0x210 fs/udf/namei.c:295
lookup_open+0x5c4/0x1750 fs/namei.c:3220
do_last fs/namei.c:3334 [inline]
path_openat+0xe08/0x2970 fs/namei.c:3571
do_filp_open+0x179/0x3c0 fs/namei.c:3605
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 8303:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
do_execveat_common+0x161b/0x2030 fs/exec.c:1860
do_execve+0x33/0x50 fs/exec.c:1877
call_usermodehelper_exec_async+0x2ed/0x510 kernel/umh.c:109
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406

The buggy address belongs to the object at ffff8880a5b0dbc0
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 90 bytes inside of
256-byte region [ffff8880a5b0dbc0, ffff8880a5b0dcc0)
The buggy address belongs to the page:
page:ffffea000296c340 count:1 mapcount:0 mapping:ffff8880a5b0d080 index:0xffff8880a5b0da80
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a5b0d080 ffff8880a5b0da80 0000000100000006
raw: ffffea0002989920 ffffea0002cdd0e0 ffff88813fe747c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a5b0db80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff8880a5b0dc00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a5b0dc80: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
^
ffff8880a5b0dd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880a5b0dd80: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Nov 24, 2022, 3:39:39 PM11/24/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: e911713e40ca Linux 4.14.299
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15e15205880000
kernel config: https://syzkaller.appspot.com/x/.config?x=1d7ed9728cc57838
dashboard link: https://syzkaller.appspot.com/bug?extid=533cd0b18fadb8a01a15
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=178e9bab880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15369d55880000
mounted in repro: https://storage.googleapis.com/syzbot-assets/c68b1f712e02/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+533cd0...@syzkaller.appspotmail.com

UDF-fs: error (device loop0): udf_process_sequence: Block 100 of volume descriptor sequence is corrupted or we could not read it
UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2022/11/22 14:59 (1000)
audit: type=1800 audit(1669322225.320:2): pid=7980 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor566" name=789CECDD4F6C1CD77D07F0DF1B922229B715133B8ADDC6C5A62D5299B15CFD8BA95885BBAA69B601649908C5DC02704552EAC214499054231B69C1F4D2430F018AA2879C08B44681140D8CA6087A645B17482E3E1439F544B4B011143DB045809C020633FB565C5294458BA444DA9F8F4D7D6767DF9B796F663C230B7AF302 dev="loop0" ino=1318 res=0
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:376 [inline]
BUG: KASAN: slab-out-of-bounds in udf_find_entry+0x8fb/0xef0 fs/udf/namei.c:250
Write of size 165 at addr ffff8880b49b9cda by task syz-executor566/7980

CPU: 0 PID: 7980 Comm: syz-executor566 Not tainted 4.14.299-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report+0x6f/0x80 mm/kasan/report.c:409
memcpy+0x35/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:376 [inline]
udf_find_entry+0x8fb/0xef0 fs/udf/namei.c:250
udf_lookup fs/udf/namei.c:321 [inline]
udf_lookup+0x11b/0x210 fs/udf/namei.c:295
lookup_open+0x5c4/0x1750 fs/namei.c:3220
do_last fs/namei.c:3334 [inline]
path_openat+0xe08/0x2970 fs/namei.c:3571
do_filp_open+0x179/0x3c0 fs/namei.c:3605
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Allocated by task 7980:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
udf_find_entry+0x959/0xef0 fs/udf/namei.c:240
udf_lookup fs/udf/namei.c:321 [inline]
udf_lookup+0x11b/0x210 fs/udf/namei.c:295
lookup_open+0x5c4/0x1750 fs/namei.c:3220
do_last fs/namei.c:3334 [inline]
path_openat+0xe08/0x2970 fs/namei.c:3571
do_filp_open+0x179/0x3c0 fs/namei.c:3605
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 6228:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
seq_release+0x57/0x70 fs/seq_file.c:372
kernfs_fop_release+0xdc/0x180 fs/kernfs/file.c:781
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

The buggy address belongs to the object at ffff8880b49b9c80
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 90 bytes inside of
256-byte region [ffff8880b49b9c80, ffff8880b49b9d80)
The buggy address belongs to the page:
page:ffffea0002d26e40 count:1 mapcount:0 mapping:ffff8880b49b9000 index:0xffff8880b49b9a00
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b49b9000 ffff8880b49b9a00 0000000100000007
raw: ffffea0002d83ee0 ffffea0002c23da0 ffff88813fe747c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b49b9c00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880b49b9c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880b49b9d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06
^
ffff8880b49b9d80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff8880b49b9e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Reply all
Reply to author
Forward
0 new messages