syzbot


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

Status: fixed on 2021/02/25 13:45
Reported-by: syzbot+b1f6e434a6d08c7a398d@syzkaller.appspotmail.com
Fix commit: 69396cfd7908 squashfs: add more sanity checks in inode lookup
First crash: 1293d, last: 1190d
Fix bisection: fixed by (bisect log) :
commit 69396cfd7908dee7a833068bcc2d7122ce9264f9
Author: Phillip Lougher <phillip@squashfs.org.uk>
Date: Tue Feb 9 21:41:56 2021 +0000

  squashfs: add more sanity checks in inode lookup

  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in squashfs_export_iget squashfs C done error 3 1215d 1233d 19/26 fixed on 2021/03/10 01:48
linux-4.19 KASAN: slab-out-of-bounds Read in squashfs_export_iget C done 5 1181d 1281d 1/1 fixed on 2021/03/02 19:53
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2021/02/23 20:24 2h15m bisect fix linux-4.14.y job log (1)
2021/01/12 20:39 23m bisect fix linux-4.14.y job log (0) log
2020/12/12 10:27 25m bisect fix linux-4.14.y job log (0) log
2020/11/10 14:04 22m bisect fix linux-4.14.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in squashfs_inode_lookup fs/squashfs/export.c:57 [inline]
BUG: KASAN: slab-out-of-bounds in squashfs_export_iget+0x22f/0x250 fs/squashfs/export.c:82
Read of size 8 at addr ffff8880af8135b8 by task syz-executor102/8023

CPU: 0 PID: 8023 Comm: syz-executor102 Not tainted 4.14.216-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/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 mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
 squashfs_inode_lookup fs/squashfs/export.c:57 [inline]
 squashfs_export_iget+0x22f/0x250 fs/squashfs/export.c:82
 squashfs_fh_to_dentry fs/squashfs/export.c:97 [inline]
 squashfs_fh_to_dentry+0x5f/0x90 fs/squashfs/export.c:90
 exportfs_decode_fh+0x113/0x6c0 fs/exportfs/expfs.c:433
 do_handle_to_path fs/fhandle.c:153 [inline]
 handle_to_path fs/fhandle.c:208 [inline]
 do_handle_open+0x248/0x570 fs/fhandle.c:224
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x444409
RSP: 002b:00007fffe2e371f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000130
RAX: ffffffffffffffda RBX: 00000000004002e0 RCX: 0000000000444409
RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003
RBP: 00000000006cf018 R08: 0000000000000000 R09: 00000000004002e0
R10: 00007fff00000015 R11: 0000000000000246 R12: 0000000000401ff0
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6200:
 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]
 kzalloc include/linux/slab.h:661 [inline]
 aa_alloc_task_context+0x4d/0x90 security/apparmor/context.c:40
 apparmor_cred_prepare+0x1a/0xb0 security/apparmor/lsm.c:84
 security_prepare_creds+0x76/0xb0 security/security.c:1008
 prepare_creds+0x2ef/0x490 kernel/cred.c:282
 SYSC_faccessat fs/open.c:365 [inline]
 SyS_faccessat+0x7b/0x680 fs/open.c:353
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6200:
 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
 aa_free_task_context+0xda/0x130 security/apparmor/context.c:54
 apparmor_cred_free+0x34/0x70 security/apparmor/lsm.c:58
 security_cred_free+0x71/0xb0 security/security.c:1003
 put_cred_rcu+0xe3/0x300 kernel/cred.c:117
 __put_cred+0x1a1/0x210 kernel/cred.c:151
 put_cred include/linux/cred.h:271 [inline]
 SYSC_faccessat fs/open.c:444 [inline]
 SyS_faccessat+0x52a/0x680 fs/open.c:353
 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 ffff8880af813580
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 24 bytes to the right of
 32-byte region [ffff8880af813580, ffff8880af8135a0)
The buggy address belongs to the page:
page:ffffea0002be04c0 count:1 mapcount:0 mapping:ffff8880af813000 index:0xffff8880af813fc1
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880af813000 ffff8880af813fc1 0000000100000020
raw: ffffea0002be5360 ffff88813fe81238 ffff88813fe801c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880af813480: 00 00 fc fc fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8880af813500: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8880af813580: fb fb fb fb fc fc fc fc 00 fc fc fc fc fc fc fc
                                        ^
 ffff8880af813600: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8880af813680: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/01/23 01:25 linux-4.14.y 2762b48e9611 52e37319 .config console log report syz C ci2-linux-4-14 KASAN: slab-out-of-bounds Read in squashfs_export_iget
2020/12/13 17:53 linux-4.14.y 3f2ecb86cb90 bca53db9 .config console log report syz C ci2-linux-4-14
2020/11/12 10:27 linux-4.14.y 27ce4f2a6817 cca87986 .config console log report syz C ci2-linux-4-14
2020/10/11 14:03 linux-4.14.y cbfa1702aaf6 4a77ae0b .config console log report syz C ci2-linux-4-14
* Struck through repros no longer work on HEAD.