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

12 views
Skip to first unread message

syzbot

unread,
Feb 1, 2022, 2:02:23 PM2/1/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14408234700000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=96e7e0249bb80cc7065b
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

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

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

netlink: 8 bytes leftover after parsing attributes in process `syz-executor.1'.
UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2020/09/19 18:44 (1000)
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in udf_find_entry+0xa33/0x1070 fs/udf/namei.c:251
Write of size 45 at addr ffff8880b2cd9f12 by task syz-executor.5/5284

CPU: 0 PID: 5284 Comm: syz-executor.5 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
memcpy+0x35/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:377 [inline]
udf_find_entry+0xa33/0x1070 fs/udf/namei.c:251
udf_lookup fs/udf/namei.c:322 [inline]
udf_lookup+0x156/0x270 fs/udf/namei.c:296
__lookup_slow+0x246/0x4a0 fs/namei.c:1672
lookup_slow fs/namei.c:1689 [inline]
walk_component+0x7ac/0xda0 fs/namei.c:1811
lookup_last fs/namei.c:2274 [inline]
path_lookupat+0x1ff/0x8d0 fs/namei.c:2319
filename_lookup+0x1ac/0x5a0 fs/namei.c:2349
user_path include/linux/namei.h:62 [inline]
do_mount+0x147/0x2f50 fs/namespace.c:2762
ksys_mount+0xcf/0x130 fs/namespace.c:3038
__do_sys_mount fs/namespace.c:3052 [inline]
__se_sys_mount fs/namespace.c:3049 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3049
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fba9d8e6059
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fba9c25b168 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fba9d9f8f60 RCX: 00007fba9d8e6059
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 00007fba9d94008d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe5909a1cf R14: 00007fba9c25b300 R15: 0000000000022000

Allocated by task 5284:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
udf_find_entry+0xa82/0x1070 fs/udf/namei.c:241
udf_lookup fs/udf/namei.c:322 [inline]
udf_lookup+0x156/0x270 fs/udf/namei.c:296
__lookup_slow+0x246/0x4a0 fs/namei.c:1672
lookup_slow fs/namei.c:1689 [inline]
walk_component+0x7ac/0xda0 fs/namei.c:1811
lookup_last fs/namei.c:2274 [inline]
path_lookupat+0x1ff/0x8d0 fs/namei.c:2319
filename_lookup+0x1ac/0x5a0 fs/namei.c:2349
user_path include/linux/namei.h:62 [inline]
do_mount+0x147/0x2f50 fs/namespace.c:2762
ksys_mount+0xcf/0x130 fs/namespace.c:3038
__do_sys_mount fs/namespace.c:3052 [inline]
__se_sys_mount fs/namespace.c:3049 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3049
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4176:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
udf_find_entry+0x49e/0x1070 fs/udf/namei.c:290
udf_lookup fs/udf/namei.c:322 [inline]
udf_lookup+0x156/0x270 fs/udf/namei.c:296
lookup_open+0x698/0x1a20 fs/namei.c:3214
do_last fs/namei.c:3327 [inline]
path_openat+0x1094/0x2df0 fs/namei.c:3537
do_filp_open+0x18c/0x3f0 fs/namei.c:3567
do_sys_open+0x3b3/0x520 fs/open.c:1085
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b2cd9e40
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 210 bytes inside of
256-byte region [ffff8880b2cd9e40, ffff8880b2cd9f40)
The buggy address belongs to the page:
page:ffffea0002cb3640 count:1 mapcount:0 mapping:ffff88813bff07c0 index:0xffff8880b2cd9580
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002a66648 ffffea0002a9e648 ffff88813bff07c0
raw: ffff8880b2cd9580 ffff8880b2cd9080 000000010000000b 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b2cd9e00: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff8880b2cd9e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880b2cd9f00: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
^
ffff8880b2cd9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880b2cda000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
==================================================================
netlink: 8 bytes leftover after parsing attributes in process `syz-executor.1'.


---
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,
Feb 1, 2022, 2:35:22 PM2/1/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11d465f4700000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=96e7e0249bb80cc7065b
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16b19ab7b00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=159d1c8fb00000

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

UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2020/09/19 18:44 (1000)
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in udf_find_entry+0xa33/0x1070 fs/udf/namei.c:251
Write of size 45 at addr ffff8880abdeb892 by task syz-executor314/8087

CPU: 0 PID: 8087 Comm: syz-executor314 Not tainted 4.19.211-syzkaller #0
RIP: 0033:0x7f6edbaac049
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:00007fffb5805a08 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fffb5805a18 RCX: 00007f6edbaac049
RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 00007fffb5805a10 R08: 0000000000000000 R09: 00007f6edba69f50
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8087:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
udf_find_entry+0xa82/0x1070 fs/udf/namei.c:241
udf_lookup fs/udf/namei.c:322 [inline]
udf_lookup+0x156/0x270 fs/udf/namei.c:296
__lookup_slow+0x246/0x4a0 fs/namei.c:1672
lookup_slow fs/namei.c:1689 [inline]
walk_component+0x7ac/0xda0 fs/namei.c:1811
lookup_last fs/namei.c:2274 [inline]
path_lookupat+0x1ff/0x8d0 fs/namei.c:2319
filename_lookup+0x1ac/0x5a0 fs/namei.c:2349
user_path include/linux/namei.h:62 [inline]
do_mount+0x147/0x2f50 fs/namespace.c:2762
ksys_mount+0xcf/0x130 fs/namespace.c:3038
__do_sys_mount fs/namespace.c:3052 [inline]
__se_sys_mount fs/namespace.c:3049 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3049
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7888:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
__do_execve_file+0x171c/0x2360 fs/exec.c:1843
do_execveat_common fs/exec.c:1879 [inline]
do_execve+0x35/0x50 fs/exec.c:1896
__do_sys_execve fs/exec.c:1977 [inline]
__se_sys_execve fs/exec.c:1972 [inline]
__x64_sys_execve+0x7c/0xa0 fs/exec.c:1972
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880abdeb7c0
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 210 bytes inside of
256-byte region [ffff8880abdeb7c0, ffff8880abdeb8c0)
The buggy address belongs to the page:
page:ffffea0002af7ac0 count:1 mapcount:0 mapping:ffff88813bff07c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002b06508 ffffea0002a2f188 ffff88813bff07c0
raw: 0000000000000000 ffff8880abdeb040 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880abdeb780: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff8880abdeb800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880abdeb880: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
^
ffff8880abdeb900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880abdeb980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages