syzbot


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

Status: fixed on 2021/03/02 19:53
Reported-by: syzbot+74e86e58b17aedce21b8@syzkaller.appspotmail.com
Fix commit: a6f933a30363 squashfs: add more sanity checks in inode lookup
First crash: 1490d, last: 1390d
Fix bisection: fixed by (bisect log) :
commit a6f933a3036313a3c4b56c68eccbf84d7546b49e
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 1424d 1442d 19/28 fixed on 2021/03/10 01:48
linux-4.14 KASAN: slab-out-of-bounds Read in squashfs_export_iget C done 4 1398d 1502d 1/1 fixed on 2021/02/25 13:45
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2021/03/02 11:43 2h14m bisect fix linux-4.19.y OK (1) job log
2021/01/28 18:15 23m bisect fix linux-4.19.y OK (0) job log log
2020/12/27 20:33 24m bisect fix linux-4.19.y OK (0) job log 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+0x274/0x2a0 fs/squashfs/export.c:82
Read of size 8 at addr ffff8880a9cf6ff8 by task syz-executor246/8082

CPU: 1 PID: 8082 Comm: syz-executor246 Not tainted 4.19.172-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 mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 squashfs_inode_lookup fs/squashfs/export.c:57 [inline]
 squashfs_export_iget+0x274/0x2a0 fs/squashfs/export.c:82
 squashfs_fh_to_dentry fs/squashfs/export.c:97 [inline]
 squashfs_fh_to_dentry+0x78/0xb0 fs/squashfs/export.c:90
 exportfs_decode_fh+0x126/0x7e0 fs/exportfs/expfs.c:433
 do_handle_to_path fs/fhandle.c:152 [inline]
 handle_to_path fs/fhandle.c:207 [inline]
 do_handle_open+0x2f4/0x650 fs/fhandle.c:223
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443c19
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:00007ffefe2873c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000130
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 0000000000443c19
RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003
RBP: 00000000004034b0 R08: 0000000000000000 R09: 00000000004004a0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000403540
R13: 0000000000000000 R14: 00000000004b1018 R15: 00000000004004a0

Allocated by task 7759:
 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 __do_execve_file+0x33b/0x2360 fs/exec.c:1758
 do_execveat_common fs/exec.c:1879 [inline]
 do_execve+0x35/0x50 fs/exec.c:1896
 call_usermodehelper_exec_async+0x50e/0x6a0 kernel/umh.c:116
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 7759:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 __do_execve_file+0x187a/0x2360 fs/exec.c:1862
 do_execveat_common fs/exec.c:1879 [inline]
 do_execve+0x35/0x50 fs/exec.c:1896
 call_usermodehelper_exec_async+0x50e/0x6a0 kernel/umh.c:116
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff8880a9cf6dc0
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 312 bytes to the right of
 256-byte region [ffff8880a9cf6dc0, ffff8880a9cf6ec0)
The buggy address belongs to the page:
page:ffffea0002a73d80 count:1 mapcount:0 mapping:ffff88813bff07c0 index:0xffff8880a9cf6a00
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002a553c8 ffffea0002a518c8 ffff88813bff07c0
raw: ffff8880a9cf6a00 ffff8880a9cf6000 0000000100000005 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a9cf6e80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a9cf6f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a9cf6f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                                ^
 ffff8880a9cf7000: 00 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8880a9cf7080: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/01/31 11:43 linux-4.19.y 811218eceeaa fc9fd31e .config console log report syz C ci2-linux-4-19 KASAN: slab-out-of-bounds Read in squashfs_export_iget
2020/12/29 18:07 linux-4.19.y 13d2ce42de8c 80910769 .config console log report syz C ci2-linux-4-19
2020/11/27 20:09 linux-4.19.y 0c88e405c97e 486f93ef .config console log report syz C ci2-linux-4-19
2020/10/23 10:07 linux-4.19.y ad326970d25c 4e740c00 .config console log report syz C ci2-linux-4-19
2020/11/08 16:46 linux-4.19.y b94de4d19498 cba33199 .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.