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 0485131B80A for ; Fri, 5 Sep 2025 17:22:55 +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=1757092975; cv=none; b=ONN7qh3SrvNfi+cBkrMfCbsOi+YO0qKUhWKG4vqSMHEmQB0cizmaO77+SJcZ7z9lNjo6c+lUueUkjahoevmviBtxME0jQ6nyoVD+JDyQNyTWp8ivklu/zExcd81xn+osceyxysMGL02FtHfe+2DR0sUulpylSyJhWe8TTbMzpms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757092975; c=relaxed/simple; bh=tfUL8/fNrPL2J0Ig89neyyfEN8ffwNs/8oogFocCmLg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cjqmsGtR2APauLhjtHHlLqBPlheRpR+Q8/Iu8kKeqf7oR63dRqsTQDT9RsHRf+6M2nEfYujQQfzm09QcrLiaBLHcnbRlwvgjWQ2OT1D654xiFSMrZZrm+j2QMXQHM3p7Ft0PD4AR4DjJVUN/lfjI9/wFr9xua73akmZIqOlPDS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=av1bYmCX; 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="av1bYmCX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45D5FC4CEF1; Fri, 5 Sep 2025 17:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757092974; bh=tfUL8/fNrPL2J0Ig89neyyfEN8ffwNs/8oogFocCmLg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=av1bYmCXCrXRiyywxf0iRzBE9hrSOK9iJtFaePRfilXh37968L/K5u4I+52bKlA8L /2QBgh65HBJ+3Umztrhza/w9cS+e7ykN/S+uhqmHo+JNDBoxApyS24eEx58VwSz5h5 RI0F68gt5xGWOT6Jgoctg2x1deD9qnJd9gYXGgTA= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38734: net/smc: fix UAF on smcsk after smc_listen_out() Date: Fri, 5 Sep 2025 19:20:43 +0200 Message-ID: <2025090543-CVE-2025-38734-a75f@gregkh> X-Mailer: git-send-email 2.51.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=5938; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ccdhXbVY+BPT846ekUxHgGkZoyFELkvKyJ24cPgFXOY=; b=owGbwMvMwCRo6H6F97bub03G02pJDBm7pV9/PCF/SkK9/2jkwcQ9FT8EWF+ruN43l9l2P+Fw3 oa8lJvXOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAik5YyLLi2Q8FS8drEnz3+ 1rGi/z04J79n82eYp5ee0pU5PWKdvcmzh/tsPkhsds1kAwA= 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: net/smc: fix UAF on smcsk after smc_listen_out() BPF CI testing report a UAF issue: [ 16.446633] BUG: kernel NULL pointer dereference, address: 000000000000003 0 [ 16.447134] #PF: supervisor read access in kernel mod e [ 16.447516] #PF: error_code(0x0000) - not-present pag e [ 16.447878] PGD 0 P4D 0 [ 16.448063] Oops: Oops: 0000 [#1] PREEMPT SMP NOPT I [ 16.448409] CPU: 0 UID: 0 PID: 9 Comm: kworker/0:1 Tainted: G OE 6.13.0-rc3-g89e8a75fda73-dirty #4 2 [ 16.449124] Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODUL E [ 16.449502] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/201 4 [ 16.450201] Workqueue: smc_hs_wq smc_listen_wor k [ 16.450531] RIP: 0010:smc_listen_work+0xc02/0x159 0 [ 16.452158] RSP: 0018:ffffb5ab40053d98 EFLAGS: 0001024 6 [ 16.452526] RAX: 0000000000000001 RBX: 0000000000000002 RCX: 000000000000030 0 [ 16.452994] RDX: 0000000000000280 RSI: 00003513840053f0 RDI: 000000000000000 0 [ 16.453492] RBP: ffffa097808e3800 R08: ffffa09782dba1e0 R09: 000000000000000 5 [ 16.453987] R10: 0000000000000000 R11: 0000000000000000 R12: ffffa0978274640 0 [ 16.454497] R13: 0000000000000000 R14: 0000000000000000 R15: ffffa09782d4092 0 [ 16.454996] FS: 0000000000000000(0000) GS:ffffa097bbc00000(0000) knlGS:000000000000000 0 [ 16.455557] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003 3 [ 16.455961] CR2: 0000000000000030 CR3: 0000000102788004 CR4: 0000000000770ef 0 [ 16.456459] PKRU: 5555555 4 [ 16.456654] Call Trace : [ 16.456832] [ 16.456989] ? __die+0x23/0x7 0 [ 16.457215] ? page_fault_oops+0x180/0x4c 0 [ 16.457508] ? __lock_acquire+0x3e6/0x249 0 [ 16.457801] ? exc_page_fault+0x68/0x20 0 [ 16.458080] ? asm_exc_page_fault+0x26/0x3 0 [ 16.458389] ? smc_listen_work+0xc02/0x159 0 [ 16.458689] ? smc_listen_work+0xc02/0x159 0 [ 16.458987] ? lock_is_held_type+0x8f/0x10 0 [ 16.459284] process_one_work+0x1ea/0x6d 0 [ 16.459570] worker_thread+0x1c3/0x38 0 [ 16.459839] ? __pfx_worker_thread+0x10/0x1 0 [ 16.460144] kthread+0xe0/0x11 0 [ 16.460372] ? __pfx_kthread+0x10/0x1 0 [ 16.460640] ret_from_fork+0x31/0x5 0 [ 16.460896] ? __pfx_kthread+0x10/0x1 0 [ 16.461166] ret_from_fork_asm+0x1a/0x3 0 [ 16.461453] [ 16.461616] Modules linked in: bpf_testmod(OE) [last unloaded: bpf_testmod(OE) ] [ 16.462134] CR2: 000000000000003 0 [ 16.462380] ---[ end trace 0000000000000000 ]--- [ 16.462710] RIP: 0010:smc_listen_work+0xc02/0x1590 The direct cause of this issue is that after smc_listen_out_connected(), newclcsock->sk may be NULL since it will releases the smcsk. Therefore, if the application closes the socket immediately after accept, newclcsock->sk can be NULL. A possible execution order could be as follows: smc_listen_work | userspace ----------------------------------------------------------------- lock_sock(sk) | smc_listen_out_connected() | | \- smc_listen_out | | | \- release_sock | | |- sk->sk_data_ready() | | fd = accept(); | close(fd); | \- socket->sk = NULL; /* newclcsock->sk is NULL now */ SMC_STAT_SERV_SUCC_INC(sock_net(newclcsock->sk)) Since smc_listen_out_connected() will not fail, simply swapping the order of the code can easily fix this issue. The Linux kernel CVE team has assigned CVE-2025-38734 to this issue. Affected and fixed versions =========================== Issue introduced in 4.18 with commit 3b2dec2603d5b06ad3af71c1164ca0b92df3d2a8 and fixed in 6.6.103 with commit 070b4af44c4b6e4c35fb1ca7001a6a88fd2d318f Issue introduced in 4.18 with commit 3b2dec2603d5b06ad3af71c1164ca0b92df3d2a8 and fixed in 6.12.44 with commit 2e765ba0ee0eae35688b443e97108308a716773e Issue introduced in 4.18 with commit 3b2dec2603d5b06ad3af71c1164ca0b92df3d2a8 and fixed in 6.16.4 with commit 85545f1525f9fa9bf44fec77ba011024f15da342 Issue introduced in 4.18 with commit 3b2dec2603d5b06ad3af71c1164ca0b92df3d2a8 and fixed in 6.17-rc3 with commit d9cef55ed49117bd63695446fb84b4b91815c0b4 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-38734 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/smc/af_smc.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/070b4af44c4b6e4c35fb1ca7001a6a88fd2d318f https://git.kernel.org/stable/c/2e765ba0ee0eae35688b443e97108308a716773e https://git.kernel.org/stable/c/85545f1525f9fa9bf44fec77ba011024f15da342 https://git.kernel.org/stable/c/d9cef55ed49117bd63695446fb84b4b91815c0b4