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 41BF829A9E4 for ; Thu, 3 Jul 2025 08:37:47 +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=1751531867; cv=none; b=Lzy95tYb6XTsn1dqxEB7m9xMt0UtkiFNglbLue8TOwTs5V0wogm14w7L3MB38+Hw2XadZyqTa8guYM3siy1adqFqDnzGhGMj48NB3qx/4+cO+cOIXuTZpQlyjxOs/EQQyGc5GV5taEXaghlNMI6GbJtJYzaykoLrbN1tvGp0FMo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751531867; c=relaxed/simple; bh=Rt7om1YiH6LHc5QvTB5LJuaxVLf04jFlE8SdCnVnXfg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D5nydoLXanOAcnxzYSHnRZKechDOs/1qoGNViB++fb+l+ALoVb8wdpIxU02lNYfabXxnbWvxsN7BGPdB5z9FODq69oNfYmE63v1FMB2IkIKTIAzSQJUXjbzrL/tTxZ2NXfVUhcJ2TExcSOU2nAh8lAEJl8JjyuLW1R8XkP+Xmg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KOmdcNMK; 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="KOmdcNMK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6DEDC4CEE3; Thu, 3 Jul 2025 08:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751531867; bh=Rt7om1YiH6LHc5QvTB5LJuaxVLf04jFlE8SdCnVnXfg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=KOmdcNMKkUsKj+1ABmYE0d7/3caABSqT4c4yJJ6oaiXvkqPFRjKIYif7sF83kENkx RSqLDQHBuQj8wrdqsY2Ugc7+D1+qk6V+ApiMnC1pPWyudyPyy6SlcFSbS6/TUD6zRB g27rBYv1i7E/TyWTSx3XTjRMZKVb3P81ehVeRpGI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38147: calipso: Don't call calipso functions for AF_INET sk. Date: Thu, 3 Jul 2025 10:36:04 +0200 Message-ID: <2025070335-CVE-2025-38147-52a6@gregkh> X-Mailer: git-send-email 2.50.0 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=6745; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Z0b9R8rQ5rHJaYaVdkIlg3y2wKkuCD+bI3AxebFeRH0=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlpDte1rxx74zvF+sFVU1OVUypXeblb9/As3Hkk2ujVr CmFXN5HO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiK7oY5kruXymWujWFPXfb 7DeX3NZrWyt/k2NYMKVp1vnCX8nzp/xJ1UvZmF2knyPmAgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: calipso: Don't call calipso functions for AF_INET sk. syzkaller reported a null-ptr-deref in txopt_get(). [0] The offset 0x70 was of struct ipv6_txoptions in struct ipv6_pinfo, so struct ipv6_pinfo was NULL there. However, this never happens for IPv6 sockets as inet_sk(sk)->pinet6 is always set in inet6_create(), meaning the socket was not IPv6 one. The root cause is missing validation in netlbl_conn_setattr(). netlbl_conn_setattr() switches branches based on struct sockaddr.sa_family, which is passed from userspace. However, netlbl_conn_setattr() does not check if the address family matches the socket. The syzkaller must have called connect() for an IPv6 address on an IPv4 socket. We have a proper validation in tcp_v[46]_connect(), but security_socket_connect() is called in the earlier stage. Let's copy the validation to netlbl_conn_setattr(). [0]: Oops: general protection fault, probably for non-canonical address 0xdffffc000000000e: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000070-0x0000000000000077] CPU: 2 UID: 0 PID: 12928 Comm: syz.9.1677 Not tainted 6.12.0 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:txopt_get include/net/ipv6.h:390 [inline] RIP: 0010: Code: 02 00 00 49 8b ac 24 f8 02 00 00 e8 84 69 2a fd e8 ff 00 16 fd 48 8d 7d 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 53 02 00 00 48 8b 6d 70 48 85 ed 0f 84 ab 01 00 RSP: 0018:ffff88811b8afc48 EFLAGS: 00010212 RAX: dffffc0000000000 RBX: 1ffff11023715f8a RCX: ffffffff841ab00c RDX: 000000000000000e RSI: ffffc90007d9e000 RDI: 0000000000000070 RBP: 0000000000000000 R08: ffffed1023715f9d R09: ffffed1023715f9e R10: ffffed1023715f9d R11: 0000000000000003 R12: ffff888123075f00 R13: ffff88810245bd80 R14: ffff888113646780 R15: ffff888100578a80 FS: 00007f9019bd7640(0000) GS:ffff8882d2d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f901b927bac CR3: 0000000104788003 CR4: 0000000000770ef0 PKRU: 80000000 Call Trace: calipso_sock_setattr+0x56/0x80 net/netlabel/netlabel_calipso.c:557 netlbl_conn_setattr+0x10c/0x280 net/netlabel/netlabel_kapi.c:1177 selinux_netlbl_socket_connect_helper+0xd3/0x1b0 security/selinux/netlabel.c:569 selinux_netlbl_socket_connect_locked security/selinux/netlabel.c:597 [inline] selinux_netlbl_socket_connect+0xb6/0x100 security/selinux/netlabel.c:615 selinux_socket_connect+0x5f/0x80 security/selinux/hooks.c:4931 security_socket_connect+0x50/0xa0 security/security.c:4598 __sys_connect_file+0xa4/0x190 net/socket.c:2067 __sys_connect+0x12c/0x170 net/socket.c:2088 __do_sys_connect net/socket.c:2098 [inline] __se_sys_connect net/socket.c:2095 [inline] __x64_sys_connect+0x73/0xb0 net/socket.c:2095 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xaa/0x1b0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f901b61a12d Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9019bd6fa8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 00007f901b925fa0 RCX: 00007f901b61a12d RDX: 000000000000001c RSI: 0000200000000140 RDI: 0000000000000003 RBP: 00007f901b701505 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f901b5b62a0 R15: 00007f9019bb7000 Modules linked in: The Linux kernel CVE team has assigned CVE-2025-38147 to this issue. Affected and fixed versions =========================== Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 5.4.295 with commit fc2da88411470480b8b7e9177e930cedd893cf56 Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 5.10.239 with commit 0c813dbc851dbf418fdc6dc883fd0592d6c555cd Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 5.15.186 with commit 26ce90f1ce60b0ff587de8d6aec399aa55cab28e Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 6.1.142 with commit c32ebe33626335a536dbbdd09571c06dd9bc1729 Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 6.6.94 with commit 946bfdfcb76ac2bac5b8526447035885ff41c598 Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 6.12.34 with commit dd8928897594931d6912ef2f7a43e110b4958d3d Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 6.15.3 with commit e2ec310c7a50271843c585e27ef14e48c66ce649 Issue introduced in 4.8 with commit ceba1832b1b2da0149c51de62a847c00bca1677a and fixed in 6.16-rc1 with commit 6e9f2df1c550ead7cecb3e450af1105735020c92 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-2025-38147 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/netlabel/netlabel_kapi.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/fc2da88411470480b8b7e9177e930cedd893cf56 https://git.kernel.org/stable/c/0c813dbc851dbf418fdc6dc883fd0592d6c555cd https://git.kernel.org/stable/c/26ce90f1ce60b0ff587de8d6aec399aa55cab28e https://git.kernel.org/stable/c/c32ebe33626335a536dbbdd09571c06dd9bc1729 https://git.kernel.org/stable/c/946bfdfcb76ac2bac5b8526447035885ff41c598 https://git.kernel.org/stable/c/dd8928897594931d6912ef2f7a43e110b4958d3d https://git.kernel.org/stable/c/e2ec310c7a50271843c585e27ef14e48c66ce649 https://git.kernel.org/stable/c/6e9f2df1c550ead7cecb3e450af1105735020c92