syzbot


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

Status: public: reported C repro on 2019/04/11 08:44
Reported-by: syzbot+46530a490754b49ce033@syzkaller.appspotmail.com
First crash: 2492d, last: 2490d

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read, 125 bits of entropy available)
==================================================================
BUG: KASAN: slab-out-of-bounds in strnlen+0xc1/0xd0 lib/string.c:498
Read of size 1 at addr ffff8800b415aad0 by task syzkaller338142/3316

CPU: 0 PID: 3316 Comm: syzkaller338142 Not tainted 4.4.113-ge70c132 #34
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 0000000000000000 14f2d61e3e3a496e ffff8800b43df718 ffffffff81d0278d
 ffffea0002d05680 ffff8800b415aad0 0000000000000000 ffff8800b415aad0
 ffff8800b43df9e8 ffff8800b43df750 ffffffff814fd053 ffff8800b415aad0
Call Trace:
 [<ffffffff81d0278d>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d0278d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff814fd053>] print_address_description+0x73/0x260 mm/kasan/report.c:252
 [<ffffffff814fd565>] kasan_report_error mm/kasan/report.c:351 [inline]
 [<ffffffff814fd565>] kasan_report+0x285/0x370 mm/kasan/report.c:408
 [<ffffffff814fd664>] __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:426
 [<ffffffff81d1e171>] strnlen+0xc1/0xd0 lib/string.c:498
 [<ffffffff81d25dfc>] string.isra.4+0x4c/0x240 lib/vsprintf.c:518
 [<ffffffff81d2b2a6>] vsnprintf+0x766/0x15f0 lib/vsprintf.c:1907
 [<ffffffff8117160f>] __request_module+0x14f/0x810 kernel/kmod.c:146
 [<ffffffff8302c64b>] xt_request_find_target+0x8b/0xb0 net/netfilter/x_tables.c:255
 [<ffffffff832690d1>] find_check_entry net/ipv4/netfilter/ip_tables.c:685 [inline]
 [<ffffffff832690d1>] translate_table+0x12c1/0x1cf0 net/ipv4/netfilter/ip_tables.c:872
 [<ffffffff810002b8>] ? 0xffffffff810002b8
 [<ffffffff8326bc53>] do_replace net/ipv4/netfilter/ip_tables.c:1289 [inline]
 [<ffffffff8326bc53>] do_ipt_set_ctl+0x2a3/0x450 net/ipv4/netfilter/ip_tables.c:1852
 [<ffffffff82f94d77>] nf_sockopt net/netfilter/nf_sockopt.c:105 [inline]
 [<ffffffff82f94d77>] nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:114
 [<ffffffff830fc1c1>] ip_setsockopt+0xa1/0xb0 net/ipv4/ip_sockglue.c:1226
 [<ffffffff831a2005>] udp_setsockopt+0x45/0x80 net/ipv4/udp.c:2154
 [<ffffffff82df0645>] sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2659
 [<ffffffff82ded730>] SYSC_setsockopt net/socket.c:1767 [inline]
 [<ffffffff82ded730>] SyS_setsockopt+0x160/0x250 net/socket.c:1746
 [<ffffffff83771b5f>] entry_SYSCALL_64_fastpath+0x1c/0x98

Allocated by task 3316:
 [<ffffffff81035df6>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814fc0c3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814fc38d>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814fc38d>] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:616
 [<ffffffff814f8674>] __kmalloc+0x124/0x320 mm/slub.c:3613
 [<ffffffff8302de91>] kmalloc include/linux/slab.h:481 [inline]
 [<ffffffff8302de91>] xt_alloc_table_info+0x71/0x100 net/netfilter/x_tables.c:911
 [<ffffffff8326bbe2>] do_replace net/ipv4/netfilter/ip_tables.c:1278 [inline]
 [<ffffffff8326bbe2>] do_ipt_set_ctl+0x232/0x450 net/ipv4/netfilter/ip_tables.c:1852
 [<ffffffff82f94d77>] nf_sockopt net/netfilter/nf_sockopt.c:105 [inline]
 [<ffffffff82f94d77>] nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:114
 [<ffffffff830fc1c1>] ip_setsockopt+0xa1/0xb0 net/ipv4/ip_sockglue.c:1226
 [<ffffffff831a2005>] udp_setsockopt+0x45/0x80 net/ipv4/udp.c:2154
 [<ffffffff82df0645>] sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2659
 [<ffffffff82ded730>] SYSC_setsockopt net/socket.c:1767 [inline]
 [<ffffffff82ded730>] SyS_setsockopt+0x160/0x250 net/socket.c:1746
 [<ffffffff83771b5f>] entry_SYSCALL_64_fastpath+0x1c/0x98

Freed by task 1773:
 [<ffffffff81035df6>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814fc0c3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814fc9e2>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814fc9e2>] kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:589
 [<ffffffff814f947c>] slab_free_hook mm/slub.c:1383 [inline]
 [<ffffffff814f947c>] slab_free_freelist_hook mm/slub.c:1405 [inline]
 [<ffffffff814f947c>] slab_free mm/slub.c:2859 [inline]
 [<ffffffff814f947c>] kfree+0xfc/0x300 mm/slub.c:3749
 [<ffffffff8169860f>] kernfs_fop_release+0xff/0x140 fs/kernfs/file.c:737
 [<ffffffff81522363>] __fput+0x233/0x6d0 fs/file_table.c:208
 [<ffffffff81522885>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff8118b9d4>] task_work_run+0x104/0x180 kernel/task_work.c:115
 [<ffffffff8100361d>] tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 [<ffffffff8100361d>] exit_to_usermode_loop+0x13d/0x160 arch/x86/entry/common.c:251
 [<ffffffff81006535>] prepare_exit_to_usermode arch/x86/entry/common.c:282 [inline]
 [<ffffffff81006535>] syscall_return_slowpath+0x1b5/0x1f0 arch/x86/entry/common.c:347
 [<ffffffff83771ce9>] int_ret_from_sys_call+0x25/0xa3

The buggy address belongs to the object at ffff8800b415aa00
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 208 bytes inside of
 256-byte region [ffff8800b415aa00, ffff8800b415ab00)
The buggy address belongs to the page:
BUG: unable to handle kernel paging request at fffffbfff3602d20
IP: [<ffffffff8122a51c>] cpuacct_charge+0x14c/0x390 kernel/sched/cpuacct.c:247
PGD 21ff67067 PUD 21ff66067 PMD 0 
Oops: 0000 [#1] PREEMPT SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 183 Comm: kworker/1:1 Not tainted 4.4.113-ge70c132 #34
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events vmstat_shepherd
task: ffff8800bb8bc740 task.stack: ffff8801d9420000
RIP: 0010:[<ffffffff8122a51c>]  [<ffffffff8122a51c>] cpuacct_charge+0x14c/0x390 kernel/sched/cpuacct.c:247
RSP: 0018:ffff8801d94278a0  EFLAGS: 00010046
RAX: 1ffffffff0854fff RBX: 0000000000018528 RCX: ffffffff847eb500
RDX: fffffbfff3602d20 RSI: ffffffff9b016900 RDI: ffffffff842a7ff8
RBP: ffff8801d94278e8 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: 1ffff1003b284ee0 R12: ffffffff842a7f20
R13: dffffc0000000000 R14: 000000001d35d8c6 R15: 0000000002d05680
FS:  0000000000000000(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: fffffbfff3602d20 CR3: 00000000b7980000 CR4: 0000000000160670
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 ffffffff8122a430 ffff8801d94278d0 0000000000000046 0000000000000003
 ffff8801d2348060 ffffffff83844340 000000001d35d8c6 ffff8801d23480b0
 ffff8801d2348000 ffff8801d9427938 ffffffff811dbea7 ffff8801db21f4c0
Call Trace:
 [<ffffffff811dbea7>] update_curr+0x2c7/0x6c0 kernel/sched/fair.c:882
 [<ffffffff811e4033>] enqueue_entity kernel/sched/fair.c:3511 [inline]
 [<ffffffff811e4033>] enqueue_task_fair+0x313/0x2940 kernel/sched/fair.c:4694
 [<ffffffff811bb7f8>] enqueue_task kernel/sched/core.c:856 [inline]
 [<ffffffff811bb7f8>] activate_task+0x148/0x270 kernel/sched/core.c:872
 [<ffffffff811bc79f>] ttwu_activate kernel/sched/core.c:1734 [inline]
 [<ffffffff811bc79f>] ttwu_do_activate.constprop.131+0xbf/0x1e0 kernel/sched/core.c:1787
 [<ffffffff811bfb8d>] ttwu_queue kernel/sched/core.c:1932 [inline]
 [<ffffffff811bfb8d>] try_to_wake_up+0x68d/0xf60 kernel/sched/core.c:2066
 [<ffffffff811c05a5>] wake_up_process+0x15/0x20 kernel/sched/core.c:2140
 [<ffffffff8117ab21>] wake_up_worker kernel/workqueue.c:846 [inline]
 [<ffffffff8117ab21>] insert_work+0x171/0x210 kernel/workqueue.c:1318
 [<ffffffff8117af9c>] __queue_work+0x3dc/0xea0 kernel/workqueue.c:1433
 [<ffffffff8117bd27>] __queue_delayed_work+0x237/0x390 kernel/workqueue.c:1495
 [<ffffffff8117db09>] queue_delayed_work_on+0x59/0xb0 kernel/workqueue.c:1533
 [<ffffffff81471781>] vmstat_shepherd+0x1c1/0x220 mm/vmstat.c:1488
 [<ffffffff8117fd87>] process_one_work+0x7d7/0x16e0 kernel/workqueue.c:2064
 [<ffffffff81180d69>] worker_thread+0xd9/0xfc0 kernel/workqueue.c:2196
 [<ffffffff811907d8>] kthread+0x268/0x300 kernel/kthread.c:211
 [<ffffffff83771f85>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:506
Code: 89 f2 48 c1 ea 03 4c 01 ea 49 8d bc 24 d8 00 00 00 48 89 f8 48 c1 e8 03 42 80 3c 28 00 0f 85 9e 01 00 00 49 8b 9c 24 d8 00 00 00 <80> 3a 00 0f 85 0a 02 00 00 4a 03 1c f9 48 89 d8 48 c1 e8 03 42 
RIP  [<ffffffff8122a51c>] cpuacct_charge+0x14c/0x390 kernel/sched/cpuacct.c:247
 RSP <ffff8801d94278a0>
CR2: fffffbfff3602d20
---[ end trace 969bce89233f17c3 ]---

Crashes (26):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/01/25 20:21 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 6b2a715e .config console log report syz C ci-android-44-kasan-gce
2018/01/25 19:46 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 6b2a715e .config console log report syz C ci-android-44-kasan-gce
2018/01/25 19:22 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 6b2a715e .config console log report syz C ci-android-44-kasan-gce
2018/01/26 08:49 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/26 08:36 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/26 08:14 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/26 08:02 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/26 07:50 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/24 19:47 https://android.googlesource.com/kernel/common android-4.4 ef588ef53d3e 866f1102 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/26 08:06 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report ci-android-44-kasan-gce
2018/01/27 14:10 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/27 12:32 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/27 12:14 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/27 11:16 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/27 08:39 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/27 08:11 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/27 02:35 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/26 23:22 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/26 23:07 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/26 18:26 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/26 13:32 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/25 21:46 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report ci-android-44-kasan-gce-386
2018/01/25 08:44 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 6b2a715e .config console log report ci-android-44-kasan-gce-386
2018/01/24 23:51 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 866f1102 .config console log report ci-android-44-kasan-gce-386
2018/01/24 20:51 https://android.googlesource.com/kernel/common android-4.4 ef588ef53d3e 866f1102 .config console log report ci-android-44-kasan-gce-386
2018/01/24 19:34 https://android.googlesource.com/kernel/common android-4.4 ef588ef53d3e 866f1102 .config console log report ci-android-44-kasan-gce-386
* Struck through repros no longer work on HEAD.