syzbot


KASAN: stack-out-of-bounds Read in xt_copy_counters_from_user

Status: fixed on 2018/09/28 02:41
Fix commit: 3ea051bcf2cd netfilter: x_tables: avoid stack-out-of-bounds read in xt_copy_counters_from_user
First crash: 2214d, last: 2207d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-44 KASAN: stack-out-of-bounds Read in xt_copy_counters_from_user C 13 2208d 2214d 2/2 fixed on 2018/09/28 02:32

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: crng init done
==================================================================
BUG: KASAN: stack-out-of-bounds in strlen lib/string.c:481 [inline]
BUG: KASAN: stack-out-of-bounds in strlcpy+0x101/0x120 lib/string.c:141
Read of size 1 at addr ffff8801cf78fb0c by task syz-executor184/2044

CPU: 0 PID: 2044 Comm: syz-executor184 Not tainted 4.9.126+ #42
 ffff8801cf78f9e8 ffffffff81af1049 ffffea00073de3c0 ffff8801cf78fb0c
 0000000000000000 ffff8801cf78fb0c 0000000000000091 ffff8801cf78fa20
 ffffffff814e136d ffff8801cf78fb0c 0000000000000001 0000000000000000
Call Trace:
 [<ffffffff81af1049>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81af1049>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff814e136d>] print_address_description+0x6c/0x234 mm/kasan/report.c:256
 [<ffffffff814e1777>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff814e1777>] kasan_report.cold.6+0x242/0x2fe mm/kasan/report.c:412
 [<ffffffff814d3b54>] __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 [<ffffffff81b0dd21>] strlen lib/string.c:481 [inline]
 [<ffffffff81b0dd21>] strlcpy+0x101/0x120 lib/string.c:141
 [<ffffffff823ce202>] xt_copy_counters_from_user+0x152/0x300 net/netfilter/x_tables.c:880
 [<ffffffff826f84a6>] do_add_counters+0x96/0x5c0 net/ipv6/netfilter/ip6_tables.c:1217
 [<ffffffff826fdda6>] compat_do_ip6t_set_ctl+0xd6/0x140 net/ipv6/netfilter/ip6_tables.c:1592
 [<ffffffff82360a3b>] compat_nf_sockopt net/netfilter/nf_sockopt.c:143 [inline]
 [<ffffffff82360a3b>] compat_nf_setsockopt+0x8b/0x130 net/netfilter/nf_sockopt.c:155
 [<ffffffff8266bd9d>] compat_ipv6_setsockopt+0x15d/0x1d0 net/ipv6/ipv6_sockglue.c:953
 [<ffffffff82446da7>] inet_csk_compat_setsockopt+0x97/0x120 net/ipv4/inet_connection_sock.c:914
 [<ffffffff8245b36d>] compat_tcp_setsockopt+0x3d/0x70 net/ipv4/tcp.c:2769
 [<ffffffff8222adf4>] compat_sock_common_setsockopt+0xb4/0x150 net/core/sock.c:2717
 [<ffffffff8230f179>] C_SYSC_setsockopt net/compat.c:399 [inline]
 [<ffffffff8230f179>] compat_SyS_setsockopt+0x169/0x540 net/compat.c:382
 [<ffffffff81005fd1>] do_syscall_32_irqs_on arch/x86/entry/common.c:325 [inline]
 [<ffffffff81005fd1>] do_fast_syscall_32+0x2f1/0x860 arch/x86/entry/common.c:387
 [<ffffffff8278dfa0>] entry_SYSENTER_compat+0x90/0xa2 arch/x86/entry/entry_64_compat.S:137

The buggy address belongs to the page:
page:ffffea00073de3c0 count:0 mapcount:0 mapping:          (null) index:0x0
flags: 0x4000000000000000()
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801cf78fa00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8801cf78fa80: 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00
>ffff8801cf78fb00: 00 04 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00
                      ^
 ffff8801cf78fb80: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00
 ffff8801cf78fc00: 00 00 00 f2 f2 f2 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (18):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/13 12:22 https://android.googlesource.com/kernel/common android-4.9 a8c1ea6c63ed 19e9088b .config console log report syz C ci-android-49-kasan-gce-386
2018/09/19 20:05 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab 7f125108 .config console log report ci-android-49-kasan-gce-386
2018/09/19 19:27 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab 7f125108 .config console log report ci-android-49-kasan-gce-386
2018/09/18 23:59 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab 7f125108 .config console log report ci-android-49-kasan-gce-386
2018/09/18 22:02 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab 7f125108 .config console log report ci-android-49-kasan-gce-386
2018/09/18 13:35 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab 7f125108 .config console log report ci-android-49-kasan-gce-386
2018/09/17 16:08 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab 7f125108 .config console log report ci-android-49-kasan-gce-386
2018/09/17 09:12 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab 7f125108 .config console log report ci-android-49-kasan-gce-386
2018/09/16 10:07 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/16 05:33 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/15 23:02 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/15 16:44 https://android.googlesource.com/kernel/common android-4.9 be4935d541ab a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/15 03:14 https://android.googlesource.com/kernel/common android-4.9 a8c1ea6c63ed a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/14 23:36 https://android.googlesource.com/kernel/common android-4.9 a8c1ea6c63ed a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/14 23:35 https://android.googlesource.com/kernel/common android-4.9 a8c1ea6c63ed a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/14 23:34 https://android.googlesource.com/kernel/common android-4.9 a8c1ea6c63ed a343a400 .config console log report ci-android-49-kasan-gce-386
2018/09/14 03:19 https://android.googlesource.com/kernel/common android-4.9 a8c1ea6c63ed 19e9088b .config console log report ci-android-49-kasan-gce-386
2018/09/13 21:02 https://android.googlesource.com/kernel/common android-4.9 a8c1ea6c63ed 19e9088b .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.