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 D97AE78F2D for ; Sun, 29 Dec 2024 11:30:30 +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=1735471830; cv=none; b=Kv+JievJ+F2uxdcLOsRuM6ZW7G4/klFlmWwiwBdqs8wg32vqmVsVKcrgWane4hIk/AwCNDrCc4CJFFEHJL2biW49tDo7nX3/KFAG+uKiAYddpA1+f4Y1hxi+X4jreh2cmPYXj9ZgQ8pz105PuGjWpsxRtgfNl1lazIITuWhCMJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735471830; c=relaxed/simple; bh=piI4qZ2M7sFwq5y3HpicIMOMkpy75+64yLARzeG9N1E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Hnkb1Sx+jw0cNcErmSItGwFxFdcC9Q2BttHngKn+lo4Kz2cEE+VFb1VC04m9Ngp6ngH/Y60Y8xXk/477l36sxI8tV/0PtDYHAUaqzt/LLVldVoqCPgNhx//KU3IEX8R0d9ATU5NoINQipNMgwJWxpgUr3/wzoZuwL1bekAaLFRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fHbfRnp4; 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="fHbfRnp4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3C54C4CED1; Sun, 29 Dec 2024 11:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735471830; bh=piI4qZ2M7sFwq5y3HpicIMOMkpy75+64yLARzeG9N1E=; h=From:To:Cc:Subject:Date:Reply-to:From; b=fHbfRnp4ZJNnq5gHn51ddnWTGGNelvcWBRc+k4WvEWjey+0xV1StGV7NuefLNJ9Dl a1L1h7dBvt40bXn/5ILzEfV8cW1colqEpCbt525D+gQ5N+YZDln2XT06V5UiiAe1hj AGBCeKL3YSMXyF1jctxVMwA97YhxiEqvhNkU+584= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56740: nfs/localio: must clear res.replen in nfs_local_read_done Date: Sun, 29 Dec 2024 12:29:33 +0100 Message-ID: <2024122925-CVE-2024-56740-6b7b@gregkh> X-Mailer: git-send-email 2.47.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=2673; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=piI4qZ2M7sFwq5y3HpicIMOMkpy75+64yLARzeG9N1E=; b=owGbwMvMwCRo6H6F97bub03G02pJDOmFRlOPLdTfWDdJO9RiFsOfrfuKm/sPh3/afm3lJJZ05 ReONfs3dcSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBE5P8xLOhRFJ34XV/5QfTj P7kNf7PfPgnymcSw4FCcvVtc1RvGa3M6P3RJNsQH94vNAwA= 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: nfs/localio: must clear res.replen in nfs_local_read_done Otherwise memory corruption can occur due to NFSv3 LOCALIO reads leaving garbage in res.replen: - nfs3_read_done() copies that into server->read_hdrsize; from there nfs3_proc_read_setup() copies it to args.replen in new requests. - nfs3_xdr_enc_read3args() passes that to rpc_prepare_reply_pages() which includes it in hdrsize for xdr_init_pages, so that rq_rcv_buf contains a ridiculous len. - This is copied to rq_private_buf and xs_read_stream_request() eventually passes the kvec to sock_recvmsg() which receives incoming data into entirely the wrong place. This is easily reproduced with NFSv3 LOCALIO that is servicing reads when it is made to pivot back to using normal RPC. This switch back to using normal NFSv3 with RPC can occur for a few reasons but this issue was exposed with a test that stops and then restarts the NFSv3 server while LOCALIO is performing heavy read IO. The Linux kernel CVE team has assigned CVE-2024-56740 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit 70ba381e1a431245c137ed597ec6a05991c79bd9 and fixed in 6.12.2 with commit de5dac261eeab99762bbdf7c20cee5d26ef4462e Issue introduced in 6.12 with commit 70ba381e1a431245c137ed597ec6a05991c79bd9 and fixed in 6.13-rc1 with commit 650703bc4ed3edf841e851c99ab8e7ba9e5262a3 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-56740 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: fs/nfs/localio.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/de5dac261eeab99762bbdf7c20cee5d26ef4462e https://git.kernel.org/stable/c/650703bc4ed3edf841e851c99ab8e7ba9e5262a3