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 E7F60433D4 for ; Wed, 1 May 2024 12:57:31 +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=1714568252; cv=none; b=kJ95eCahRbJGNjtRImMhuPrvv9f4Y1gdBqvQBR0U+VFBsMNMecUGjomFjyVM+ZDL6WSpFg/OlYgyDq0XtXCCVBfmCbkJ73st7YjbtLGQQ9OQ2xq9Q+ORVXhS1U2Bg66HpVfoLjPrbj+iGWbBlutpo0HfxcAmTIXMCxRHdwYnzcM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568252; c=relaxed/simple; bh=jBrlfGkmjycgaeyqsKM39UnlxTobGyx7XvY58h/jUaE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D1AC5nOM9/HKzEYGTTe4g/LpDwRcBSkREGOU+rg6BsjHcwZiIgGZEKSlabvHcixREELV7e28na+7N7wcCyOMzBBUmn8eZgVhB02SD5t0IQpTR4C1wM/a+TvRlqJZiBZzmNRcfIgCvGnHmdyCGrMEAFOqf2ytY/ggGC3lQo/Zr54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=o8l2Xr3v; 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="o8l2Xr3v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38EB9C113CC; Wed, 1 May 2024 12:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714568251; bh=jBrlfGkmjycgaeyqsKM39UnlxTobGyx7XvY58h/jUaE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=o8l2Xr3vEe1AqGW410DAjIj60rpoG9LZliTRJjfsbSbggTW9W3uzyW9axOxklTohx AaS9fgA9AWhQ/GTSUI6KOXFc+tIRyIQqCebJXlSNtYY8WXI6jIsO9YnpWE1bki0F1c w5rilBmSl+VymrHh+66DjMMW4wDQwnlvn009nX34= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-27036: cifs: Fix writeback data corruption Date: Wed, 1 May 2024 14:57:21 +0200 Message-ID: <2024050111-CVE-2024-27036-6ba3@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=3325; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=jBrlfGkmjycgaeyqsKM39UnlxTobGyx7XvY58h/jUaE=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlGNuqTQtdMOC7/qjB5NedHvnjZrvpPWSdfxd79cTaLp W5zJeuZjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIeneGBVOmJ38/OfvPt2NL zVae3i57umJJRg7DghU3P0V5T33/+c8nvzxXEavwE3IpzQA= 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: cifs: Fix writeback data corruption cifs writeback doesn't correctly handle the case where cifs_extend_writeback() hits a point where it is considering an additional folio, but this would overrun the wsize - at which point it drops out of the xarray scanning loop and calls xas_pause(). The problem is that xas_pause() advances the loop counter - thereby skipping that page. What needs to happen is for xas_reset() to be called any time we decide we don't want to process the page we're looking at, but rather send the request we are building and start a new one. Fix this by copying and adapting the netfslib writepages code as a temporary measure, with cifs writeback intending to be offloaded to netfslib in the near future. This also fixes the issue with the use of filemap_get_folios_tag() causing retry of a bunch of pages which the extender already dealt with. This can be tested by creating, say, a 64K file somewhere not on cifs (otherwise copy-offload may get underfoot), mounting a cifs share with a wsize of 64000, copying the file to it and then comparing the original file and the copy: dd if=/dev/urandom of=/tmp/64K bs=64k count=1 mount //192.168.6.1/test /mnt -o user=...,pass=...,wsize=64000 cp /tmp/64K /mnt/64K cmp /tmp/64K /mnt/64K Without the fix, the cmp fails at position 64000 (or shortly thereafter). The Linux kernel CVE team has assigned CVE-2024-27036 to this issue. Affected and fixed versions =========================== Issue introduced in 6.3 with commit d08089f649a0 and fixed in 6.6.23 with commit e45deec35bf7 Issue introduced in 6.3 with commit d08089f649a0 and fixed in 6.7.11 with commit 65f2ced69598 Issue introduced in 6.3 with commit d08089f649a0 and fixed in 6.8.2 with commit 844b4e132f57 Issue introduced in 6.3 with commit d08089f649a0 and fixed in 6.9-rc1 with commit f3dc1bdb6b0b 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-27036 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/smb/client/file.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/e45deec35bf7f1f4f992a707b2d04a8c162f2240 https://git.kernel.org/stable/c/65f2ced695982ccd516196d0a9447d85dbe2eed5 https://git.kernel.org/stable/c/844b4e132f57f1333dc79feaa035075a096762e4 https://git.kernel.org/stable/c/f3dc1bdb6b0b0693562c7c54a6c28bafa608ba3c