Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795060321; b=qbwz/IDtndUUbS5JiOpHFUZI41Z7Ov/G7BxFVwKbtMfqi+9dLPKrDjE4Az7J543kyKae WPzN1nuVfnK+IfPUFdkFEcrfpGite4SOIQEhj/vF714uv7KYheaAHXtJiZe3OkJbs61iE 7QoDqPwVLAzI6jEgfOSXALvhDG7A0VoOHGXqEiemWDUcSuwE2g7FT/oRP5wLKhLTNMiDr P4ZE/Yeuqk8adeZaDPrJDhETHqmR72MjwnciVE/KMTAjKQ2hRqA/H2V3AMJ9o3ia24fuI FlyhSmzAQKgfVQGahJ/RJuG2c795Ll5Zkb7WjXJilEcpdHN1aJJD/zg6jCD+m06Ky1Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795060321; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Y8eOEtcfAFZ8NSQdSlVNqjBzC6oskzwePxLl/l2iBys=; b=Kpqt0n+8UPKoajrohXiALVfAzgdilhVwDmqAYggvFEu9fWfT+gZTE5rpRWGQ5mKhGRo2 HzS8vdVgT8QxvzswRraU166CUXhqOpuquvpw4MMcLJ9dqMnWn5NGPV1EhKQNbuLH5fFsZ 4u/L9XRRpZ6/wTcZD90cw/dbQLIH+goVpmoecGal2lXxCrBKbmC5ZmgiKsTj2ccbZaWeA qFpIHb9w0gSDAow0vq/apVjO8p54Jw28J3nPelILz91AwQJbcA+p8NqtYJk/fNpeV1ZRa Dei2uPcSDQPY+uVMTUvdPzIsPp/l3PQSeOo7HBVej3QNfb213naThP9N/MZLPGIghvQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ao4fSS4O; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23F1E606A320; Thu, 19 Nov 2026 03:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ao4fSS4O Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D3741F000C4; Thu, 19 Nov 2026 03:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795060321; bh=Y8eOEtcfAFZ8NSQdSlVNqjBzC6oskzwePxLl/l2iBys=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ao4fSS4O7crFtaPcPJTqlyxOeO8jD+6KkSrkUfLs9cYTiME+io2Jpfo4NVd51SKFX 8v9kAsLNdv2bYXtuTPMa2RXGmkaPOUdBFANiSC/KIxmVGiuWK7HT98sPx29IJTNivC kxUCa863fXy9ECStZJxAfkBSMPmdocua0TZS/LLQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrew Kanner , Paul Moore , Petr Vaganov , Sasha Levin Subject: [PATCH 5.10 1106/1848] selinux: prevent KMSAN warning in selinux_inet_conn_request() Date: Wed, 18 Nov 2026 15:52:24 +0100 Message-ID: <20261118150005.637953393@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118145911.150052362@linuxfoundation.org> References: <20261118145911.150052362@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Kanner commit 1df83cbf23a27174aee6ea5e52462f03f7e48a10 upstream. KMSAN reports the following issue: [ 81.822503] ===================================================== [ 81.823222] BUG: KMSAN: uninit-value in selinux_inet_conn_request+0x2c8/0x4b0 [ 81.823891] selinux_inet_conn_request+0x2c8/0x4b0 [ 81.824385] security_inet_conn_request+0xc0/0x160 [ 81.824886] tcp_v4_route_req+0x30e/0x490 [ 81.825343] tcp_conn_request+0xdc8/0x3400 [ 81.825813] tcp_v4_conn_request+0x134/0x190 [ 81.826292] tcp_rcv_state_process+0x1f4/0x3b40 [ 81.826797] tcp_v4_do_rcv+0x9ca/0xc30 [ 81.827236] tcp_v4_rcv+0x3bf5/0x4180 [ 81.827670] ip_protocol_deliver_rcu+0x822/0x1230 [ 81.828174] ip_local_deliver_finish+0x259/0x370 [ 81.828667] ip_local_deliver+0x1c0/0x450 [ 81.829105] ip_sublist_rcv+0xdc1/0xf50 [ 81.829534] ip_list_rcv+0x72e/0x790 [ 81.829941] __netif_receive_skb_list_core+0x10d5/0x1180 [ 81.830499] netif_receive_skb_list_internal+0xc41/0x1190 [ 81.831064] napi_complete_done+0x2c4/0x8b0 [ 81.831532] e1000_clean+0x12bf/0x4d90 [ 81.831983] __napi_poll+0xa6/0x760 [ 81.832391] net_rx_action+0x84c/0x1550 [ 81.832831] __do_softirq+0x272/0xa6c [ 81.833239] __irq_exit_rcu+0xb7/0x1a0 [ 81.833654] irq_exit_rcu+0x17/0x40 [ 81.834044] common_interrupt+0x8d/0xa0 [ 81.834494] asm_common_interrupt+0x2b/0x40 [ 81.834949] default_idle+0x17/0x20 [ 81.835356] arch_cpu_idle+0xd/0x20 [ 81.835766] default_idle_call+0x43/0x70 [ 81.836210] do_idle+0x258/0x800 [ 81.836581] cpu_startup_entry+0x26/0x30 [ 81.837002] __pfx_ap_starting+0x0/0x10 [ 81.837444] secondary_startup_64_no_verify+0x17a/0x17b [ 81.837979] [ 81.838166] Local variable nlbl_type.i created at: [ 81.838596] selinux_inet_conn_request+0xe3/0x4b0 [ 81.839078] security_inet_conn_request+0xc0/0x160 KMSAN warning is reproducible with: * netlabel_mgmt_protocount is 0 (e.g. netlbl_enabled() returns 0) * CONFIG_SECURITY_NETWORK_XFRM may be set or not * CONFIG_KMSAN=y * `ssh USER@HOSTNAME /bin/date` selinux_skb_peerlbl_sid() will call selinux_xfrm_skb_sid(), then fall to selinux_netlbl_skbuff_getsid() which will not initialize nlbl_type, but it will be passed to: err = security_net_peersid_resolve(nlbl_sid, nlbl_type, xfrm_sid, sid); and checked by KMSAN, although it will not be used inside security_net_peersid_resolve() (at least now), since this function will check either (xfrm_sid == SECSID_NULL) or (nlbl_sid == SECSID_NULL) first and return before using uninitialized nlbl_type. Signed-off-by: Andrew Kanner [PM: subject line tweak, removed 'fixes' tag as code is not broken] Signed-off-by: Paul Moore Signed-off-by: Petr Vaganov Signed-off-by: Sasha Levin --- security/selinux/netlabel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c index 6a94b31b54721..e5af391023baf 100644 --- a/security/selinux/netlabel.c +++ b/security/selinux/netlabel.c @@ -195,6 +195,7 @@ int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, struct netlbl_lsm_secattr secattr; if (!netlbl_enabled()) { + *type = NETLBL_NLTYPE_NONE; *sid = SECSID_NULL; return 0; } -- 2.53.0