syzbot


KMSAN: kernel-infoleak in _copy_to_iter

Status: fixed on 2018/08/08 18:10
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: 45c180bc29ba xfrm_user: prevent leaking 2 bytes of kernel memory
First crash: 1703d, last: 1657d
similar bugs (6):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: kernel-infoleak in _copy_to_iter (5) C 23883 562d 998d 22/24 fixed on 2021/11/10 00:50
upstream KMSAN: kernel-infoleak in _copy_to_iter (4) C 56 1525d 1529d 12/24 fixed on 2018/12/18 11:30
upstream KMSAN: kernel-infoleak in _copy_to_iter (7) btrfs ntfs3 erofs udf C 137130 now 333d 23/24 internal: reported C repro on 2022/03/09 07:32
upstream KMSAN: kernel-infoleak in _copy_to_iter (3) C 36 1560d 1571d 12/24 fixed on 2018/10/30 01:28
upstream KMSAN: kernel-infoleak in _copy_to_iter (2) C 7 1587d 1614d 12/24 fixed on 2018/10/08 09:31
upstream KMSAN: kernel-infoleak in _copy_to_iter (6) C 748 334d 423d 22/24 fixed on 2022/03/08 16:11

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
==================================================================
BUG: KMSAN: kernel-infoleak in copyout lib/iov_iter.c:140 [inline]
BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x1b14/0x2800 lib/iov_iter.c:571
CPU: 1 PID: 4520 Comm: syz-executor841 Not tainted 4.17.0+ #5
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+0x185/0x1d0 lib/dump_stack.c:113
 kmsan_report+0x188/0x2a0 mm/kmsan/kmsan.c:1117
 kmsan_internal_check_memory+0x138/0x1f0 mm/kmsan/kmsan.c:1211
 kmsan_copy_to_user+0x7a/0x160 mm/kmsan/kmsan.c:1253
 copyout lib/iov_iter.c:140 [inline]
 _copy_to_iter+0x1b14/0x2800 lib/iov_iter.c:571
 copy_to_iter include/linux/uio.h:106 [inline]
 skb_copy_datagram_iter+0x422/0xfa0 net/core/datagram.c:431
 skb_copy_datagram_msg include/linux/skbuff.h:3268 [inline]
 netlink_recvmsg+0x6f1/0x1900 net/netlink/af_netlink.c:1959
 sock_recvmsg_nosec net/socket.c:802 [inline]
 sock_recvmsg+0x1d6/0x230 net/socket.c:809
 ___sys_recvmsg+0x3fe/0x810 net/socket.c:2279
 __sys_recvmmsg+0x58e/0xe30 net/socket.c:2391
 do_sys_recvmmsg+0x2a6/0x3e0 net/socket.c:2472
 __do_sys_recvmmsg net/socket.c:2485 [inline]
 __se_sys_recvmmsg net/socket.c:2481 [inline]
 __x64_sys_recvmmsg+0x15d/0x1c0 net/socket.c:2481
 do_syscall_64+0x15b/0x230 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x446ce9
RSP: 002b:00007fc307918db8 EFLAGS: 00000293 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00000000006dbc24 RCX: 0000000000446ce9
RDX: 000000000000000a RSI: 0000000020005040 RDI: 0000000000000003
RBP: 00000000006dbc20 R08: 0000000020004e40 R09: 0000000000000000
R10: 0000000040000000 R11: 0000000000000293 R12: 0000000000000000
R13: 00007ffc8d2df32f R14: 00007fc3079199c0 R15: 0000000000000001

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline]
 kmsan_save_stack mm/kmsan/kmsan.c:294 [inline]
 kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:685
 kmsan_memcpy_origins+0x11d/0x170 mm/kmsan/kmsan.c:527
 __msan_memcpy+0x109/0x160 mm/kmsan/kmsan_instr.c:413
 __nla_put lib/nlattr.c:569 [inline]
 nla_put+0x276/0x340 lib/nlattr.c:627
 copy_to_user_policy_type net/xfrm/xfrm_user.c:1678 [inline]
 dump_one_policy+0xbe1/0x1090 net/xfrm/xfrm_user.c:1708
 xfrm_policy_walk+0x45a/0xd00 net/xfrm/xfrm_policy.c:1013
 xfrm_dump_policy+0x1c0/0x2a0 net/xfrm/xfrm_user.c:1749
 netlink_dump+0x9b5/0x1550 net/netlink/af_netlink.c:2226
 __netlink_dump_start+0x1131/0x1270 net/netlink/af_netlink.c:2323
 netlink_dump_start include/linux/netlink.h:214 [inline]
 xfrm_user_rcv_msg+0x8a3/0x9b0 net/xfrm/xfrm_user.c:2577
 netlink_rcv_skb+0x37e/0x600 net/netlink/af_netlink.c:2448
 xfrm_netlink_rcv+0xb2/0xf0 net/xfrm/xfrm_user.c:2598
 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
 netlink_unicast+0x1680/0x1750 net/netlink/af_netlink.c:1336
 netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg net/socket.c:639 [inline]
 ___sys_sendmsg+0xec8/0x1320 net/socket.c:2117
 __sys_sendmsg net/socket.c:2155 [inline]
 __do_sys_sendmsg net/socket.c:2164 [inline]
 __se_sys_sendmsg net/socket.c:2162 [inline]
 __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162
 do_syscall_64+0x15b/0x230 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Local variable description: ----upt.i@dump_one_policy
Variable was created at:
 dump_one_policy+0x78/0x1090 net/xfrm/xfrm_user.c:1689
 xfrm_policy_walk+0x45a/0xd00 net/xfrm/xfrm_policy.c:1013

Byte 130 of 137 is uninitialized
Memory access starts at ffff88019550407f
==================================================================

Crashes (285):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kmsan-gce 2018/06/09 14:40 https://github.com/google/kmsan.git master d6c351f832e3 866118af .config console log report syz C
ci-upstream-kmsan-gce 2018/07/24 07:35 https://github.com/google/kmsan.git master d1c2a46a46f6 912c93d7 .config console log report
ci-upstream-kmsan-gce 2018/07/23 23:50 https://github.com/google/kmsan.git master d1c2a46a46f6 912c93d7 .config console log report
ci-upstream-kmsan-gce 2018/07/23 22:35 https://github.com/google/kmsan.git master d1c2a46a46f6 912c93d7 .config console log report
ci-upstream-kmsan-gce 2018/07/23 18:19 https://github.com/google/kmsan.git master d1c2a46a46f6 f69c5fcd .config console log report
ci-upstream-kmsan-gce 2018/07/23 13:11 https://github.com/google/kmsan.git master d1c2a46a46f6 f69c5fcd .config console log report
ci-upstream-kmsan-gce 2018/07/23 07:35 https://github.com/google/kmsan.git master d1c2a46a46f6 8cc079c3 .config console log report
ci-upstream-kmsan-gce 2018/07/23 01:03 https://github.com/google/kmsan.git master d1c2a46a46f6 8cc079c3 .config console log report
ci-upstream-kmsan-gce 2018/07/22 11:09 https://github.com/google/kmsan.git master d1c2a46a46f6 8cc079c3 .config console log report
ci-upstream-kmsan-gce 2018/07/22 05:37 https://github.com/google/kmsan.git master d1c2a46a46f6 8cc079c3 .config console log report
ci-upstream-kmsan-gce 2018/07/22 04:14 https://github.com/google/kmsan.git master d1c2a46a46f6 8cc079c3 .config console log report
ci-upstream-kmsan-gce 2018/07/21 20:06 https://github.com/google/kmsan.git master d1c2a46a46f6 8cc079c3 .config console log report
ci-upstream-kmsan-gce 2018/07/21 02:18 https://github.com/google/kmsan.git master d1c2a46a46f6 af255b09 .config console log report
ci-upstream-kmsan-gce 2018/07/20 17:46 https://github.com/google/kmsan.git master cf8cd3cd03e2 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/20 12:15 https://github.com/google/kmsan.git master cf8cd3cd03e2 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/20 06:49 https://github.com/google/kmsan.git master cf8cd3cd03e2 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/20 05:44 https://github.com/google/kmsan.git master cf8cd3cd03e2 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/19 18:34 https://github.com/google/kmsan.git master cf8cd3cd03e2 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/19 16:24 https://github.com/google/kmsan.git master cf8cd3cd03e2 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/19 13:36 https://github.com/google/kmsan.git master cf8cd3cd03e2 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/19 10:18 https://github.com/google/kmsan.git master 80ecacc456c1 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/19 08:35 https://github.com/google/kmsan.git master 80ecacc456c1 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/19 05:38 https://github.com/google/kmsan.git master 80ecacc456c1 49f35839 .config console log report
ci-upstream-kmsan-gce 2018/07/18 18:26 https://github.com/google/kmsan.git master 80ecacc456c1 809256c3 .config console log report
ci-upstream-kmsan-gce 2018/07/18 09:40 https://github.com/google/kmsan.git master 80ecacc456c1 6d5bd5b5 .config console log report
ci-upstream-kmsan-gce 2018/07/18 03:21 https://github.com/google/kmsan.git master 80ecacc456c1 6d5bd5b5 .config console log report
ci-upstream-kmsan-gce 2018/07/17 18:27 https://github.com/google/kmsan.git master 80ecacc456c1 6d5bd5b5 .config console log report
ci-upstream-kmsan-gce 2018/07/17 13:11 https://github.com/google/kmsan.git master 80ecacc456c1 13761366 .config console log report
ci-upstream-kmsan-gce 2018/07/17 00:37 https://github.com/google/kmsan.git master 80ecacc456c1 40cb0c9a .config console log report
ci-upstream-kmsan-gce 2018/07/16 21:10 https://github.com/google/kmsan.git master 80ecacc456c1 40cb0c9a .config console log report
ci-upstream-kmsan-gce 2018/07/16 12:28 https://github.com/google/kmsan.git master 80ecacc456c1 92a49505 .config console log report
ci-upstream-kmsan-gce 2018/07/16 10:58 https://github.com/google/kmsan.git master 80ecacc456c1 92a49505 .config console log report
ci-upstream-kmsan-gce 2018/07/15 01:13 https://github.com/google/kmsan.git master 80ecacc456c1 92a49505 .config console log report
ci-upstream-kmsan-gce 2018/07/14 18:39 https://github.com/google/kmsan.git master 80ecacc456c1 92a49505 .config console log report
ci-upstream-kmsan-gce 2018/07/14 15:12 https://github.com/google/kmsan.git master 80ecacc456c1 92a49505 .config console log report
ci-upstream-kmsan-gce 2018/07/14 09:57 https://github.com/google/kmsan.git master 80ecacc456c1 92a49505 .config console log report
ci-upstream-kmsan-gce 2018/07/13 23:44 https://github.com/google/kmsan.git master e74f81fe9c5d 92a49505 .config console log report
ci-upstream-kmsan-gce 2018/07/12 00:33 https://github.com/google/kmsan.git master b64f7ec04e12 2e0e3130 .config console log report
ci-upstream-kmsan-gce 2018/07/11 09:30 https://github.com/google/kmsan.git master b64f7ec04e12 2e0e3130 .config console log report
ci-upstream-kmsan-gce 2018/07/11 02:46 https://github.com/google/kmsan.git master b64f7ec04e12 2e0e3130 .config console log report
ci-upstream-kmsan-gce 2018/07/09 15:23 https://github.com/google/kmsan.git master a00de5aa4da3 f25e5770 .config console log report
ci-upstream-kmsan-gce 2018/07/09 14:24 https://github.com/google/kmsan.git master a00de5aa4da3 f25e5770 .config console log report
ci-upstream-kmsan-gce 2018/07/09 12:07 https://github.com/google/kmsan.git master a00de5aa4da3 f25e5770 .config console log report
ci-upstream-kmsan-gce 2018/07/09 10:01 https://github.com/google/kmsan.git master a00de5aa4da3 f25e5770 .config console log report
ci-upstream-kmsan-gce 2018/07/09 06:16 https://github.com/google/kmsan.git master a00de5aa4da3 f25e5770 .config console log report
ci-upstream-kmsan-gce 2018/06/08 21:14 https://github.com/google/kmsan.git master d6c351f832e3 866118af .config console log report
* Struck through repros no longer work on HEAD.