syzbot


KMSAN: kernel-infoleak in sctp_getsockopt (2)

Status: fixed on 2019/03/06 07:43
Subsystems: sctp
[Documentation on labels]
Reported-by: syzbot+ae0c70c0c2d40c51bb92@syzkaller.appspotmail.com
Fix commit: 400b8b9a2a17 sctp: allocate sctp_sockaddr_entry with kzalloc
First crash: 2094d, last: 2042d
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 4.19 00/99] 4.19.17-stable review 109 (109) 2019/04/22 19:40
[PATCH 4.4 000/104] 4.4.172-stable review 111 (111) 2019/01/30 07:30
[PATCH 3.18 00/52] 3.18.133-stable review 55 (55) 2019/01/25 23:16
[PATCH 4.14 00/59] 4.14.95-stable review 65 (65) 2019/01/23 12:55
[PATCH 4.9 00/51] 4.9.152-stable review 56 (56) 2019/01/23 09:06
[PATCH 4.20 000/111] 4.20.4-stable review 120 (120) 2019/01/23 06:43
[PATCH net] sctp: allocate sctp_sockaddr_entry with kzalloc 4 (4) 2019/01/16 21:38
KMSAN: kernel-infoleak in sctp_getsockopt (2) 0 (1) 2019/01/14 11:08
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: kernel-infoleak in sctp_getsockopt (3) sctp syz 11 2007d 2020d 12/28 fixed on 2019/04/12 08:05
upstream KMSAN: kernel-infoleak in sctp_getsockopt sctp syz 147 2097d 2133d 11/28 fixed on 2019/01/11 01:22

Sample crash report:
==================================================================
BUG: KMSAN: kernel-infoleak in _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
CPU: 1 PID: 10740 Comm: syz-executor064 Not tainted 5.0.0-rc1+ #7
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+0x173/0x1d0 lib/dump_stack.c:113
 kmsan_report+0x12e/0x2a0 mm/kmsan/kmsan.c:600
 kmsan_internal_check_memory+0x465/0xb10 mm/kmsan/kmsan.c:663
 kmsan_copy_to_user+0xab/0xc0 mm/kmsan/kmsan_hooks.c:601
 _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
 copy_to_user include/linux/uaccess.h:174 [inline]
 sctp_getsockopt_local_addrs net/sctp/socket.c:6056 [inline]
 sctp_getsockopt+0x1309a/0x17f70 net/sctp/socket.c:7566
 sock_common_getsockopt+0x13f/0x180 net/core/sock.c:2950
 __sys_getsockopt+0x489/0x550 net/socket.c:1939
 __do_sys_getsockopt net/socket.c:1950 [inline]
 __se_sys_getsockopt+0xe1/0x100 net/socket.c:1947
 __x64_sys_getsockopt+0x62/0x80 net/socket.c:1947
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7
RIP: 0033:0x445679
Code: e8 6c b6 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 2b 12 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fa7633b9db8 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 00000000006dac38 RCX: 0000000000445679
RDX: 000000000000006d RSI: 0000000000000084 RDI: 0000000000000004
RBP: 00000000006dac30 R08: 00000000200000c0 R09: 0000000000000000
R10: 0000000020000200 R11: 0000000000000246 R12: 00000000006dac3c
R13: 00007ffc3e29873f R14: 00007fa7633ba9c0 R15: 00000000006dad2c

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:205 [inline]
 kmsan_save_stack mm/kmsan/kmsan.c:220 [inline]
 kmsan_internal_chain_origin+0x134/0x230 mm/kmsan/kmsan.c:426
 kmsan_memcpy_memmove_metadata+0xcf2/0xf10 mm/kmsan/kmsan.c:304
 kmsan_memcpy_metadata+0xb/0x10 mm/kmsan/kmsan.c:324
 __msan_memcpy+0x58/0x70 mm/kmsan/kmsan_instr.c:139
 sctp_copy_laddrs net/sctp/socket.c:5959 [inline]
 sctp_getsockopt_local_addrs net/sctp/socket.c:6025 [inline]
 sctp_getsockopt+0x13887/0x17f70 net/sctp/socket.c:7566
 sock_common_getsockopt+0x13f/0x180 net/core/sock.c:2950
 __sys_getsockopt+0x489/0x550 net/socket.c:1939
 __do_sys_getsockopt net/socket.c:1950 [inline]
 __se_sys_getsockopt+0xe1/0x100 net/socket.c:1947
 __x64_sys_getsockopt+0x62/0x80 net/socket.c:1947
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:205 [inline]
 kmsan_save_stack mm/kmsan/kmsan.c:220 [inline]
 kmsan_internal_chain_origin+0x134/0x230 mm/kmsan/kmsan.c:426
 kmsan_memcpy_memmove_metadata+0xcf2/0xf10 mm/kmsan/kmsan.c:304
 kmsan_memcpy_metadata+0xb/0x10 mm/kmsan/kmsan.c:324
 __msan_memcpy+0x58/0x70 mm/kmsan/kmsan_instr.c:139
 sctp_copy_laddrs net/sctp/socket.c:5948 [inline]
 sctp_getsockopt_local_addrs net/sctp/socket.c:6025 [inline]
 sctp_getsockopt+0x13733/0x17f70 net/sctp/socket.c:7566
 sock_common_getsockopt+0x13f/0x180 net/core/sock.c:2950
 __sys_getsockopt+0x489/0x550 net/socket.c:1939
 __do_sys_getsockopt net/socket.c:1950 [inline]
 __se_sys_getsockopt+0xe1/0x100 net/socket.c:1947
 __x64_sys_getsockopt+0x62/0x80 net/socket.c:1947
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7

Uninit was created at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:205 [inline]
 kmsan_internal_poison_shadow+0x92/0x150 mm/kmsan/kmsan.c:159
 kmsan_kmalloc+0xa6/0x130 mm/kmsan/kmsan_hooks.c:176
 kmem_cache_alloc_trace+0x55d/0xb40 mm/slub.c:2784
 kmalloc include/linux/slab.h:545 [inline]
 sctp_inetaddr_event+0x47b/0xa90 net/sctp/protocol.c:779
 notifier_call_chain kernel/notifier.c:93 [inline]
 __blocking_notifier_call_chain kernel/notifier.c:317 [inline]
 blocking_notifier_call_chain+0x1a5/0x2f0 kernel/notifier.c:328
 __inet_insert_ifa+0xfaa/0x1200 net/ipv4/devinet.c:529
 inet_insert_ifa net/ipv4/devinet.c:536 [inline]
 inetdev_event+0x1ced/0x1d80 net/ipv4/devinet.c:1520
 notifier_call_chain kernel/notifier.c:93 [inline]
 __raw_notifier_call_chain kernel/notifier.c:394 [inline]
 raw_notifier_call_chain+0x13d/0x240 kernel/notifier.c:401
 __dev_notify_flags+0x3d3/0x830 net/core/dev.c:1739
 dev_change_flags+0x1d6/0x260 net/core/dev.c:7643
 do_setlink+0x16a4/0x5df0 net/core/rtnetlink.c:2492
 __rtnl_newlink net/core/rtnetlink.c:3115 [inline]
 rtnl_newlink+0x2d68/0x37a0 net/core/rtnetlink.c:3240
 rtnetlink_rcv_msg+0x115b/0x1550 net/core/rtnetlink.c:5130
 netlink_rcv_skb+0x431/0x620 net/netlink/af_netlink.c:2477
 rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:5148
 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
 netlink_unicast+0xf3e/0x1020 net/netlink/af_netlink.c:1336
 netlink_sendmsg+0x127f/0x1300 net/netlink/af_netlink.c:1917
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg net/socket.c:631 [inline]
 ___sys_sendmsg+0xdb9/0x11b0 net/socket.c:2116
 __sys_sendmsg net/socket.c:2154 [inline]
 __do_sys_sendmsg net/socket.c:2163 [inline]
 __se_sys_sendmsg+0x305/0x460 net/socket.c:2161
 __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2161
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7

Bytes 8-15 of 32 are uninitialized
Memory access of size 32 starts at ffff88810b2dac00
Data copied to user address 0000000020000208
==================================================================

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/01/13 16:43 https://github.com/google/kmsan.git master 02f2d5aea531 c3f3344c .config console log report syz C ci-upstream-kmsan-gce
2019/03/06 06:20 https://github.com/google/kmsan.git master 6c55aa96dcda 16559f86 .config console log report ci-upstream-kmsan-gce
2019/03/03 17:34 https://github.com/google/kmsan.git master fa1981bee40f 1c0e457a .config console log report ci-upstream-kmsan-gce
2019/03/03 17:31 https://github.com/google/kmsan.git master fa1981bee40f 1c0e457a .config console log report ci-upstream-kmsan-gce
2019/02/16 19:26 https://github.com/google/kmsan.git master fa1981bee40f f42dee6d .config console log report ci-upstream-kmsan-gce
2019/02/16 16:49 https://github.com/google/kmsan.git master fa1981bee40f f42dee6d .config console log report ci-upstream-kmsan-gce
2019/02/13 04:41 https://github.com/google/kmsan.git master fa1981bee40f 1eedba36 .config console log report ci-upstream-kmsan-gce
2019/02/06 12:42 https://github.com/google/kmsan.git master fa1981bee40f d672172c .config console log report ci-upstream-kmsan-gce
2019/02/02 16:08 https://github.com/google/kmsan.git master fa1981bee40f c198d5dd .config console log report ci-upstream-kmsan-gce
2019/01/28 00:48 https://github.com/google/kmsan.git master 02f2d5aea531 c73f090a .config console log report ci-upstream-kmsan-gce
2019/01/25 01:32 https://github.com/google/kmsan.git master 02f2d5aea531 bfab9cd8 .config console log report ci-upstream-kmsan-gce
2019/01/24 16:25 https://github.com/google/kmsan.git master 02f2d5aea531 ce1ccf97 .config console log report ci-upstream-kmsan-gce
2019/01/22 16:39 https://github.com/google/kmsan.git master 02f2d5aea531 985f75cc .config console log report ci-upstream-kmsan-gce
2019/01/18 13:29 https://github.com/google/kmsan.git master 02f2d5aea531 5bf17c30 .config console log report ci-upstream-kmsan-gce
2019/01/15 08:03 https://github.com/google/kmsan.git master 02f2d5aea531 ebacf5cb .config console log report ci-upstream-kmsan-gce
2019/01/13 03:01 https://github.com/google/kmsan.git master 02f2d5aea531 c3f3344c .config console log report ci-upstream-kmsan-gce
* Struck through repros no longer work on HEAD.