KASAN: use-after-free Read in get_block

Status: fixed on 2020/09/11 09:49
Fix commit: 954fc7da99a9 fs/minix: reject too-large maximum file size
First crash: 815d, last: 683d

Fix bisection: fixed by (bisect log) :
commit 954fc7da99a9513d5e6b3ccf38f6f7c9af5a276d
Author: Eric Biggers <>
Date: Wed Aug 12 01:35:30 2020 +0000

  fs/minix: reject too-large maximum file size

similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in get_block C done 8 683d 808d 1/1 fixed on 2020/09/11 21:52
upstream KASAN: use-after-free Read in get_block C done 23 713d 790d 17/22 fixed on 2020/09/16 22:51

Sample crash report:
audit: type=1800 audit(1594578075.345:10): pid=6420 uid=0 auid=0 ses=5 subj=system_u:system_r:kernel_t:s0 op=collect_data cause=failed(directio) comm="syz-executor687" name="file0" dev="sda1" ino=15710 res=0
MINIX-fs: mounting unchecked file system, running fsck is recommended
Process accounting resumed
BUG: KASAN: use-after-free in add_chain fs/minix/itree_common.c:14 [inline]
BUG: KASAN: use-after-free in get_branch fs/minix/itree_common.c:52 [inline]
BUG: KASAN: use-after-free in get_block+0x1085/0x1340 fs/minix/itree_common.c:160
Read of size 2 at addr ffff88808fc1118a by task syz-executor687/6420
Process accounting resumed

CPU: 0 PID: 6420 Comm: syz-executor687 Not tainted 4.19.132-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/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load2_noabort+0x88/0x90 mm/kasan/report.c:431
 add_chain fs/minix/itree_common.c:14 [inline]
 get_branch fs/minix/itree_common.c:52 [inline]
 get_block+0x1085/0x1340 fs/minix/itree_common.c:160
 minix_get_block+0xe5/0x110 fs/minix/inode.c:379
 __block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978
 __block_write_begin fs/buffer.c:2028 [inline]
 block_write_begin+0x58/0x2e0 fs/buffer.c:2087
 minix_write_begin+0x35/0x220 fs/minix/inode.c:415
 generic_perform_write+0x1f8/0x4d0 mm/filemap.c:3162
 __generic_file_write_iter+0x24b/0x610 mm/filemap.c:3287
 generic_file_write_iter+0x3f8/0x729 mm/filemap.c:3315
 call_write_iter include/linux/fs.h:1821 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x51b/0x770 fs/read_write.c:487
 __kernel_write+0x109/0x370 fs/read_write.c:506
 do_acct_process+0xcbe/0x10c0 kernel/acct.c:520
 acct_pin_kill+0x29/0xf0 kernel/acct.c:174
 pin_kill+0x174/0x7b0 fs/fs_pin.c:50
 acct_on kernel/acct.c:254 [inline]
 __do_sys_acct kernel/acct.c:286 [inline]
 __se_sys_acct+0x5cd/0x930 kernel/acct.c:273
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
RIP: 0033:0x449ef9
Code: fd d5 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 cb d5 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fc3a9aa9ce8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a3
RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 0000000000449ef9
RDX: 0000000000449ef9 RSI: c9958716e52996e0 RDI: 0000000020000480
RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c
R13: 00007ffcb065c67f R14: 00007fc3a9aaa9c0 R15: 20c49ba5e353f7cf

Allocated by task 4478:
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __kmalloc_node_track_caller+0x4c/0x70 mm/slab.c:3703
 __kmalloc_reserve net/core/skbuff.c:137 [inline]
 __alloc_skb+0xae/0x560 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:995 [inline]
 alloc_uevent_skb+0x7b/0x210 lib/kobject_uevent.c:288
 uevent_net_broadcast_untagged lib/kobject_uevent.c:324 [inline]
 kobject_uevent_net_broadcast lib/kobject_uevent.c:406 [inline]
 kobject_uevent_env+0x911/0x1220 lib/kobject_uevent.c:590
 kobject_synth_uevent+0x700/0x814 lib/kobject_uevent.c:208
 uevent_store+0x21/0x70 drivers/base/core.c:1242
 dev_attr_store+0x56/0x80 drivers/base/core.c:951
 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:139
 kernfs_fop_write+0x2b0/0x470 fs/kernfs/file.c:316
 __vfs_write+0xf7/0x770 fs/read_write.c:485
 vfs_write+0x1f3/0x540 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293

Freed by task 3693:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 skb_free_head net/core/skbuff.c:554 [inline]
 skb_release_data+0x6de/0x920 net/core/skbuff.c:574
 skb_release_all net/core/skbuff.c:631 [inline]
 __kfree_skb net/core/skbuff.c:645 [inline]
 consume_skb+0x113/0x3d0 net/core/skbuff.c:705
 skb_free_datagram+0x16/0xf0 net/core/datagram.c:329
 netlink_recvmsg+0x627/0xea0 net/netlink/af_netlink.c:1988
 sock_recvmsg_nosec net/socket.c:795 [inline]
 sock_recvmsg net/socket.c:802 [inline]
 sock_recvmsg+0xca/0x110 net/socket.c:798
 ___sys_recvmsg+0x255/0x570 net/socket.c:2277
 __sys_recvmsg net/socket.c:2326 [inline]
 __do_sys_recvmsg net/socket.c:2336 [inline]
 __se_sys_recvmsg net/socket.c:2333 [inline]
 __x64_sys_recvmsg+0x12f/0x220 net/socket.c:2333
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293

The buggy address belongs to the object at ffff88808fc110c0
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 202 bytes inside of
 512-byte region [ffff88808fc110c0, ffff88808fc112c0)
The buggy address belongs to the page:
page:ffffea00023f0440 count:1 mapcount:0 mapping:ffff88812c39c940 index:0xffff88808fc11340
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002427a88 ffffea000241b788 ffff88812c39c940
raw: ffff88808fc11340 ffff88808fc110c0 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808fc11080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff88808fc11100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808fc11180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808fc11200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808fc11280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc

Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2020/07/12 18:23 linux-4.19.y dce0f88600e4 115e1930 .config log report syz C
ci2-linux-4-19 2020/05/19 15:03 linux-4.19.y 258f0cf7ac3b 6d882fd2 .config log report syz C
ci2-linux-4-19 2020/05/05 00:57 linux-4.19.y fdc072324f3c 9941337c .config log report syz C
ci2-linux-4-19 2020/05/03 14:22 linux-4.19.y fdc072324f3c 58ae5e18 .config log report syz C
ci2-linux-4-19 2020/05/02 06:08 linux-4.19.y 765675379b62 bc734e7a .config log report syz C
ci2-linux-4-19 2020/04/02 01:59 linux-4.19.y 54b4fa6d3955 a34e2c33 .config log report syz C