Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD695187562 for ; Thu, 30 May 2024 15:30:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717083029; cv=none; b=rRc28yrOAzWjwCUxm3J6FyqzyCQQUmAZTSpi4pKVUGwv5HyzToheqg7+OcpIU183tIKcZIf0ULye7ahwlZAYzSDlsADMQwd+ikWmtaMC/6KWYPckACeO8pmU5J+L1rVOU/T/3JWTyW0xahBAOwP55inzgY8ASJwZoviKBHmflyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717083029; c=relaxed/simple; bh=TY9F7Qsc0h8pv/5L3B1/RtLj1gX100oEGIEp2Jpx4vA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UoctZp9vNjrUXZty3RxY2iZSQ5hwqp4r5hCcMB5uUXEcEg9x9oRYX/htkzKwta8Klyr01pbJM39Ta49u0lM2g0dyMvsdsypLQQ6h5vFTryNz7XXia5uulPBtgJ68AlizXFOTNKPpugseYGdgLQ0+4uLYj7ZHErBY6+jMdOa78/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BO0JPCSq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BO0JPCSq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D85DC32781; Thu, 30 May 2024 15:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1717083029; bh=TY9F7Qsc0h8pv/5L3B1/RtLj1gX100oEGIEp2Jpx4vA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=BO0JPCSqhWljAJKRvoGsw0w+RnsgtyScZu2YcdRga+79uyg/A/9W4dMfwpbQ60jxh 6xvZfFvSFZdeBXeRQyDkQwofxmjLxyXI/L72s7PFug1pCeODyFV+fbraEisVr2n1Hp e83ZWjU/nExnL4F9ltzTFn7VKaS2fHO23LP5r4bI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-36927: ipv4: Fix uninit-value access in __ip_make_skb() Date: Thu, 30 May 2024 17:29:19 +0200 Message-ID: <2024053040-CVE-2024-36927-976e@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4788; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=TY9F7Qsc0h8pv/5L3B1/RtLj1gX100oEGIEp2Jpx4vA=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkRszXMZr7Y/GyC5qG5TBOfJgpeb9MPfljLeidfcK69Q JeqT/qZjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjI7fcM8727kqe/3GF/pGdO 7KQbpj9aLdz/7GaYn+f+2Gxn0sTVTWtVrUuSe1JMFvBeBAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: ipv4: Fix uninit-value access in __ip_make_skb() KMSAN reported uninit-value access in __ip_make_skb() [1]. __ip_make_skb() tests HDRINCL to know if the skb has icmphdr. However, HDRINCL can cause a race condition. If calling setsockopt(2) with IP_HDRINCL changes HDRINCL while __ip_make_skb() is running, the function will access icmphdr in the skb even if it is not included. This causes the issue reported by KMSAN. Check FLOWI_FLAG_KNOWN_NH on fl4->flowi4_flags instead of testing HDRINCL on the socket. Also, fl4->fl4_icmp_type and fl4->fl4_icmp_code are not initialized. These are union in struct flowi4 and are implicitly initialized by flowi4_init_output(), but we should not rely on specific union layout. Initialize these explicitly in raw_sendmsg(). [1] BUG: KMSAN: uninit-value in __ip_make_skb+0x2b74/0x2d20 net/ipv4/ip_output.c:1481 __ip_make_skb+0x2b74/0x2d20 net/ipv4/ip_output.c:1481 ip_finish_skb include/net/ip.h:243 [inline] ip_push_pending_frames+0x4c/0x5c0 net/ipv4/ip_output.c:1508 raw_sendmsg+0x2381/0x2690 net/ipv4/raw.c:654 inet_sendmsg+0x27b/0x2a0 net/ipv4/af_inet.c:851 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x274/0x3c0 net/socket.c:745 __sys_sendto+0x62c/0x7b0 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x130/0x200 net/socket.c:2199 do_syscall_64+0xd8/0x1f0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 Uninit was created at: slab_post_alloc_hook mm/slub.c:3804 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc_node+0x5f6/0xc50 mm/slub.c:3888 kmalloc_reserve+0x13c/0x4a0 net/core/skbuff.c:577 __alloc_skb+0x35a/0x7c0 net/core/skbuff.c:668 alloc_skb include/linux/skbuff.h:1318 [inline] __ip_append_data+0x49ab/0x68c0 net/ipv4/ip_output.c:1128 ip_append_data+0x1e7/0x260 net/ipv4/ip_output.c:1365 raw_sendmsg+0x22b1/0x2690 net/ipv4/raw.c:648 inet_sendmsg+0x27b/0x2a0 net/ipv4/af_inet.c:851 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x274/0x3c0 net/socket.c:745 __sys_sendto+0x62c/0x7b0 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x130/0x200 net/socket.c:2199 do_syscall_64+0xd8/0x1f0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 CPU: 1 PID: 15709 Comm: syz-executor.7 Not tainted 6.8.0-11567-gb3603fcb79b1 #25 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014 The Linux kernel CVE team has assigned CVE-2024-36927 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit 99e5acae193e and fixed in 6.6.31 with commit 5db08343ddb1 Issue introduced in 6.4 with commit 99e5acae193e and fixed in 6.8.10 with commit f5c603ad4e6f Issue introduced in 6.4 with commit 99e5acae193e and fixed in 6.9 with commit fc1092f51567 Issue introduced in 4.14.315 with commit dc4e3bb07101 Issue introduced in 4.19.283 with commit 022ea4374c31 Issue introduced in 5.4.243 with commit 27c468ec1af1 Issue introduced in 5.10.180 with commit 566785731c6d Issue introduced in 5.15.111 with commit a54ec573d9b8 Issue introduced in 6.1.28 with commit fc60067260c2 Issue introduced in 6.2.15 with commit 32a5a13d556e Issue introduced in 6.3.2 with commit 9e3c96aed8fe Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-36927 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/ipv4/ip_output.c net/ipv4/raw.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/5db08343ddb1b239320612036c398e4e1bb52818 https://git.kernel.org/stable/c/f5c603ad4e6fcf42f84053e882ebe20184bb309e https://git.kernel.org/stable/c/fc1092f51567277509563800a3c56732070b6aa4