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 0151116D33F for ; Fri, 12 Jul 2024 12:21:46 +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=1720786907; cv=none; b=SFQUI7heNvE9ngX16MxmpnD0pfT9iJtWTyGc80XB5xygVq0/ZDxLoAic5HGoe4iYQiKrpPjG+7Xwpn84yw7p7nLcIzV1HOn+h+fpPQM5RqsYwcK7pydlk1+7LWRslOfMSvI/XY7fYy4cCeC9YU5jR2wPfcmtOlkLR5EIEqz1OwE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720786907; c=relaxed/simple; bh=5u63Gp836qK6rJ4KCgqsYAyVBBFHxpbOnP/qfMrwCn4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Bhr4pFNjnMyaA/dM/HPyKxUOqSiLvO6EFS9OVg8/nhEOHJjb4oMLwwaPM+UBsAggF/KVtTb3LZ5082L2IPmwruKUa8j4fCNp7+FGpVF8LaEZThSUO1z4JUineyG5uGNk6/1OvKOk0DFlHvOU+TgSQ6rLf51Gp6AlU8y1rAGkvqI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YKpCkf0e; 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="YKpCkf0e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6495FC32782; Fri, 12 Jul 2024 12:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720786906; bh=5u63Gp836qK6rJ4KCgqsYAyVBBFHxpbOnP/qfMrwCn4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=YKpCkf0e4RgWG+A2JTkptgQXP2ogLdgMQxn1QvobGZEdmlUCrHh8kvzf+Kb8UCpJ3 gcguTUvdcm05JvIk6ljeejtt4nUl8+C4vDtEaq6JGdGk/EVismgpbALMZam/qvy68g 4EqQECRWU7/tuCdaIQJq/vPgb3vGCZflhPs+1WVY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-40900: cachefiles: remove requests from xarray during flushing requests Date: Fri, 12 Jul 2024 14:21:18 +0200 Message-ID: <2024071207-CVE-2024-40900-7497@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=3063; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=5u63Gp836qK6rJ4KCgqsYAyVBBFHxpbOnP/qfMrwCn4=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkT5TeHdWgc1rKp3bjzV9f/FW1S/wUXTeKpMpr6emtv2 gsFX+WvHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRRcYM8yxfR8s0zKiaKcui mH6y437vRbGYZIa5cpfKz7tu+V5remlntZvu5KC374QyAQ== 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: cachefiles: remove requests from xarray during flushing requests Even with CACHEFILES_DEAD set, we can still read the requests, so in the following concurrency the request may be used after it has been freed: mount | daemon_thread1 | daemon_thread2 ------------------------------------------------------------ cachefiles_ondemand_init_object cachefiles_ondemand_send_req REQ_A = kzalloc(sizeof(*req) + data_len) wait_for_completion(&REQ_A->done) cachefiles_daemon_read cachefiles_ondemand_daemon_read // close dev fd cachefiles_flush_reqs complete(&REQ_A->done) kfree(REQ_A) xa_lock(&cache->reqs); cachefiles_ondemand_select_req req->msg.opcode != CACHEFILES_OP_READ // req use-after-free !!! xa_unlock(&cache->reqs); xa_destroy(&cache->reqs) Hence remove requests from cache->reqs when flushing them to avoid accessing freed requests. The Linux kernel CVE team has assigned CVE-2024-40900 to this issue. Affected and fixed versions =========================== Issue introduced in 5.19 with commit c8383054506c and fixed in 6.1.95 with commit 9f13aacdd4ee Issue introduced in 5.19 with commit c8383054506c and fixed in 6.6.35 with commit 50d0e55356ba Issue introduced in 5.19 with commit c8383054506c and fixed in 6.9.6 with commit 37e19cf86a52 Issue introduced in 5.19 with commit c8383054506c and fixed in 6.10-rc4 with commit 0fc75c5940fa 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-40900 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/cachefiles/daemon.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/9f13aacdd4ee9a7644b2a3c96d67113cd083c9c7 https://git.kernel.org/stable/c/50d0e55356ba5b84ffb51c42704126124257e598 https://git.kernel.org/stable/c/37e19cf86a520d65de1de9cb330415c332a40d19 https://git.kernel.org/stable/c/0fc75c5940fa634d84e64c93bfc388e1274ed013