Alexander Potapenko
e558e14893
tipc: fix an information leak in tipc_topsrv_kern_subscr
[ Upstream commit 777ecaabd614d47c482a5c9031579e66da13989a ]
Use a 8-byte write to initialize sub.usr_handle in
tipc_topsrv_kern_subscr(), otherwise four bytes remain uninitialized
when issuing setsockopt(..., SOL_TIPC, ...).
This resulted in an infoleak reported by KMSAN when the packet was
received:
=====================================================
BUG: KMSAN: kernel-infoleak in copyout+0xbc/0x100 lib/iov_iter.c:169
instrument_copy_to_user ./include/linux/instrumented.h:121
copyout+0xbc/0x100 lib/iov_iter.c:169
_copy_to_iter+0x5c0/0x20a0 lib/iov_iter.c:527
copy_to_iter ./include/linux/uio.h:176
simple_copy_to_iter+0x64/0xa0 net/core/datagram.c:513
__skb_datagram_iter+0x123/0xdc0 net/core/datagram.c:419
skb_copy_datagram_iter+0x58/0x200 net/core/datagram.c:527
skb_copy_datagram_msg ./include/linux/skbuff.h:3903
packet_recvmsg+0x521/0x1e70 net/packet/af_packet.c:3469
____sys_recvmsg+0x2c4/0x810 net/socket.c:?
___sys_recvmsg+0x217/0x840 net/socket.c:2743
__sys_recvmsg net/socket.c:2773
__do_sys_recvmsg net/socket.c:2783
__se_sys_recvmsg net/socket.c:2780
__x64_sys_recvmsg+0x364/0x540 net/socket.c:2780
do_syscall_x64 arch/x86/entry/common.c:50
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd arch/x86/entry/entry_64.S:120
...
Uninit was stored to memory at:
tipc_sub_subscribe+0x42d/0xb50 net/tipc/subscr.c:156
tipc_conn_rcv_sub+0x246/0x620 net/tipc/topsrv.c:375
tipc_topsrv_kern_subscr+0x2e8/0x400 net/tipc/topsrv.c:579
tipc_group_create+0x4e7/0x7d0 net/tipc/group.c:190
tipc_sk_join+0x2a8/0x770 net/tipc/socket.c:3084
tipc_setsockopt+0xae5/0xe40 net/tipc/socket.c:3201
__sys_setsockopt+0x87f/0xdc0 net/socket.c:2252
__do_sys_setsockopt net/socket.c:2263
__se_sys_setsockopt net/socket.c:2260
__x64_sys_setsockopt+0xe0/0x160 net/socket.c:2260
do_syscall_x64 arch/x86/entry/common.c:50
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd arch/x86/entry/entry_64.S:120
Local variable sub created at:
tipc_topsrv_kern_subscr+0x57/0x400 net/tipc/topsrv.c:562
tipc_group_create+0x4e7/0x7d0 net/tipc/group.c:190
Bytes 84-87 of 88 are uninitialized
Memory access of size 88 starts at ffff88801ed57cd0
Data copied to user address 0000000020000400
...
=====================================================
Signed-off-by: Alexander Potapenko <glider@google.com>
Fixes: 026321c6d056a5 ("tipc: rename tipc_server to tipc_topsrv")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-30 09:41:16 +01:00
..
2021-09-15 09:50:34 +02:00
2022-08-21 15:16:26 +02:00
2021-07-31 08:16:11 +02:00
2022-07-29 17:19:07 +02:00
2021-04-07 15:00:08 +02:00
2020-10-31 12:26:30 -07:00
2022-06-22 14:13:17 +02:00
2022-05-18 10:23:42 +02:00
2022-10-26 13:25:47 +02:00
2022-09-05 10:28:56 +02:00
2021-07-14 16:56:29 +02:00
2022-09-28 11:10:36 +02:00
2021-09-22 12:27:56 +02:00
2022-10-26 13:25:47 +02:00
2022-05-25 09:17:56 +02:00
2022-10-26 13:25:47 +02:00
2022-03-08 19:09:37 +01:00
2022-08-21 15:15:52 +02:00
2022-08-31 17:15:19 +02:00
2020-04-28 14:39:46 -07:00
2022-05-09 09:05:02 +02:00
2020-05-23 16:56:17 -07:00
2021-12-17 10:14:41 +01:00
2021-06-03 09:00:50 +02:00
2022-10-26 13:25:55 +02:00
2019-09-26 08:56:17 +02:00
2022-10-26 13:25:56 +02:00
2022-10-26 13:25:56 +02:00
2021-03-07 12:34:05 +01:00
2022-09-08 11:11:37 +02:00
2022-08-31 17:15:15 +02:00
2022-06-22 14:13:15 +02:00
2022-04-27 13:53:50 +02:00
2021-02-10 09:29:14 +01:00
2022-03-28 09:57:10 +02:00
2022-10-26 13:25:19 +02:00
2022-09-08 11:11:40 +02:00
2022-09-08 11:11:40 +02:00
2022-08-31 17:15:19 +02:00
2022-01-05 12:40:32 +01:00
2022-09-28 11:10:35 +02:00
2022-04-13 21:01:00 +02:00
2022-08-25 11:38:07 +02:00
2022-01-27 10:54:03 +01:00
2022-06-09 10:21:01 +02:00
2020-06-14 01:57:21 +09:00
2022-10-26 13:25:45 +02:00
2022-09-05 10:28:59 +02:00
2022-01-11 15:25:01 +01:00
2021-03-07 12:34:07 +01:00
2022-08-25 11:38:23 +02:00
2022-10-26 13:25:23 +02:00
2020-11-12 09:18:06 +01:00
2022-08-31 17:15:16 +02:00
2022-09-23 14:16:59 +02:00
2022-10-05 10:38:42 +02:00
2022-10-26 13:25:23 +02:00
2022-09-28 11:10:36 +02:00
2021-11-18 14:04:27 +01:00
2022-08-31 17:15:15 +02:00
2021-02-07 15:37:12 +01:00
2022-10-30 09:41:16 +01:00
2022-08-03 12:00:46 +02:00
2022-10-26 13:25:55 +02:00
2022-10-26 13:25:22 +02:00
2020-10-02 19:11:11 -07:00
2022-10-15 07:55:56 +02:00
2022-04-08 14:40:30 +02:00
2022-10-15 07:55:51 +02:00
2022-10-26 13:25:46 +02:00
2021-06-18 10:00:06 +02:00
2020-06-30 15:57:34 -07:00
2020-09-30 18:01:26 -07:00
2020-05-23 16:56:17 -07:00
2022-08-31 17:15:21 +02:00