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 110C481219 for ; Mon, 29 Jul 2024 06:37:19 +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=1722235040; cv=none; b=EcEIo81K6cHHWi8tjj1ed6rIzzNU9NfF/rfd6dlhB9BrPYB5eXCndk6WwZG1XlB2hXc3XVnsn2o4xsCeQKh/k+iDcvv3pn2UAPvqCknyk06mqTS7w2bFtJfQklwqkgrW1L/QB3XPikH6klWBPASM7ptWLBVZE1EJU1mY5j17NJM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722235040; c=relaxed/simple; bh=eqsfU/KIF7BByPmTrstFKmsg3pJwYpe1xMBSGUre4Qg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TvtBS4yVztxgZPrWyGYMmFRWqM4Q/orLQvyx5Y18DkivAoNQyg0snHNTEvW7hZQmPcVWYjWNrsn6LDYKP5iENI0JiqpCH83QIyO5WD8NB+hRBT6KuSIgdtd9RMgxHyb+cHrtFiCpOLySjpUQ4LkHPws7QY5fkv1DPAq1zbFDmBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uL4+oqos; 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="uL4+oqos" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B6BDC32786; Mon, 29 Jul 2024 06:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722235039; bh=eqsfU/KIF7BByPmTrstFKmsg3pJwYpe1xMBSGUre4Qg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=uL4+oqosJFRU5U1ceFFpBHHM4mewc1hjimcbBnhwBkpBwI8CnhbN6HMTU8SIASvgV yzK40Or9j70B4w4PLNCdjVrTfuRHxAkM8AHTD/NrHggT2dlTFAOcW625XrqQxMhq0M ILQ3AdHI6FQbbTclr9xXX/p6l9RX/k/t6X9bBHqs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-41013: xfs: don't walk off the end of a directory data block Date: Mon, 29 Jul 2024 08:37:09 +0200 Message-ID: <2024072908-CVE-2024-41013-2996@gregkh> X-Mailer: git-send-email 2.45.2 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=2300; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=eqsfU/KIF7BByPmTrstFKmsg3pJwYpe1xMBSGUre4Qg=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnLLaY0z+Xcu8w0vuRF/hQZkU/vXRNfh8oGlF46IHrm/ rTcR3u3dsSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBE1H8yLNh5XDwnPiJEU4bb t6PXhG1J6y8VeYb5PvkH5z0VmBY5O+rUT54FsxprVj3OBgA= 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: xfs: don't walk off the end of a directory data block This adds sanity checks for xfs_dir2_data_unused and xfs_dir2_data_entry to make sure don't stray beyond valid memory region. Before patching, the loop simply checks that the start offset of the dup and dep is within the range. So in a crafted image, if last entry is xfs_dir2_data_unused, we can change dup->length to dup->length-1 and leave 1 byte of space. In the next traversal, this space will be considered as dup or dep. We may encounter an out of bound read when accessing the fixed members. In the patch, we make sure that the remaining bytes large enough to hold an unused entry before accessing xfs_dir2_data_unused and xfs_dir2_data_unused is XFS_DIR2_DATA_ALIGN byte aligned. We also make sure that the remaining bytes large enough to hold a dirent with a single-byte name before accessing xfs_dir2_data_entry. The Linux kernel CVE team has assigned CVE-2024-41013 to this issue. Affected and fixed versions =========================== Fixed in 6.11-rc1 with commit 0c7fcdb6d06c 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-41013 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/xfs/libxfs/xfs_dir2_data.c fs/xfs/libxfs/xfs_dir2_priv.h 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/0c7fcdb6d06cdf8b19b57c17605215b06afa864a