Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792758825; b=GjzODlbWThLLa1ZVaa3OAjk2JNsVv7LvpZLNdLJqLPg8UT2RJ0BXrKaYPh35fN+0wwip 1xr3DS16g2N3rqmlk0NUdslmQrzRLGkdjA8T7UKpIpeB73UBvVT/ylKcDKGTuxGT1j4yD G2jBUFHUV1Xkvk/2XSkm24fneVCG8j1KEvvXOqF4+urKif2kJJa79gzizxoL2xLEaG5AY IprAAvmP5GJBdOF0lYi+1tAhI2TLJN00Nt6AISNbfUuta49JQ84P4gruixre7iuvJ0SXz 6HxVTojevDlw1swFtlNY6OLbzsd+Ppsq1sXtK0IitWqI+/F5j0w78qZ0wJvD0WqTk5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792758825; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: Reply-To:MIME-Version:Lines:X-Developer-Signature:X-Developer-Key: Content-Transfer-Encoding; bh=1xWiZDmZ8yYYL2NwBKo2xBVrw5RIuGdp+hxcqVVaiUc=; b=OMbqQ21PeOwZ3VxVv/FBQMEhyikFw4mImZSgmkTd8SslEC072TBtwfIOw3VpWtHk7wE0 mTF2IFUV4ojrIHQNSqwVF829ekBmbn+IfhMQ4u0WNnCGsf005D57J7/FFgClf0bcWm+cM UI6YWTU+u5JvojdLpQMXvjwujZc7kLZfF4upMLWaSkX+eclvpG4pceFogThxl3AbolEPi dl5B9sHOktoaoM8NGOvN9TFj+bJw8OUFfrW5sU7iRELe7NZ8OOILhkeG4dWL4SGXKmzJ+ e+I+Uwv7utv6YPwfgpQlYgygHdg2ZPzaVvHJZ2H94b6wS//Der9WZ7HBY/Ym6HgItaQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="LfO/I0To"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EE9C606A31B for ; Fri, 23 Oct 2026 12:33:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=LfO/I0To Received: by smtp.kernel.org (Postfix) with ESMTPSA id 537061F01825; Fri, 23 Oct 2026 12:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792758825; bh=1xWiZDmZ8yYYL2NwBKo2xBVrw5RIuGdp+hxcqVVaiUc=; h=From:To:Cc:Subject:Date:Reply-To; b=LfO/I0Tob5CjHlaGkQbtpoMzHz/KPHYg49JWf2CLAiCfMacJBywnurigLsj9qRqVW /HnFUijKTZnP6pGQ80i+/Ffjv6zoNC0kn84V51CnUXqTww7i5VJSZPuEuv9XNGVui5 yzbHmVocXu57b5AAg7IFn1bbAEVCRiOWmaVw60LE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-99000: drm/xe: Fix shrinker accounting double-subtraction on nested external pins Date: Fri, 23 Oct 2026 14:20:02 +0200 Message-ID: <2026102317-CVE-2026-99000-2f7d@gregkh> X-Mailer: git-send-email 2.56.0 Reply-To: , X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6065; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=x+wukMa+5q9y4e53JTf1KaocExcejcZAFvNi5UjQP9g=; b=owGbwMvMwCRo6H6F97bub03G02pJDFm3A44arszNmFe1fvbS1x1is6rDzj0pqXEzXGq0sKRHo GjRCjPejlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIzBGGORyyxlXbrG9o3Nq4 MWz/JR8Pe3/nWwyz2UVVdjuuaDwU8k1ZVkc4w2Op0KwYAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: drm/xe: Fix shrinker accounting double-subtraction on nested external pins xe_bo_pin_external() and xe_bo_unpin_external() support nested pins, since the underlying ttm_bo_pin()/ttm_bo_unpin() maintain a pin_count refcount rather than a boolean. However, the shrinker accounting calls xe_ttm_tt_account_subtract() and xe_ttm_tt_account_add() are invoked unconditionally on every pin_external()/unpin_external() call, instead of only on the transition into and out of the pinned state. An external BO (dma-buf) can be pinned more than once while already pinned, for example when it has multiple attachments/importers, each independently calling xe_bo_pin_external(). Each such nested pin subtracts the BO's pages from the shrinker's accounting again, even though the BO's pages were already removed from consideration by the first pin. Symmetrically, each nested unpin adds them back again before the BO is actually unpinned. This desynchronizes the shrinker's page and object counts from reality, and since they are declared as signed long but interpreted as unsigned long in xe_shrinker_count(), the underflow can turn into an enormous shrinkable/purgeable page count, causing the shrinker to be invoked excessively under memory pressure. Guard the accounting calls with the same pin-count transition checks already used to guard the pinned_link list maintenance, so accounting is only updated on the outermost pin and the final unpin. While centralizing this logic into xe_bo_account_pin()/ xe_bo_account_unpin(), also close a second, related accounting gap affecting imported dma-bufs. For an imported bo's ttm_tt, xe's ttm_tt_populate hook (xe_ttm_tt_populate()) early-returns without calling xe_ttm_tt_account_add(), since TTM_TT_FLAG_EXTERNAL is set without TTM_TT_FLAG_EXTERNAL_MAPPABLE. However, TTM core's ttm_tt_populate() wrapper unconditionally marks the tt as populated on driver-hook success, so ttm_tt_is_populated() still reports true for it. xe_bo_account_pin()/xe_bo_account_unpin() trusted ttm_tt_is_populated() as a proxy for "these pages are accounted for by the shrinker", and would subtract/add pages for such a tt that were never added in the first place, again underflowing the shrinker's counts. This is reachable today via xe_bo_pin_external(), and would have become newly reachable via the fb-pin path once this patch routes __xe_pin_fb_vma() through xe_bo_pin_account() below, so fix it here rather than in a later patch, to avoid a commit in this series that introduces the regression before fixing it. Skip the accounting for imported bos, using the same EXTERNAL && !EXTERNAL_MAPPABLE test xe_ttm_tt_populate()/xe_ttm_tt_unpopulate() use to decide whether to act, via a new xe_ttm_bo_is_imported() helper (hoisted up from its only prior use site). v2: - Fix the critical issue caught by Sashiko AI review: the pin-count transition check introduced here was still bypassed by the fb-pin path (__xe_pin_fb_vma()/__xe_unpin_fb_vma()), which could leave a stale pinned_link entry and a permanent shrinker accounting leak when the fb-unpin performed the true last unpin. Addressed in a separate follow-up patch in this series rather than folded in here, since it is a distinct bug with its own Fixes: tag. - Drop the unneeded local "last_unpin" variable in xe_bo_unpin_external(), restoring the original inline bo->ttm.pin_count == 1 check; it was a no-op rename not used by any of the new accounting helpers, and was going to be deleted again by the follow-up patch anyway. v3: - Exclude imported dma-bufs from the pin/unpin shrinker accounting, fixing another underflow caught by Sashiko AI review. - Add a short comment on the backup-object pin site noting it's already populated/accounted at pin time, addressing (as a false-positive clarification, no code fix needed) a separate Medium-severity accounting-leak concern also caught by Sashiko AI review. (cherry picked from commit 6a117a2bb7ca657e3a19f83f4c06265d38dee06c) The Linux kernel CVE team has assigned CVE-2026-99000 to this issue. Affected and fixed versions =========================== Issue introduced in 6.15 with commit 00c8efc3180f0cf919b53980e969430657e01685 and fixed in 6.18.57 with commit 993c952e6832ad0aa4be82e11f0760b1f532090a Issue introduced in 6.15 with commit 00c8efc3180f0cf919b53980e969430657e01685 and fixed in 7.2.11 with commit ab39bc55cf08208b8511b1c09926b1b646a8befc Issue introduced in 6.15 with commit 00c8efc3180f0cf919b53980e969430657e01685 and fixed in 7.3 with commit 83d5acca1f4f6132038ea88c72c5844f62e42d44 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-2026-99000 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: drivers/gpu/drm/xe/display/xe_fb_pin.c drivers/gpu/drm/xe/xe_bo.c drivers/gpu/drm/xe/xe_bo.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/993c952e6832ad0aa4be82e11f0760b1f532090a https://git.kernel.org/stable/c/ab39bc55cf08208b8511b1c09926b1b646a8befc https://git.kernel.org/stable/c/83d5acca1f4f6132038ea88c72c5844f62e42d44