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 209E145BEF for ; Sat, 2 Mar 2024 22:01: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=1709416889; cv=none; b=OmSw14gUuAad/kLYDFhg10ovZFODJcwpr2BKHq8MRd/usz7kEOPc6TWS25nPbQWDrvRfItYt9O2v8frtm0cmtJo3g6qaeOJzBRdswY76VjC8ENenc7upCKq4CNqr7IKNzfAPaWiRRJaloq4FPuCyAgbfdxirchxvC2FJHnhxW/s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709416889; c=relaxed/simple; bh=SQ2bkCquKSxhnwXZmJNPyMdw2uuicJAj7G2uLegfiQ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DzmMvbr0BUtl5X2skg+nz96QFUGQnGh2hMZ8DYZqwkSNn3XKxSsVJJgRreAurNyGjXVrIvrqOl/QTJ7ehfRK/nnrYNOHLVMl+NLzp2t8EFqAB1eRye4iBucEah66p/U0sXX65q61ceJtzlTZlMZML7WPoTCqCP8hRwqSYhSbeJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jm7Uvyty; 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="jm7Uvyty" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 993EFC433C7; Sat, 2 Mar 2024 22:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709416889; bh=SQ2bkCquKSxhnwXZmJNPyMdw2uuicJAj7G2uLegfiQ8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=jm7Uvytyp7Qp0H+v/k4O9+/Hm1vT5PEk5LKWzW3z3hKYfUCt2RbjSW4313GSSDhf/ vZFCpafWpip4Ck8oTauFMPrbFAncWvb8FO95Wcg3YzNNS/ajdWInEOOFcDU/EeNUtN ERUo3y1EeDp4NhsV8k+MLkHoGSrbUr+GTKmYuDJg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-52582: netfs: Only call folio_start_fscache() one time for each folio Date: Sat, 2 Mar 2024 23:00:16 +0100 Message-ID: <2024030258-CVE-2023-52582-07c8@gregkh> X-Mailer: git-send-email 2.44.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=3226; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=SQ2bkCquKSxhnwXZmJNPyMdw2uuicJAj7G2uLegfiQ8=; b=owGbwMvMwCRo6H6F97bub03G02pJDKmPF8Zd/Ck13au8cfrusgZLwyMZjpoP8lwPux4tVD7Dw 23wovZgRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzk1X6GeZoGCkcSr6n//1iq I8Ky643pdRWp7wwLdvhE+hYXqB51dv8ulC27Ze2E5zHXAQ== 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: netfs: Only call folio_start_fscache() one time for each folio If a network filesystem using netfs implements a clamp_length() function, it can set subrequest lengths smaller than a page size. When we loop through the folios in netfs_rreq_unlock_folios() to set any folios to be written back, we need to make sure we only call folio_start_fscache() once for each folio. Otherwise, this simple testcase: mount -o fsc,rsize=1024,wsize=1024 127.0.0.1:/export /mnt/nfs dd if=/dev/zero of=/mnt/nfs/file.bin bs=4096 count=1 1+0 records in 1+0 records out 4096 bytes (4.1 kB, 4.0 KiB) copied, 0.0126359 s, 324 kB/s echo 3 > /proc/sys/vm/drop_caches cat /mnt/nfs/file.bin > /dev/null will trigger an oops similar to the following: page dumped because: VM_BUG_ON_FOLIO(folio_test_private_2(folio)) ------------[ cut here ]------------ kernel BUG at include/linux/netfs.h:44! ... CPU: 5 PID: 134 Comm: kworker/u16:5 Kdump: loaded Not tainted 6.4.0-rc5 ... RIP: 0010:netfs_rreq_unlock_folios+0x68e/0x730 [netfs] ... Call Trace: netfs_rreq_assess+0x497/0x660 [netfs] netfs_subreq_terminated+0x32b/0x610 [netfs] nfs_netfs_read_completion+0x14e/0x1a0 [nfs] nfs_read_completion+0x2f9/0x330 [nfs] rpc_free_task+0x72/0xa0 [sunrpc] rpc_async_release+0x46/0x70 [sunrpc] process_one_work+0x3bd/0x710 worker_thread+0x89/0x610 kthread+0x181/0x1c0 ret_from_fork+0x29/0x50 The Linux kernel CVE team has assigned CVE-2023-52582 to this issue. Affected and fixed versions =========================== Issue introduced in 5.13 with commit 3d3c95046742 and fixed in 6.1.56 with commit df9950d37df1 Issue introduced in 5.13 with commit 3d3c95046742 and fixed in 6.5.6 with commit d9f5537479d4 Issue introduced in 5.13 with commit 3d3c95046742 and fixed in 6.6 with commit df1c357f25d8 Please see https://www.kernel.org or 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-2023-52582 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/netfs/buffered_read.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/df9950d37df113db59495fa09d060754366a2b7c https://git.kernel.org/stable/c/d9f5537479d4ec97ea92ff24e81a517d5772581a https://git.kernel.org/stable/c/df1c357f25d808e30b216188330e708e09e1a412