In the Linux kernel, the following vulnerability has been resolved:
mptcp: consolidate suboption status
MPTCP maintains the received sub-options status is the bitmask carrying
the received suboptions and in several bitfields carrying per suboption
additional info.
Zeroing the bitmask before parsing is not enough to ensure a consistent
status, and the MPTCP code has to additionally clear some bitfiled
depending on the actually parsed suboption.
The above schema is fragile, and syzbot managed to trigger a path where
a relevant bitfield is not cleared/initialized:
BUG: KMSAN: uninit-value in __mptcp_expand_seq net/mptcp/options.c:1030[inline]BUG: KMSAN: uninit-value in mptcp_expand_seq net/mptcp/protocol.h:864[inline]BUG: KMSAN: uninit-value in ack_update_msk net/mptcp/options.c:1060[inline]BUG: KMSAN: uninit-value in mptcp_incoming_options+0x2036/0x3d30net/mptcp/options.c:1209__mptcp_expand_seqnet/mptcp/options.c:1030[inline]mptcp_expand_seqnet/mptcp/protocol.h:864[inline]ack_update_msknet/mptcp/options.c:1060[inline]mptcp_incoming_options+0x2036/0x3d30net/mptcp/options.c:1209tcp_data_queue+0xb4/0x7be0net/ipv4/tcp_input.c:5233tcp_rcv_established+0x1061/0x2510net/ipv4/tcp_input.c:6264tcp_v4_do_rcv+0x7f3/0x11a0net/ipv4/tcp_ipv4.c:1916tcp_v4_rcv+0x51df/0x5750net/ipv4/tcp_ipv4.c:2351ip_protocol_deliver_rcu+0x2a3/0x13d0net/ipv4/ip_input.c:205ip_local_deliver_finish+0x336/0x500net/ipv4/ip_input.c:233NF_HOOKinclude/linux/netfilter.h:314[inline]ip_local_deliver+0x21f/0x490net/ipv4/ip_input.c:254dst_inputinclude/net/dst.h:460[inline]ip_rcv_finish+0x4a2/0x520net/ipv4/ip_input.c:447NF_HOOKinclude/linux/netfilter.h:314[inline]ip_rcv+0xcd/0x380net/ipv4/ip_input.c:567__netif_receive_skb_one_corenet/core/dev.c:5704[inline]__netif_receive_skb+0x319/0xa00net/core/dev.c:5817process_backlog+0x4ad/0xa50net/core/dev.c:6149__napi_poll+0xe7/0x980net/core/dev.c:6902napi_pollnet/core/dev.c:6971[inline]net_rx_action+0xa5a/0x19b0net/core/dev.c:7093handle_softirqs+0x1a0/0x7c0kernel/softirq.c:561__do_softirq+0x14/0x1akernel/softirq.c:595do_softirq+0x9a/0x100kernel/softirq.c:462__local_bh_enable_ip+0x9f/0xb0kernel/softirq.c:389local_bh_enableinclude/linux/bottom_half.h:33[inline]rcu_read_unlock_bhinclude/linux/rcupdate.h:919[inline]__dev_queue_xmit+0x2758/0x57d0net/core/dev.c:4493dev_queue_xmitinclude/linux/netdevice.h:3168[inline]neigh_hh_outputinclude/net/neighbour.h:523[inline]neigh_outputinclude/net/neighbour.h:537[inline]ip_finish_output2+0x187c/0x1b70net/ipv4/ip_output.c:236__ip_finish_output+0x287/0x810ip_finish_output+0x4b/0x600net/ipv4/ip_output.c:324NF_HOOK_CONDinclude/linux/netfilter.h:303[inline]ip_output+0x15f/0x3f0net/ipv4/ip_output.c:434dst_outputinclude/net/dst.h:450[inline]ip_local_outnet/ipv4/ip_output.c:130[inline]__ip_queue_xmit+0x1f2a/0x20d0net/ipv4/ip_output.c:536ip_queue_xmit+0x60/0x80net/ipv4/ip_output.c:550__tcp_transmit_skb+0x3cea/0x4900net/ipv4/tcp_output.c:1468tcp_transmit_skbnet/ipv4/tcp_output.c:1486[inline]tcp_write_xmit+0x3b90/0x9070net/ipv4/tcp_output.c:2829__tcp_push_pending_frames+0xc4/0x380net/ipv4/tcp_output.c:3012tcp_send_fin+0x9f6/0xf50net/ipv4/tcp_output.c:3618__tcp_close+0x140c/0x1550net/ipv4/tcp.c:3130__mptcp_close_ssk+0x74e/0x16f0net/mptcp/protocol.c:2496mptcp_close_ssk+0x26b/0x2c0net/mptcp/protocol.c:2550mptcp_pm_nl_rm_addr_or_subflow+0x635/0xd10net/mptcp/pm_netlink.c:889mptcp_pm_nl_rm_subflow_receivednet/mptcp/pm_netlink.c:924[inline]mptcp_pm_flush_addrs_and_subflowsnet/mptcp/pm_netlink.c:1688[inline]mptcp_nl_flush_addrs_listnet/mptcp/pm_netlink.c:1709[inline]mptcp_pm_nl_flush_addrs_doit+0xe10/0x1630net/mptcp/pm_netlink.c:1750genl_family_rcv_msg_doitnet/netlink/genetlink.c:1115[inline]