Revision d6d86830705f173fca6087a3e67ceaf68db80523 authored by Haimin Zhang on 31 December 2021, 02:35:23 UTC, committed by Jakub Kicinski on 01 January 2022, 02:37:08 UTC
struct tipc_socket_addr.ref has a 4-byte hole,and __tipc_getname() currently
copying it to user space,causing kernel-infoleak.

BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:121 [inline]
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:121 [inline] lib/usercopy.c:33
BUG: KMSAN: kernel-infoleak in _copy_to_user+0x1c9/0x270 lib/usercopy.c:33 lib/usercopy.c:33
 instrument_copy_to_user include/linux/instrumented.h:121 [inline]
 instrument_copy_to_user include/linux/instrumented.h:121 [inline] lib/usercopy.c:33
 _copy_to_user+0x1c9/0x270 lib/usercopy.c:33 lib/usercopy.c:33
 copy_to_user include/linux/uaccess.h:209 [inline]
 copy_to_user include/linux/uaccess.h:209 [inline] net/socket.c:287
 move_addr_to_user+0x3f6/0x600 net/socket.c:287 net/socket.c:287
 __sys_getpeername+0x470/0x6b0 net/socket.c:1987 net/socket.c:1987
 __do_sys_getpeername net/socket.c:1997 [inline]
 __se_sys_getpeername net/socket.c:1994 [inline]
 __do_sys_getpeername net/socket.c:1997 [inline] net/socket.c:1994
 __se_sys_getpeername net/socket.c:1994 [inline] net/socket.c:1994
 __x64_sys_getpeername+0xda/0x120 net/socket.c:1994 net/socket.c:1994
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_x64 arch/x86/entry/common.c:51 [inline] arch/x86/entry/common.c:82
 do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Uninit was stored to memory at:
 tipc_getname+0x575/0x5e0 net/tipc/socket.c:757 net/tipc/socket.c:757
 __sys_getpeername+0x3b3/0x6b0 net/socket.c:1984 net/socket.c:1984
 __do_sys_getpeername net/socket.c:1997 [inline]
 __se_sys_getpeername net/socket.c:1994 [inline]
 __do_sys_getpeername net/socket.c:1997 [inline] net/socket.c:1994
 __se_sys_getpeername net/socket.c:1994 [inline] net/socket.c:1994
 __x64_sys_getpeername+0xda/0x120 net/socket.c:1994 net/socket.c:1994
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_x64 arch/x86/entry/common.c:51 [inline] arch/x86/entry/common.c:82
 do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Uninit was stored to memory at:
 msg_set_word net/tipc/msg.h:212 [inline]
 msg_set_destport net/tipc/msg.h:619 [inline]
 msg_set_word net/tipc/msg.h:212 [inline] net/tipc/socket.c:1486
 msg_set_destport net/tipc/msg.h:619 [inline] net/tipc/socket.c:1486
 __tipc_sendmsg+0x44fa/0x5890 net/tipc/socket.c:1486 net/tipc/socket.c:1486
 tipc_sendmsg+0xeb/0x140 net/tipc/socket.c:1402 net/tipc/socket.c:1402
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 sock_sendmsg_nosec net/socket.c:704 [inline] net/socket.c:2409
 sock_sendmsg net/socket.c:724 [inline] net/socket.c:2409
 ____sys_sendmsg+0xe11/0x12c0 net/socket.c:2409 net/socket.c:2409
 ___sys_sendmsg net/socket.c:2463 [inline]
 ___sys_sendmsg net/socket.c:2463 [inline] net/socket.c:2492
 __sys_sendmsg+0x704/0x840 net/socket.c:2492 net/socket.c:2492
 __do_sys_sendmsg net/socket.c:2501 [inline]
 __se_sys_sendmsg net/socket.c:2499 [inline]
 __do_sys_sendmsg net/socket.c:2501 [inline] net/socket.c:2499
 __se_sys_sendmsg net/socket.c:2499 [inline] net/socket.c:2499
 __x64_sys_sendmsg+0xe2/0x120 net/socket.c:2499 net/socket.c:2499
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_x64 arch/x86/entry/common.c:51 [inline] arch/x86/entry/common.c:82
 do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Local variable skaddr created at:
 __tipc_sendmsg+0x2d0/0x5890 net/tipc/socket.c:1419 net/tipc/socket.c:1419
 tipc_sendmsg+0xeb/0x140 net/tipc/socket.c:1402 net/tipc/socket.c:1402

Bytes 4-7 of 16 are uninitialized
Memory access of size 16 starts at ffff888113753e00
Data copied to user address 0000000020000280

Reported-by: syzbot+cdbd40e0c3ca02cae3b7@syzkaller.appspotmail.com
Signed-off-by: Haimin Zhang <tcs_kernel@tencent.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Link: https://lore.kernel.org/r/1640918123-14547-1-git-send-email-tcs.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 5e75d0b
History
File Mode Size
partitions
Kconfig -rw-r--r-- 6.5 KB
Kconfig.iosched -rw-r--r-- 1.3 KB
Makefile -rw-r--r-- 1.7 KB
badblocks.c -rw-r--r-- 14.1 KB
bdev.c -rw-r--r-- 27.3 KB
bfq-cgroup.c -rw-r--r-- 38.7 KB
bfq-iosched.c -rw-r--r-- 255.3 KB
bfq-iosched.h -rw-r--r-- 37.4 KB
bfq-wf2q.c -rw-r--r-- 52.7 KB
bio-integrity.c -rw-r--r-- 12.3 KB
bio.c -rw-r--r-- 47.1 KB
blk-cgroup-rwstat.c -rw-r--r-- 3.4 KB
blk-cgroup-rwstat.h -rw-r--r-- 3.9 KB
blk-cgroup.c -rw-r--r-- 50.2 KB
blk-core.c -rw-r--r-- 44.7 KB
blk-crypto-fallback.c -rw-r--r-- 18.7 KB
blk-crypto-internal.h -rw-r--r-- 5.4 KB
blk-crypto-profile.c -rw-r--r-- 16.5 KB
blk-crypto.c -rw-r--r-- 12.0 KB
blk-exec.c -rw-r--r-- 3.0 KB
blk-flush.c -rw-r--r-- 15.3 KB
blk-ia-ranges.c -rw-r--r-- 9.1 KB
blk-integrity.c -rw-r--r-- 11.9 KB
blk-ioc.c -rw-r--r-- 10.1 KB
blk-iocost.c -rw-r--r-- 96.6 KB
blk-iolatency.c -rw-r--r-- 28.0 KB
blk-ioprio.c -rw-r--r-- 6.4 KB
blk-ioprio.h -rw-r--r-- 332 bytes
blk-lib.c -rw-r--r-- 11.5 KB
blk-map.c -rw-r--r-- 14.1 KB
blk-merge.c -rw-r--r-- 31.1 KB
blk-mq-cpumap.c -rw-r--r-- 2.2 KB
blk-mq-debugfs-zoned.c -rw-r--r-- 435 bytes
blk-mq-debugfs.c -rw-r--r-- 22.0 KB
blk-mq-debugfs.h -rw-r--r-- 2.7 KB
blk-mq-pci.c -rw-r--r-- 1.3 KB
blk-mq-rdma.c -rw-r--r-- 1.3 KB
blk-mq-sched.c -rw-r--r-- 17.6 KB
blk-mq-sched.h -rw-r--r-- 2.6 KB
blk-mq-sysfs.c -rw-r--r-- 7.0 KB
blk-mq-tag.c -rw-r--r-- 17.3 KB
blk-mq-tag.h -rw-r--r-- 2.2 KB
blk-mq-virtio.c -rw-r--r-- 1.3 KB
blk-mq.c -rw-r--r-- 109.7 KB
blk-mq.h -rw-r--r-- 10.7 KB
blk-pm.c -rw-r--r-- 6.8 KB
blk-pm.h -rw-r--r-- 763 bytes
blk-rq-qos.c -rw-r--r-- 7.0 KB
blk-rq-qos.h -rw-r--r-- 5.3 KB
blk-settings.c -rw-r--r-- 28.7 KB
blk-stat.c -rw-r--r-- 4.8 KB
blk-stat.h -rw-r--r-- 4.6 KB
blk-sysfs.c -rw-r--r-- 24.4 KB
blk-throttle.c -rw-r--r-- 63.8 KB
blk-throttle.h -rw-r--r-- 5.7 KB
blk-timeout.c -rw-r--r-- 4.1 KB
blk-wbt.c -rw-r--r-- 19.9 KB
blk-wbt.h -rw-r--r-- 2.8 KB
blk-zoned.c -rw-r--r-- 16.7 KB
blk.h -rw-r--r-- 14.7 KB
bounce.c -rw-r--r-- 6.7 KB
bsg-lib.c -rw-r--r-- 9.8 KB
bsg.c -rw-r--r-- 6.1 KB
disk-events.c -rw-r--r-- 12.9 KB
elevator.c -rw-r--r-- 19.3 KB
elevator.h -rw-r--r-- 5.2 KB
fops.c -rw-r--r-- 16.3 KB
genhd.c -rw-r--r-- 35.8 KB
holder.c -rw-r--r-- 4.2 KB
ioctl.c -rw-r--r-- 16.3 KB
ioprio.c -rw-r--r-- 5.5 KB
kyber-iosched.c -rw-r--r-- 27.9 KB
mq-deadline.c -rw-r--r-- 31.6 KB
opal_proto.h -rw-r--r-- 9.4 KB
sed-opal.c -rw-r--r-- 62.5 KB
t10-pi.c -rw-r--r-- 7.7 KB

back to top