syzbot


KMSAN: kernel-infoleak in sctp_getsockopt (3)

Status: fixed on 2019/04/12 08:05
Subsystems: sctp
[Documentation on labels]
Reported-by: syzbot+86b5c7c236a22616a72f@syzkaller.appspotmail.com
Fix commit: 09279e615c81 sctp: initialize _pad of sockaddr_in before copying to user memory
First crash: 1896d, last: 1877d
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 4.14 00/69] 4.14.112-stable review 88 (88) 2019/04/27 13:54
[PATCH 4.4 000/168] 4.4.179-stable review 178 (178) 2019/04/25 19:37
[PATCH 3.18 000/104] 3.18.139-stable review 112 (112) 2019/04/25 19:36
[PATCH 4.19 000/101] 4.19.35-stable review 111 (111) 2019/04/17 16:40
[PATCH 5.0 000/117] 5.0.8-stable review 125 (125) 2019/04/17 11:04
[PATCH 4.9 00/76] 4.9.169-stable review 100 (100) 2019/04/17 06:47
[PATCH net] sctp: initialize _pad of sockaddr_in before copying to user memory 4 (4) 2019/04/02 01:09
KMSAN: kernel-infoleak in sctp_getsockopt (3) 6 (7) 2019/04/01 08:42
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: kernel-infoleak in sctp_getsockopt (2) sctp C 16 1912d 1962d 11/26 fixed on 2019/03/06 07:43
upstream KMSAN: kernel-infoleak in sctp_getsockopt sctp syz 147 1966d 2002d 11/26 fixed on 2019/01/11 01:22

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): hsr_slave_1: link becomes ready
8021q: adding VLAN 0 to HW filter on device batadv0
IPv6: ADDRCONF(NETDEV_CHANGE): hsr0: link becomes ready
8021q: adding VLAN 0 to HW filter on device batadv0
==================================================================
BUG: KMSAN: kernel-infoleak in _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
CPU: 0 PID: 10048 Comm: syz-executor.3 Not tainted 5.1.0-rc2+ #21
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+0x131/0x2a0 mm/kmsan/kmsan.c:624
 kmsan_internal_check_memory+0xaa1/0xbb0 mm/kmsan/kmsan.c:718
 kmsan_copy_to_user+0xab/0xc0 mm/kmsan/kmsan_hooks.c:485
 _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
 copy_to_user include/linux/uaccess.h:174 [inline]
 sctp_getsockopt_peer_addrs net/sctp/socket.c:6160 [inline]
 sctp_getsockopt+0xc982/0x185c0 net/sctp/socket.c:7819
 sock_common_getsockopt+0x13f/0x180 net/core/sock.c:3079
 __sys_getsockopt+0x489/0x550 net/socket.c:1960
 __do_sys_getsockopt net/socket.c:1971 [inline]
 __se_sys_getsockopt+0xe1/0x100 net/socket.c:1968
 __x64_sys_getsockopt+0x62/0x80 net/socket.c:1968
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7
RIP: 0033:0x458209
Code: ad b8 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 b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f2e00856c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000458209
RDX: 000000000000006c RSI: 0000000000000084 RDI: 0000000000000004
RBP: 000000000073bf00 R08: 0000000020000040 R09: 0000000000000000
R10: 0000000020000000 R11: 0000000000000246 R12: 00007f2e008576d4
R13: 00000000004c9a88 R14: 00000000004d06e8 R15: 00000000ffffffff

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+0xb5b/0xfe0 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_getsockopt_peer_addrs net/sctp/socket.c:6155 [inline]
 sctp_getsockopt+0xc852/0x185c0 net/sctp/socket.c:7819
 sock_common_getsockopt+0x13f/0x180 net/core/sock.c:3079
 __sys_getsockopt+0x489/0x550 net/socket.c:1960
 __do_sys_getsockopt net/socket.c:1971 [inline]
 __se_sys_getsockopt+0xe1/0x100 net/socket.c:1968
 __x64_sys_getsockopt+0x62/0x80 net/socket.c:1968
 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+0xb5b/0xfe0 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_transport_init net/sctp/transport.c:61 [inline]
 sctp_transport_new+0x16d/0x9a0 net/sctp/transport.c:115
 sctp_assoc_add_peer+0x5ba/0x2030 net/sctp/associola.c:637
 sctp_process_param net/sctp/sm_make_chunk.c:2548 [inline]
 sctp_process_init+0x1a1b/0x3ed0 net/sctp/sm_make_chunk.c:2361
 sctp_cmd_process_init net/sctp/sm_sideeffect.c:682 [inline]
 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1410 [inline]
 sctp_side_effects net/sctp/sm_sideeffect.c:1220 [inline]
 sctp_do_sm+0x3cfc/0x9af0 net/sctp/sm_sideeffect.c:1191
 sctp_assoc_bh_rcv+0x65a/0xd80 net/sctp/associola.c:1074
 sctp_inq_push+0x300/0x420 net/sctp/inqueue.c:95
 sctp_backlog_rcv+0x20a/0xaf0 net/sctp/input.c:354
 sk_backlog_rcv include/net/sock.h:937 [inline]
 __release_sock+0x281/0x5f0 net/core/sock.c:2413
 release_sock+0x99/0x2a0 net/core/sock.c:2929
 sctp_wait_for_connect+0x3ee/0x860 net/sctp/socket.c:9008
 sctp_sendmsg_to_asoc+0x2127/0x2160 net/sctp/socket.c:1968
 sctp_sendmsg+0x3467/0x5ae0 net/sctp/socket.c:2114
 inet_sendmsg+0x54a/0x720 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg net/socket.c:632 [inline]
 ___sys_sendmsg+0xdb3/0x1220 net/socket.c:2137
 __sys_sendmsg net/socket.c:2175 [inline]
 __do_sys_sendmsg net/socket.c:2184 [inline]
 __se_sys_sendmsg+0x305/0x460 net/socket.c:2182
 __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2182
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7

Local variable description: ----addr.i@sctp_process_init
Variable was created at:
 sctp_process_init+0xb5/0x3ed0 net/sctp/sm_make_chunk.c:2324
 sctp_cmd_process_init net/sctp/sm_sideeffect.c:682 [inline]
 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1410 [inline]
 sctp_side_effects net/sctp/sm_sideeffect.c:1220 [inline]
 sctp_do_sm+0x3cfc/0x9af0 net/sctp/sm_sideeffect.c:1191

Bytes 8-15 of 16 are uninitialized
Memory access of size 16 starts at ffff88809d72fc28
Data copied to user address 0000000020000018
==================================================================

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/02 01:08 https://github.com/google/kmsan.git master 088c01ea0855 a9ca43d4 .config console log report syz ci-upstream-kmsan-gce
2019/03/24 01:58 https://github.com/google/kmsan.git master c10a026b8dee a2cef203 .config console log report syz ci-upstream-kmsan-gce
2019/04/10 00:42 https://github.com/google/kmsan.git master c1f8455db49c 65b612b7 .config console log report ci-upstream-kmsan-gce
2019/04/01 21:36 https://github.com/google/kmsan.git master 088c01ea0855 a9ca43d4 .config console log report ci-upstream-kmsan-gce
2019/04/01 13:48 https://github.com/google/kmsan.git master 088c01ea0855 ccf2355a .config console log report ci-upstream-kmsan-gce
2019/03/28 10:29 https://github.com/google/kmsan.git master 3c26d882e695 f94f56fe .config console log report ci-upstream-kmsan-gce
2019/03/28 00:08 https://github.com/google/kmsan.git master 3c26d882e695 4e668495 .config console log report ci-upstream-kmsan-gce
2019/03/25 16:24 https://github.com/google/kmsan.git master c10a026b8dee 2c86e0a5 .config console log report ci-upstream-kmsan-gce
2019/03/25 13:55 https://github.com/google/kmsan.git master c10a026b8dee 2c86e0a5 .config console log report ci-upstream-kmsan-gce
2019/03/23 21:56 https://github.com/google/kmsan.git master c10a026b8dee a2cef203 .config console log report ci-upstream-kmsan-gce
2019/03/22 06:30 https://github.com/google/kmsan.git master c10a026b8dee dce6e62f .config console log report ci-upstream-kmsan-gce
* Struck through repros no longer work on HEAD.