syzbot


KASAN: invalid-free in fat_fill_super

Status: fixed on 2018/08/08 18:10
Subsystems: exfat
[Documentation on labels]
Reported-by: syzbot+90b8e10515ae88228a92@syzkaller.appspotmail.com
Fix commit: 35033ab988c3 fat: fix memory allocation failure handling of match_strdup()
First crash: 2173d, last: 2173d
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 3.16 000/366] 3.16.61-rc1 review 375 (376) 2019/01/02 17:44
[PATCH 4.4 000/107] 4.4.144-stable review 111 (111) 2018/09/17 11:53
[PATCH 3.18 00/27] 3.18.117-stable review 32 (32) 2018/07/27 20:25
[PATCH 4.17 00/63] 4.17.10-stable review 62 (62) 2018/07/25 19:19
[PATCH 4.14 00/44] 4.14.58-stable review 42 (42) 2018/07/24 15:58
[PATCH 4.9 00/28] 4.9.115-stable review 28 (28) 2018/07/24 15:57
[PATCH] fat: Fix memory allocation failure handling of match_strdup() 1 (1) 2018/07/12 06:15
KASAN: invalid-free in fat_fill_super 0 (1) 2018/07/11 19:59

Sample crash report:
RDX: 00007fd0b961ead0 RSI: 0000000020000080 RDI: 00007fd0b961eaf0
RBP: 0000000020000080 R08: 00007fd0b961eb30 R09: 00007fd0b961ead0
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000015
R13: 0000000000000000 R14: 00000000004d3fd0 R15: 000000000000004a
==================================================================
BUG: KASAN: double-free or invalid-free in fat_fill_super+0xc84/0x4400 fs/fat/inode.c:1882

CPU: 1 PID: 31888 Comm: syz-executor6 Not tainted 4.18.0-rc4-next-20180711+ #4
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+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_invalid_free+0x64/0xa0 mm/kasan/report.c:336
 __kasan_slab_free+0x150/0x170 mm/kasan/kasan.c:501
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 fat_fill_super+0xc84/0x4400 fs/fat/inode.c:1882
 vfat_fill_super+0x31/0x40 fs/fat/namei_vfat.c:1049
 mount_bdev+0x314/0x3e0 fs/super.c:1344
 vfat_mount+0x3c/0x50 fs/fat/namei_vfat.c:1056
 legacy_get_tree+0x118/0x440 fs/fs_context.c:659
 vfs_get_tree+0x1cb/0x5c0 fs/super.c:1743
 do_new_mount fs/namespace.c:2567 [inline]
 do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
 ksys_mount+0x12d/0x140 fs/namespace.c:3105
 __do_sys_mount fs/namespace.c:3119 [inline]
 __se_sys_mount fs/namespace.c:3116 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45885a
Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 dd 8f 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 8f fb ff c3 66 0f 1f 84 00 00 00 00 00 
RSP: 002b:00007fd0b961ea88 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fd0b961eb30 RCX: 000000000045885a
RDX: 00007fd0b961ead0 RSI: 0000000020000080 RDI: 00007fd0b961eaf0
RBP: 0000000020000080 R08: 00007fd0b961eb30 R09: 00007fd0b961ead0
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000015
R13: 0000000000000000 R14: 00000000004d3fd0 R15: 000000000000004a

Allocated by task 31888:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc+0x14e/0x760 mm/slab.c:3727
 kmalloc include/linux/slab.h:518 [inline]
 match_strdup+0x5e/0xa0 lib/parser.c:331
 parse_options+0xc7d/0x1a10 fs/fat/inode.c:1291
 fat_fill_super+0x2b3/0x4400 fs/fat/inode.c:1631
 vfat_fill_super+0x31/0x40 fs/fat/namei_vfat.c:1049
 mount_bdev+0x314/0x3e0 fs/super.c:1344
 vfat_mount+0x3c/0x50 fs/fat/namei_vfat.c:1056
 legacy_get_tree+0x118/0x440 fs/fs_context.c:659
 vfs_get_tree+0x1cb/0x5c0 fs/super.c:1743
 do_new_mount fs/namespace.c:2567 [inline]
 do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
 ksys_mount+0x12d/0x140 fs/namespace.c:3105
 __do_sys_mount fs/namespace.c:3119 [inline]
 __se_sys_mount fs/namespace.c:3116 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31888:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 parse_options+0xc70/0x1a10 fs/fat/inode.c:1290
 fat_fill_super+0x2b3/0x4400 fs/fat/inode.c:1631
 vfat_fill_super+0x31/0x40 fs/fat/namei_vfat.c:1049
 mount_bdev+0x314/0x3e0 fs/super.c:1344
 vfat_mount+0x3c/0x50 fs/fat/namei_vfat.c:1056
 legacy_get_tree+0x118/0x440 fs/fs_context.c:659
 vfs_get_tree+0x1cb/0x5c0 fs/super.c:1743
 do_new_mount fs/namespace.c:2567 [inline]
 do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
 ksys_mount+0x12d/0x140 fs/namespace.c:3105
 __do_sys_mount fs/namespace.c:3119 [inline]
 __se_sys_mount fs/namespace.c:3116 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff880190d60c80
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff880190d60c80, ffff880190d60ca0)
The buggy address belongs to the page:
page:ffffea0006435800 count:1 mapcount:0 mapping:ffff8801da8001c0 index:0xffff880190d60fc1
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00073fe648 ffffea00060af588 ffff8801da8001c0
raw: ffff880190d60fc1 ffff880190d60000 000000010000000d 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff880190d60b80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff880190d60c00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff880190d60c80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                   ^
 ffff880190d60d00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff880190d60d80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/07/11 08:33 linux-next 98be45067040 2e0e3130 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.