KMSAN: kernel-infoleak in _copy_to_iter (2)

Status: fixed on 2018/10/08 09:31
Subsystems: net
[Documentation on labels]
Fix commit: 45c180bc29ba xfrm_user: prevent leaking 2 bytes of kernel memory
First crash: 2029d, last: 1978d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: kernel-infoleak in _copy_to_iter (5) net C 23883 953d 1390d 20/26 fixed on 2021/11/10 00:50
upstream KMSAN: kernel-infoleak in _copy_to_iter net C 285 2049d 2085d 8/26 fixed on 2018/08/08 18:10
upstream KMSAN: kernel-infoleak in _copy_to_iter (4) net C 56 1917d 1921d 11/26 fixed on 2018/12/18 11:30
upstream KMSAN: kernel-infoleak in _copy_to_iter (7) net C 138977 373d 725d 22/26 fixed on 2023/02/24 13:50
upstream KMSAN: kernel-infoleak in _copy_to_iter (8) mm C 21180 269d 363d 22/26 fixed on 2023/06/08 14:41
upstream KMSAN: kernel-infoleak in _copy_to_iter (3) net C 36 1952d 1963d 11/26 fixed on 2018/10/30 01:28
upstream KMSAN: kernel-infoleak in _copy_to_iter (6) net C 748 726d 815d 20/26 fixed on 2022/03/08 16:11

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): veth1: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
8021q: adding VLAN 0 to HW filter on device team0
BUG: KMSAN: kernel-infoleak in copyout lib/iov_iter.c:140 [inline]
BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x44f/0x27d0 lib/iov_iter.c:571
CPU: 1 PID: 4754 Comm: syz-executor100 Not tainted 4.18.0-rc8+ #33
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+0x17c/0x1c0 lib/dump_stack.c:113
 kmsan_report+0x188/0x2a0 mm/kmsan/kmsan.c:982
 kmsan_internal_check_memory+0x138/0x1f0 mm/kmsan/kmsan.c:1027
 kmsan_copy_to_user+0x73/0xb0 mm/kmsan/kmsan_hooks.c:479
 copyout lib/iov_iter.c:140 [inline]
 _copy_to_iter+0x44f/0x27d0 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:3270 [inline]
 packet_recvmsg+0x728/0x1c30 net/packet/af_packet.c:3320
 sock_recvmsg_nosec net/socket.c:815 [inline]
 sock_recvmsg net/socket.c:822 [inline]
 sock_read_iter+0x406/0x480 net/socket.c:899
 call_read_iter include/linux/fs.h:1787 [inline]
 new_sync_read fs/read_write.c:406 [inline]
 __vfs_read+0x7b9/0x9f0 fs/read_write.c:418
 vfs_read+0x36c/0x6b0 fs/read_write.c:452
 ksys_read fs/read_write.c:578 [inline]
 __do_sys_read fs/read_write.c:588 [inline]
 __se_sys_read fs/read_write.c:586 [inline]
 __x64_sys_read+0x1b7/0x3c0 fs/read_write.c:586
 do_syscall_64+0x15b/0x220 arch/x86/entry/common.c:290
RIP: 0033:0x446fa9
Code: e8 6c b3 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 6b 03 fc ff c3 66 2e 0f 1f 84 00 00 00 00 
RSP: 002b:00007f197391cda8 EFLAGS: 00000293 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00000000006dcc48 RCX: 0000000000446fa9
RDX: 0000000000000019 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 00000000006dcc40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 00000000006dcc4c
R13: 0000010000000002 R14: 00007f197391d9c0 R15: 0000000000000000

Uninit was created at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:256 [inline]
 kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:181
 kmsan_kmalloc+0x98/0x100 mm/kmsan/kmsan_hooks.c:91
 kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan_hooks.c:100
 slab_post_alloc_hook mm/slab.h:446 [inline]
 slab_alloc_node mm/slub.c:2720 [inline]
 __kmalloc_node_track_caller+0xb4c/0x11d0 mm/slub.c:4353
 __kmalloc_reserve net/core/skbuff.c:138 [inline]
 __alloc_skb+0x2ce/0x9b0 net/core/skbuff.c:206
 alloc_skb include/linux/skbuff.h:988 [inline]
 alloc_skb_with_frags+0x1d0/0xac0 net/core/skbuff.c:5272
 sock_alloc_send_pskb+0xb47/0x1120 net/core/sock.c:2095
 packet_alloc_skb net/packet/af_packet.c:2776 [inline]
 packet_snd net/packet/af_packet.c:2867 [inline]
 packet_sendmsg+0x6480/0x8ae0 net/packet/af_packet.c:2946
 sock_sendmsg_nosec net/socket.c:642 [inline]
 sock_sendmsg net/socket.c:652 [inline]
 ___sys_sendmsg+0xe32/0x1250 net/socket.c:2126
 __sys_sendmmsg+0x4ac/0x930 net/socket.c:2221
 __do_sys_sendmmsg net/socket.c:2250 [inline]
 __se_sys_sendmmsg net/socket.c:2247 [inline]
 __x64_sys_sendmmsg+0x11c/0x170 net/socket.c:2247
 do_syscall_64+0x15b/0x220 arch/x86/entry/common.c:290

Bytes 4-5 of 25 are uninitialized
Memory access starts at ffff8801c0310264

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/08/13 22:31 master 0cc51dc9a291 7a88b141 .config console log report syz C ci-upstream-kmsan-gce
2018/10/03 03:22 master b2efdb2ef006 0f3e0261 .config console log report ci-upstream-kmsan-gce
2018/10/03 02:53 master b2efdb2ef006 0f3e0261 .config console log report ci-upstream-kmsan-gce
2018/09/07 04:09 master 43e4752ae5dc e30d3b52 .config console log report ci-upstream-kmsan-gce
2018/09/06 02:51 master 43e4752ae5dc 873745f2 .config console log report ci-upstream-kmsan-gce
2018/08/15 18:21 master 0cc51dc9a291 9ccc1d45 .config console log report ci-upstream-kmsan-gce
2018/08/13 14:58 master 0cc51dc9a291 7a88b141 .config console log report ci-upstream-kmsan-gce
* Struck through repros no longer work on HEAD.