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 3EBCD2EB5BA for ; Fri, 25 Jul 2025 15:28:49 +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=1753457330; cv=none; b=X5WNqFWyEYeb4MW6euCQNMdPYuiiwyBYBJlWDNz+ag58qLbGBfba15RpEpIF4Dp2j7M1ZHmuCgSPX6y1+wOBv7AA+JBXDkOJ6I3ex2hWL/9muv+M2dPalvU0LSRZR3Nt5wu6DZ+VsauIBce/xHz7rUmNSLtPMZdkSg0i91r0oNs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753457330; c=relaxed/simple; bh=Xyu+MJuj/eHPACJxPa8slGUKOYj4A2a1XA8unpWZ94g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=u72/IdDyWl67xMmCbNTPKZ/FRZXd1uH7I7ya3l4m3oTwfUnodKdvAPqxXMTeh+tXx8vUipFbxw7YANg83ND9Y/rn01MqkPM2x2nH7UB82bumDMvxVtHdM64jgYfjvQ93rvAnYYy8vhE7IfidHtvgHgRk6HRQEJg28a44pupJBVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ze317G5L; 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="ze317G5L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 556F8C4CEE7; Fri, 25 Jul 2025 15:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753457329; bh=Xyu+MJuj/eHPACJxPa8slGUKOYj4A2a1XA8unpWZ94g=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ze317G5Lka6VSub4I+MuWvWMZ/TZXuDnivI7Vv7YJ9t/Mvd4Run8WS4vzQS8E0+WG M/DjqupyMAicPFU0K3zMfEubpmXRmGgAqhmOP8fyt0y6M9+gZAse9vZtUq2qZUT/0R 2fOUT494uUgjgbIj+WEnUcN7LoZZx77Hs7D7YmEs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38449: drm/gem: Acquire references on GEM handles for framebuffers Date: Fri, 25 Jul 2025 17:28:11 +0200 Message-ID: <2025072504-CVE-2025-38449-cbf0@gregkh> X-Mailer: git-send-email 2.50.1 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=4438; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Y4Ec87V2KdTRoCrL9iBcfHs0c54geY/9ViHCuwaStyw=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnNi1qK3hzeu2zP4T271IyP2vbnSR/5c+9h3eLVj7jWJ 67JZArU6IhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJtNxhmCtVFyfI4v46d/LZ hXHHmresnZzzxYhhwfxNusvNONt9czeGGBg8+t9zj5FRFQA= 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/gem: Acquire references on GEM handles for framebuffers A GEM handle can be released while the GEM buffer object is attached to a DRM framebuffer. This leads to the release of the dma-buf backing the buffer object, if any. [1] Trying to use the framebuffer in further mode-setting operations leads to a segmentation fault. Most easily happens with driver that use shadow planes for vmap-ing the dma-buf during a page flip. An example is shown below. [ 156.791968] ------------[ cut here ]------------ [ 156.796830] WARNING: CPU: 2 PID: 2255 at drivers/dma-buf/dma-buf.c:1527 dma_buf_vmap+0x224/0x430 [...] [ 156.942028] RIP: 0010:dma_buf_vmap+0x224/0x430 [ 157.043420] Call Trace: [ 157.045898] [ 157.048030] ? show_trace_log_lvl+0x1af/0x2c0 [ 157.052436] ? show_trace_log_lvl+0x1af/0x2c0 [ 157.056836] ? show_trace_log_lvl+0x1af/0x2c0 [ 157.061253] ? drm_gem_shmem_vmap+0x74/0x710 [ 157.065567] ? dma_buf_vmap+0x224/0x430 [ 157.069446] ? __warn.cold+0x58/0xe4 [ 157.073061] ? dma_buf_vmap+0x224/0x430 [ 157.077111] ? report_bug+0x1dd/0x390 [ 157.080842] ? handle_bug+0x5e/0xa0 [ 157.084389] ? exc_invalid_op+0x14/0x50 [ 157.088291] ? asm_exc_invalid_op+0x16/0x20 [ 157.092548] ? dma_buf_vmap+0x224/0x430 [ 157.096663] ? dma_resv_get_singleton+0x6d/0x230 [ 157.101341] ? __pfx_dma_buf_vmap+0x10/0x10 [ 157.105588] ? __pfx_dma_resv_get_singleton+0x10/0x10 [ 157.110697] drm_gem_shmem_vmap+0x74/0x710 [ 157.114866] drm_gem_vmap+0xa9/0x1b0 [ 157.118763] drm_gem_vmap_unlocked+0x46/0xa0 [ 157.123086] drm_gem_fb_vmap+0xab/0x300 [ 157.126979] drm_atomic_helper_prepare_planes.part.0+0x487/0xb10 [ 157.133032] ? lockdep_init_map_type+0x19d/0x880 [ 157.137701] drm_atomic_helper_commit+0x13d/0x2e0 [ 157.142671] ? drm_atomic_nonblocking_commit+0xa0/0x180 [ 157.147988] drm_mode_atomic_ioctl+0x766/0xe40 [...] [ 157.346424] ---[ end trace 0000000000000000 ]--- Acquiring GEM handles for the framebuffer's GEM buffer objects prevents this from happening. The framebuffer's cleanup later puts the handle references. Commit 1a148af06000 ("drm/gem-shmem: Use dma_buf from GEM object instance") triggers the segmentation fault easily by using the dma-buf field more widely. The underlying issue with reference counting has been present before. v2: - acquire the handle instead of the BO (Christian) - fix comment style (Christian) - drop the Fixes tag (Christian) - rename err_ gotos - add missing Link tag The Linux kernel CVE team has assigned CVE-2025-38449 to this issue. Affected and fixed versions =========================== Fixed in 6.6.99 with commit cb4c956a15f8b7f870649454771fc3761f504b5f Fixed in 6.12.39 with commit 08480e285c6a82ce689008d643e4a51db0aaef8b Fixed in 6.15.7 with commit 3cf520d9860d4ec9f7f32068825da31f18dd3f25 Fixed in 6.16-rc5 with commit 5307dce878d4126e1b375587318955bd019c3741 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-2025-38449 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/drm_gem.c drivers/gpu/drm/drm_gem_framebuffer_helper.c drivers/gpu/drm/drm_internal.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/cb4c956a15f8b7f870649454771fc3761f504b5f https://git.kernel.org/stable/c/08480e285c6a82ce689008d643e4a51db0aaef8b https://git.kernel.org/stable/c/3cf520d9860d4ec9f7f32068825da31f18dd3f25 https://git.kernel.org/stable/c/5307dce878d4126e1b375587318955bd019c3741