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

33 views
Skip to first unread message

syzbot

unread,
Sep 22, 2020, 3:00:21 AM9/22/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cbfa1702 Linux 4.14.198
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=148bc8d3900000
kernel config: https://syzkaller.appspot.com/x/.config?x=3990958d85b55e59
dashboard link: https://syzkaller.appspot.com/bug?extid=bcbc661df46657d0fa4f
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11fe6f8b900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=104850d3900000

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

audit: type=1400 audit(1600757858.237:8): avc: denied { execmem } for pid=6344 comm="syz-executor101" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in squashfs_get_id+0x181/0x1a0 fs/squashfs/id.c:51
Read of size 8 at addr ffff88809fbd46b8 by task syz-executor101/6344

CPU: 1 PID: 6344 Comm: syz-executor101 Not tainted 4.14.198-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
squashfs_get_id+0x181/0x1a0 fs/squashfs/id.c:51
squashfs_new_inode fs/squashfs/inode.c:68 [inline]
squashfs_read_inode+0x1a2/0x1840 fs/squashfs/inode.c:133
squashfs_fill_super+0x1138/0x1640 fs/squashfs/super.c:318
mount_bdev+0x2b3/0x360 fs/super.c:1134
mount_fs+0x92/0x2a0 fs/super.c:1237
vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
vfs_kern_mount fs/namespace.c:1036 [inline]
do_new_mount fs/namespace.c:2549 [inline]
do_mount+0xe53/0x2a00 fs/namespace.c:2879
SYSC_mount fs/namespace.c:3095 [inline]
SyS_mount+0xa8/0x120 fs/namespace.c:3072
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x446d2a
RSP: 002b:00007ffcd9ed2558 EFLAGS: 00000293 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffcd9ed25b0 RCX: 0000000000446d2a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffcd9ed2570
RBP: 00007ffcd9ed2570 R08: 00007ffcd9ed25b0 R09: 00007ffc00000015
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000001
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003

Allocated by task 6344:
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
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15a/0x400 mm/slab.c:3729
kmalloc_array include/linux/slab.h:607 [inline]
kcalloc include/linux/slab.h:618 [inline]
squashfs_read_data+0x153/0x1140 fs/squashfs/block.c:100
squashfs_read_table+0x11c/0x18d fs/squashfs/cache.c:445
squashfs_read_xattr_id_table+0x16d/0x1c0 fs/squashfs/xattr_id.c:94
squashfs_fill_super+0xcba/0x1640 fs/squashfs/super.c:233
mount_bdev+0x2b3/0x360 fs/super.c:1134
mount_fs+0x92/0x2a0 fs/super.c:1237
vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
vfs_kern_mount fs/namespace.c:1036 [inline]
do_new_mount fs/namespace.c:2549 [inline]
do_mount+0xe53/0x2a00 fs/namespace.c:2879
SYSC_mount fs/namespace.c:3095 [inline]
SyS_mount+0xa8/0x120 fs/namespace.c:3072
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6344:
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
squashfs_read_data+0x931/0x1140 fs/squashfs/block.c:205
squashfs_read_table+0x11c/0x18d fs/squashfs/cache.c:445
squashfs_read_xattr_id_table+0x16d/0x1c0 fs/squashfs/xattr_id.c:94
squashfs_fill_super+0xcba/0x1640 fs/squashfs/super.c:233
mount_bdev+0x2b3/0x360 fs/super.c:1134
mount_fs+0x92/0x2a0 fs/super.c:1237
vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
vfs_kern_mount fs/namespace.c:1036 [inline]
do_new_mount fs/namespace.c:2549 [inline]
do_mount+0xe53/0x2a00 fs/namespace.c:2879
SYSC_mount fs/namespace.c:3095 [inline]
SyS_mount+0xa8/0x120 fs/namespace.c:3072
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff88809fbd4680
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 24 bytes to the right of
32-byte region [ffff88809fbd4680, ffff88809fbd46a0)
The buggy address belongs to the page:
page:ffffea00027ef500 count:1 mapcount:0 mapping:ffff88809fbd4000 index:0xffff88809fbd4fc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88809fbd4000 ffff88809fbd4fc1 0000000100000039
raw: ffffea0002841aa0 ffffea00027900a0 ffff88812fe501c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809fbd4580: fb fb fb fb fc fc fc fc 00 fc fc fc fc fc fc fc
ffff88809fbd4600: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff88809fbd4680: fb fb fb fb fc fc fc fc 00 04 fc fc fc fc fc fc
^
ffff88809fbd4700: 00 04 fc fc fc fc fc fc 00 04 fc fc fc fc fc fc
ffff88809fbd4780: 00 04 fc fc fc fc fc fc 00 04 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 can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Sep 24, 2020, 4:21:23 AM9/24/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d09b8017 Linux 4.19.147
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=110f02bb900000
kernel config: https://syzkaller.appspot.com/x/.config?x=47cc70be3c316a0a
dashboard link: https://syzkaller.appspot.com/bug?extid=5024636e8b5fd19f0f19
compiler: gcc (GCC) 10.1.0-syz 20200507

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+502463...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in squashfs_get_id+0x1bc/0x1f0 fs/squashfs/id.c:51
Read of size 8 at addr ffff8880a748b960 by task syz-executor.1/31223

CPU: 0 PID: 31223 Comm: syz-executor.1 Not tainted 4.19.147-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+0x22c/0x33e lib/dump_stack.c:118
print_address_description.cold+0x56/0x25c mm/kasan/report.c:256
kasan_report_error.cold+0x66/0xb9 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
squashfs_get_id+0x1bc/0x1f0 fs/squashfs/id.c:51
squashfs_new_inode fs/squashfs/inode.c:64 [inline]
squashfs_read_inode+0x197/0x1940 fs/squashfs/inode.c:133
squashfs_fill_super+0x1277/0x190a fs/squashfs/super.c:318
mount_bdev+0x2fc/0x3b0 fs/super.c:1158
mount_fs+0xa3/0x318 fs/super.c:1261
vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
vfs_kern_mount fs/namespace.c:951 [inline]
do_new_mount fs/namespace.c:2469 [inline]
do_mount+0x51c/0x2f10 fs/namespace.c:2799
ksys_mount+0xcf/0x130 fs/namespace.c:3015
__do_sys_mount fs/namespace.c:3029 [inline]
__se_sys_mount fs/namespace.c:3026 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3026
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x460bca
Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 dd 87 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 ba 87 fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007fc4e4cfea88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fc4e4cfeb20 RCX: 0000000000460bca
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fc4e4cfeae0
RBP: 00007fc4e4cfeae0 R08: 00007fc4e4cfeb20 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 0000000020000200 R15: 0000000020010300

Allocated by task 4599:
__do_kmalloc mm/slab.c:3727 [inline]
__kmalloc_track_caller+0x155/0x4e0 mm/slab.c:3742
kstrdup+0x36/0x70 mm/util.c:56
simple_xattr_set+0x57/0x5c0 fs/xattr.c:952
__vfs_setxattr+0x10e/0x170 fs/xattr.c:149
__vfs_setxattr_noperm+0x11a/0x420 fs/xattr.c:180
__vfs_setxattr_locked+0x176/0x250 fs/xattr.c:238
vfs_setxattr+0xe5/0x270 fs/xattr.c:255
setxattr+0x23d/0x330 fs/xattr.c:520
path_setxattr+0x170/0x190 fs/xattr.c:539
__do_sys_lsetxattr fs/xattr.c:561 [inline]
__se_sys_lsetxattr fs/xattr.c:557 [inline]
__x64_sys_lsetxattr+0xbd/0x150 fs/xattr.c:557
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4624:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x250 mm/slab.c:3822
security_context_to_sid_core+0x2ed/0x610 security/selinux/ss/services.c:1504
security_context_to_sid+0x35/0x40 security/selinux/ss/services.c:1525
selinux_inode_setsecurity+0x197/0x3d0 security/selinux/hooks.c:3501
selinux_inode_notifysecctx+0x2b/0x60 security/selinux/hooks.c:6667
security_inode_notifysecctx+0x50/0xb0 security/security.c:1343
kernfs_refresh_inode+0x328/0x4b0 fs/kernfs/inode.c:195
kernfs_iop_permission+0x6a/0xb0 fs/kernfs/inode.c:302
do_inode_permission fs/namei.c:386 [inline]
inode_permission+0x34e/0x540 fs/namei.c:451
may_lookup fs/namei.c:1703 [inline]
link_path_walk.part.0+0x952/0x1230 fs/namei.c:2085
link_path_walk fs/namei.c:2270 [inline]
path_lookupat+0xe4/0x8d0 fs/namei.c:2318
filename_lookup+0x1ac/0x5a0 fs/namei.c:2349
user_path_at include/linux/namei.h:57 [inline]
vfs_statx+0x113/0x210 fs/stat.c:185
vfs_lstat include/linux/fs.h:3138 [inline]
__do_sys_newlstat fs/stat.c:350 [inline]
__se_sys_newlstat+0x96/0x120 fs/stat.c:344
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a748b940
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes to the right of
32-byte region [ffff8880a748b940, ffff8880a748b960)
The buggy address belongs to the page:
page:ffffea00029d22c0 count:1 mapcount:0 mapping:ffff88812c3f61c0 index:0xffff8880a748bfc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea000293b9c8 ffffea00021c6248 ffff88812c3f61c0
raw: ffff8880a748bfc1 ffff8880a748b000 0000000100000035 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a748b800: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880a748b880: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
>ffff8880a748b900: 00 fc fc fc fc fc fc fc 00 00 01 fc fc fc fc fc
^
ffff8880a748b980: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880a748ba00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc

syzbot

unread,
Sep 24, 2020, 4:33:21 AM9/24/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: d09b8017 Linux 4.19.147
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1056dc8d900000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=113f904b900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13b8bdab900000

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

audit: type=1400 audit(1600936260.742:8): avc: denied { execmem } for pid=6477 comm="syz-executor100" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in squashfs_get_id+0x1bc/0x1f0 fs/squashfs/id.c:51
Read of size 8 at addr ffff8880a48b7c20 by task syz-executor100/6477

CPU: 1 PID: 6477 Comm: syz-executor100 Not tainted 4.19.147-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+0x22c/0x33e lib/dump_stack.c:118
print_address_description.cold+0x56/0x25c mm/kasan/report.c:256
kasan_report_error.cold+0x66/0xb9 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
squashfs_get_id+0x1bc/0x1f0 fs/squashfs/id.c:51
squashfs_new_inode fs/squashfs/inode.c:64 [inline]
squashfs_read_inode+0x197/0x1940 fs/squashfs/inode.c:133
squashfs_fill_super+0x1277/0x190a fs/squashfs/super.c:318
mount_bdev+0x2fc/0x3b0 fs/super.c:1158
mount_fs+0xa3/0x318 fs/super.c:1261
vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
vfs_kern_mount fs/namespace.c:951 [inline]
do_new_mount fs/namespace.c:2469 [inline]
do_mount+0x51c/0x2f10 fs/namespace.c:2799
ksys_mount+0xcf/0x130 fs/namespace.c:3015
__do_sys_mount fs/namespace.c:3029 [inline]
__se_sys_mount fs/namespace.c:3026 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3026
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446d2a
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd ad fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da ad fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007fffa7a6e2c8 EFLAGS: 00000293 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fffa7a6e320 RCX: 0000000000446d2a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fffa7a6e2e0
RBP: 00007fffa7a6e2e0 R08: 00007fffa7a6e320 R09: 00007fff00000015
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000001
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003

Allocated by task 4679:
kmem_cache_alloc_trace+0x12f/0x4b0 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
proc_thread_self_get_link+0x185/0x1e0 fs/proc/thread_self.c:22
get_link fs/namei.c:1078 [inline]
link_path_walk.part.0+0xdaf/0x1230 fs/namei.c:2148
link_path_walk fs/namei.c:2073 [inline]
path_openat+0x21d/0x2e90 fs/namei.c:3536
do_filp_open+0x18c/0x3f0 fs/namei.c:3567
do_sys_open+0x3b3/0x520 fs/open.c:1085
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4679:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x250 mm/slab.c:3822
do_delayed_call include/linux/delayed_call.h:28 [inline]
put_link fs/namei.c:883 [inline]
step_into fs/namei.c:1773 [inline]
walk_component+0x204/0xda0 fs/namei.c:1830
link_path_walk.part.0+0x541/0x1230 fs/namei.c:2139
link_path_walk fs/namei.c:2073 [inline]
path_openat+0x21d/0x2e90 fs/namei.c:3536
do_filp_open+0x18c/0x3f0 fs/namei.c:3567
do_sys_open+0x3b3/0x520 fs/open.c:1085
do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a48b7c00
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes to the right of
32-byte region [ffff8880a48b7c00, ffff8880a48b7c20)
The buggy address belongs to the page:
page:ffffea0002922dc0 count:1 mapcount:0 mapping:ffff88812c3f61c0 index:0xffff8880a48b7fc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002935148 ffffea000293bc08 ffff88812c3f61c0
raw: ffff8880a48b7fc1 ffff8880a48b7000 000000010000003e 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a48b7b00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880a48b7b80: fb fb fb fb fc fc fc fc 00 fc fc fc fc fc fc fc
>ffff8880a48b7c00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
^
ffff8880a48b7c80: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
ffff8880a48b7d00: 00 00 01 fc fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages