syzbot


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

Status: fixed on 2020/04/15 17:19
Subsystems: net
[Documentation on labels]
Fix commit: 44bfa9c5e5f0 net: rtnetlink: fix bugs in rtnl_alt_ifname()
First crash: 1552d, last: 1552d

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in __in_dev_get_rtnl include/linux/inetdevice.h:236 [inline]
BUG: KASAN: slab-out-of-bounds in inet_gifconf+0x47e/0x490 net/ipv4/devinet.c:1243
Read of size 8 at addr ffff88805f95a318 by task syz-executor.0/30460

CPU: 1 PID: 30460 Comm: syz-executor.0 Not tainted 5.6.0-rc1-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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:641
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
 __in_dev_get_rtnl include/linux/inetdevice.h:236 [inline]
 inet_gifconf+0x47e/0x490 net/ipv4/devinet.c:1243
 dev_ifconf+0xd0/0x230 net/core/dev_ioctl.c:80
 sock_do_ioctl+0x260/0x2f0 net/socket.c:1067
 sock_ioctl+0x3ed/0x790 net/socket.c:1204
 vfs_ioctl fs/ioctl.c:47 [inline]
 ksys_ioctl+0x123/0x180 fs/ioctl.c:763
 __do_sys_ioctl fs/ioctl.c:772 [inline]
 __se_sys_ioctl fs/ioctl.c:770 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45c6c9
Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f3d11886c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f3d118876d4 RCX: 000000000045c6c9
RDX: 0000000000400200 RSI: 0000000000008912 RDI: 0000000000000005
RBP: 000000000076bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000409 R14: 00000000004c6933 R15: 000000000076bf2c

Allocated by task 30424:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:515 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:488
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:523
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc mm/slab.c:3320 [inline]
 kmem_cache_alloc+0x121/0x710 mm/slab.c:3484
 getname_flags fs/namei.c:138 [inline]
 getname_flags+0xd6/0x5b0 fs/namei.c:128
 user_path_at_empty+0x2f/0x50 fs/namei.c:2746
 user_path_at include/linux/namei.h:58 [inline]
 do_faccessat+0x262/0x7f0 fs/open.c:398
 __do_sys_access fs/open.c:450 [inline]
 __se_sys_access fs/open.c:448 [inline]
 __x64_sys_access+0x59/0x80 fs/open.c:448
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 30424:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:337 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:476
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
 __cache_free mm/slab.c:3426 [inline]
 kmem_cache_free+0x86/0x320 mm/slab.c:3694
 putname+0xef/0x130 fs/namei.c:259
 filename_lookup+0x282/0x3e0 fs/namei.c:2475
 user_path_at_empty+0x43/0x50 fs/namei.c:2746
 user_path_at include/linux/namei.h:58 [inline]
 do_faccessat+0x262/0x7f0 fs/open.c:398
 __do_sys_access fs/open.c:450 [inline]
 __se_sys_access fs/open.c:448 [inline]
 __x64_sys_access+0x59/0x80 fs/open.c:448
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88805f95a580
 which belongs to the cache names_cache of size 4096
The buggy address is located 616 bytes to the left of
 4096-byte region [ffff88805f95a580, ffff88805f95b580)
The buggy address belongs to the page:
page:ffffea00017e5680 refcount:1 mapcount:0 mapping:ffff8880aa5f8a80 index:0x0 compound_mapcount: 0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea0002488988 ffffea0001259e88 ffff8880aa5f8a80
raw: 0000000000000000 ffff88805f95a580 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88805f95a200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805f95a280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88805f95a300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                            ^
 ffff88805f95a380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805f95a400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/02/15 20:29 upstream 829e69446995 5d7b90f1 .config console log report ci-upstream-kasan-gce
2020/02/15 18:36 upstream 2019fc96af22 5d7b90f1 .config console log report ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.