syzbot


KASAN: slab-out-of-bounds Read in string (2)

Status: fixed on 2018/10/11 14:33
Subsystems: overlayfs
[Documentation on labels]
Reported-by: syzbot+376cea2b0ef340db3dd4@syzkaller.appspotmail.com
Fix commit: 601350ff58d5 ovl: fix access beyond unterminated strings
First crash: 2009d, last: 2002d
Discussions (4)
Title Replies (including bot) Last reply
KASAN: slab-out-of-bounds Read in string (2) 8 (9) 2018/10/25 16:19
[PATCH 4.14 00/94] 4.14.75-stable review 102 (102) 2018/10/10 07:42
[PATCH 4.18 000/168] 4.18.13-stable review 180 (180) 2018/10/10 05:52
[PATCH] fs: fix access beyond unterminated strings in prints 4 (4) 2018/10/04 15:05
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: slab-out-of-bounds Read in string C 37 2253d 1812d 0/3 public: reported C repro on 2019/04/13 00:00
upstream KASAN: slab-out-of-bounds Read in string (3) usb media syz 3 1794d 1794d 0/26 closed as invalid on 2019/05/03 14:05
upstream KASAN: slab-out-of-bounds Read in string kernel C 129 2245d 2255d 4/26 fixed on 2018/02/14 17:52

Sample crash report:
encrypted_key: master key parameter '' is invalid
EXT4-fs (sda1): re-mounted. Opts: ,errors=continue
==================================================================
BUG: KASAN: slab-out-of-bounds in string+0x298/0x2d0 lib/vsprintf.c:604
Read of size 1 at addr ffff8801c339a7ba by task syz-executor1/4117

CPU: 0 PID: 4117 Comm: syz-executor1 Not tainted 4.19.0-rc6+ #44
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+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 string+0x298/0x2d0 lib/vsprintf.c:604
 vsnprintf+0x48e/0x1b60 lib/vsprintf.c:2293
 vscnprintf+0x2d/0x80 lib/vsprintf.c:2396
 vprintk_store+0x43/0x510 kernel/printk/printk.c:1847
 vprintk_emit+0x1c1/0x930 kernel/printk/printk.c:1905
 vprintk_default+0x28/0x30 kernel/printk/printk.c:1963
 vprintk_func+0x7e/0x181 kernel/printk/printk_safe.c:398
 printk+0xa7/0xcf kernel/printk/printk.c:1996
 ovl_lookup_index.cold.14+0xe8/0x1f8 fs/overlayfs/namei.c:689
 ovl_lookup+0x9f2/0x29c0 fs/overlayfs/namei.c:1022
 lookup_open+0x72e/0x1b90 fs/namei.c:3213
 do_last fs/namei.c:3324 [inline]
 path_openat+0x252d/0x5160 fs/namei.c:3534
 do_filp_open+0x255/0x380 fs/namei.c:3564
 do_sys_open+0x568/0x700 fs/open.c:1063
 __do_sys_openat fs/open.c:1090 [inline]
 __se_sys_openat fs/open.c:1084 [inline]
 __x64_sys_openat+0x9d/0x100 fs/open.c:1084
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457579
Code: 1d b4 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 eb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f776a659c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f776a659c90 RCX: 0000000000457579
RDX: 0000000000003326 RSI: 0000000020000200 RDI: ffffffffffffff9c
RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f776a65a6d4
R13: 00000000004c2b7f R14: 00000000004d41b8 R15: 0000000000000004

Allocated by task 4117:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc+0x14e/0x760 mm/slab.c:3727
 kmalloc_array include/linux/slab.h:635 [inline]
 kcalloc include/linux/slab.h:646 [inline]
 ovl_get_index_name_fh+0x57/0x180 fs/overlayfs/namei.c:596
 ovl_get_index_name+0x5c/0x80 fs/overlayfs/namei.c:631
 ovl_lookup_index+0xe4/0x700 fs/overlayfs/namei.c:678
 ovl_lookup+0x9f2/0x29c0 fs/overlayfs/namei.c:1022
 lookup_open+0x72e/0x1b90 fs/namei.c:3213
 do_last fs/namei.c:3324 [inline]
 path_openat+0x252d/0x5160 fs/namei.c:3534
 do_filp_open+0x255/0x380 fs/namei.c:3564
 do_sys_open+0x568/0x700 fs/open.c:1063
 __do_sys_openat fs/open.c:1090 [inline]
 __se_sys_openat fs/open.c:1084 [inline]
 __x64_sys_openat+0x9d/0x100 fs/open.c:1084
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 10484:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3813
 __vunmap+0x335/0x460 mm/vmalloc.c:1532
 vfree+0x68/0x100 mm/vmalloc.c:1593
 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:886 [inline]
 get_entries net/ipv6/netfilter/ip6_tables.c:1044 [inline]
 do_ip6t_get_ctl+0xa1e/0xbf0 net/ipv6/netfilter/ip6_tables.c:1712
 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline]
 nf_getsockopt+0x80/0xe0 net/netfilter/nf_sockopt.c:122
 ipv6_getsockopt+0x1f0/0x320 net/ipv6/ipv6_sockglue.c:1381
 tcp_getsockopt+0x93/0xe0 net/ipv4/tcp.c:3583
 sock_common_getsockopt+0x9a/0xe0 net/core/sock.c:2997
 __sys_getsockopt+0x1ad/0x390 net/socket.c:1939
 __do_sys_getsockopt net/socket.c:1950 [inline]
 __se_sys_getsockopt net/socket.c:1947 [inline]
 __x64_sys_getsockopt+0xbe/0x150 net/socket.c:1947
 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 ffff8801c339a780
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 58 bytes inside of
 64-byte region [ffff8801c339a780, ffff8801c339a7c0)
The buggy address belongs to the page:
page:ffffea00070ce680 count:1 mapcount:0 mapping:ffff8801da800340 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea0006f53cc8 ffffea0007037a48 ffff8801da800340
raw: 0000000000000000 ffff8801c339a000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c339a680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801c339a700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801c339a780: 00 00 00 00 00 00 00 02 fc fc fc fc fc fc fc fc
                                        ^
 ffff8801c339a800: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801c339a880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/10/04 23:32 upstream 10be83cc6418 8b311eaf .config console log report ci-upstream-kasan-gce-smack-root
2018/10/04 14:03 upstream cec4de302c5f 8b311eaf .config console log report ci-upstream-kasan-gce-smack-root
2018/10/04 14:01 upstream cec4de302c5f 8b311eaf .config console log report ci-upstream-kasan-gce-root
2018/10/04 11:32 upstream cec4de302c5f 8b311eaf .config console log report ci-upstream-kasan-gce-smack-root
2018/10/04 07:57 upstream cec4de302c5f 8b311eaf .config console log report ci-upstream-kasan-gce-root
2018/10/03 21:52 upstream 6bebe37927f3 8b311eaf .config console log report ci-upstream-kasan-gce-root
2018/09/28 02:15 upstream c127e59bee3e 0c2fa87b .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/05 00:32 linux-next 25bcda3e8b9f 8b311eaf .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/03 22:02 linux-next 8f84a21675f0 8b311eaf .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/03 21:47 linux-next 8f84a21675f0 8b311eaf .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/03 21:47 linux-next 8f84a21675f0 8b311eaf .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/03 21:24 linux-next 8f84a21675f0 8b311eaf .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/03 07:34 linux-next 62f3d25900c9 0f3e0261 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/02 20:38 linux-next 62f3d25900c9 a316a2af .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.