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 36F751F4727 for ; Fri, 27 Dec 2024 14:59:09 +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=1735311550; cv=none; b=ATW4tTwxntpY80mot2vybP+K3nWuMQvg0ez3s6GgCqkULyG590fqCfZv5sCzpzZU9wgZ3/kD6qCuP6Lc4fsTc3iVvjqC3e1ShTGTbKinqnl6Ql8JoSOYawiylAC0TbJpUWCA1Hxo/mnQEujPRkKnNZv6ga6tY8rplFg11WN7utI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735311550; c=relaxed/simple; bh=tYG/DJq2e5X9GeHitD0CMF4ajPW53jkQSnhJo7XyI8E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uHZgsTZetwLNMXuftWBpGXNAJs5ee+jUkkk+5ncBRo92rHxJPVVUk0TrKD4JGqWe4BC+WPCf6twx/h500v8x5so2MNWijgjXTUAR8gUKv1YTjZ9ZYE9jD04Kbl4hZCOIW2bbxAJs9EamiMAxR2SNqtjoSk4GUKkaFOp8i1l4wOs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=s6eesdYE; 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="s6eesdYE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E308C4CED0; Fri, 27 Dec 2024 14:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735311549; bh=tYG/DJq2e5X9GeHitD0CMF4ajPW53jkQSnhJo7XyI8E=; h=From:To:Cc:Subject:Date:Reply-to:From; b=s6eesdYEovE4mVsMtwMk95LHpZV7a+1P5olo7MuN4D4+M/OzMqLsOnvy28AfYoYtt FmnEoVg3SG7cKdnYnPyAczPNb3xnHJmRYk8Hs0o3TADFk8RT2FMjoDjlKcpVCDiIc9 lgYZa4NRBc/ZaUm1MexU/vFyXbQ4zaAHbBBgqYrk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56594: drm/amdgpu: set the right AMDGPU sg segment limitation Date: Fri, 27 Dec 2024 15:51:01 +0100 Message-ID: <2024122700-CVE-2024-56594-3c24@gregkh> X-Mailer: git-send-email 2.47.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=6559; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=WOnp2qmdr2oYdtmyqBFbQ9kWXSSDJT2k3+gAWBoZtuU=; b=owGbwMvMwCRo6H6F97bub03G02pJDOl5+65cZNrC84lnW/YmXfezi7by/1Bh3b3OMM0sLoAtT sqzaqJJRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzEaT7DPFOvHUvqOqXnr911 XoGvQK7eccY/a4Z5Jh+fSTa3GQql5gu5BuXf2ijTeqcJAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Description =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D In the Linux kernel, the following vulnerability has been resolved: drm/amdgpu: set the right AMDGPU sg segment limitation The driver needs to set the correct max_segment_size; otherwise debug_dma_map_sg() will complain about the over-mapping of the AMDGPU sg length as following: WARNING: CPU: 6 PID: 1964 at kernel/dma/debug.c:1178 debug_dma_map_sg+0x2dc= /0x370 [ 364.049444] Modules linked in: veth amdgpu(OE) amdxcp drm_exec gpu_sched= drm_buddy drm_ttm_helper ttm(OE) drm_suballoc_helper drm_display_helper dr= m_kms_helper i2c_algo_bit rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs lockd grace= netfs xt_conntrack xt_MASQUERADE nf_conntrack_netlink xfrm_user xfrm_algo = iptable_nat xt_addrtype iptable_filter br_netfilter nvme_fabrics overlay nf= netlink_cttimeout nfnetlink openvswitch nsh nf_conncount nf_nat nf_conntrac= k nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c bridge stp llc amd_atl intel_rapl= _msr intel_rapl_common sunrpc sch_fq_codel snd_hda_codec_realtek snd_hda_co= dec_generic snd_hda_scodec_component snd_hda_codec_hdmi snd_hda_intel snd_i= ntel_dspcfg edac_mce_amd binfmt_misc snd_hda_codec snd_pci_acp6x snd_hda_co= re snd_acp_config snd_hwdep snd_soc_acpi kvm_amd snd_pcm kvm snd_seq_midi s= nd_seq_midi_event crct10dif_pclmul ghash_clmulni_intel sha512_ssse3 snd_raw= midi sha256_ssse3 sha1_ssse3 aesni_intel snd_seq nls_iso8859_1 crypto_simd = snd_seq_device cryptd snd_timer rapl input_leds snd [ 364.049532] ipmi_devintf wmi_bmof ccp serio_raw k10temp sp5100_tco soun= dcore ipmi_msghandler cm32181 industrialio mac_hid msr parport_pc ppdev lp = parport drm efi_pstore ip_tables x_tables pci_stub crc32_pclmul nvme ahci l= ibahci i2c_piix4 r8169 nvme_core i2c_designware_pci realtek i2c_ccgx_ucsi v= ideo wmi hid_generic cdc_ether usbnet usbhid hid r8152 mii [ 364.049576] CPU: 6 PID: 1964 Comm: rocminfo Tainted: G OE = 6.10.0-custom #492 [ 364.049579] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS RMJ1009A 06= /13/2021 [ 364.049582] RIP: 0010:debug_dma_map_sg+0x2dc/0x370 [ 364.049585] Code: 89 4d b8 e8 36 b1 86 00 8b 4d b8 48 8b 55 b0 44 8b 45 = a8 4c 8b 4d a0 48 89 c6 48 c7 c7 00 4b 74 bc 4c 89 4d b8 e8 b4 73 f3 ff <0f= > 0b 4c 8b 4d b8 8b 15 c8 2c b8 01 85 d2 0f 85 ee fd ff ff 8b 05 [ 364.049588] RSP: 0018:ffff9ca600b57ac0 EFLAGS: 00010286 [ 364.049590] RAX: 0000000000000000 RBX: ffff88b7c132b0c8 RCX: 00000000000= 00027 [ 364.049592] RDX: ffff88bb0f521688 RSI: 0000000000000001 RDI: ffff88bb0f5= 21680 [ 364.049594] RBP: ffff9ca600b57b20 R08: 000000000000006f R09: ffff9ca600b= 57930 [ 364.049596] R10: ffff9ca600b57928 R11: ffffffffbcb46328 R12: 00000000000= 00000 [ 364.049597] R13: 0000000000000001 R14: ffff88b7c19c0700 R15: ffff88b7c90= 59800 [ 364.049599] FS: 00007fb2d3516e80(0000) GS:ffff88bb0f500000(0000) knlGS:= 0000000000000000 [ 364.049601] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 364.049603] CR2: 000055610bd03598 CR3: 00000001049f6000 CR4: 00000000003= 50ef0 [ 364.049605] Call Trace: [ 364.049607] [ 364.049609] ? show_regs+0x6d/0x80 [ 364.049614] ? __warn+0x8c/0x140 [ 364.049618] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049621] ? report_bug+0x193/0x1a0 [ 364.049627] ? handle_bug+0x46/0x80 [ 364.049631] ? exc_invalid_op+0x1d/0x80 [ 364.049635] ? asm_exc_invalid_op+0x1f/0x30 [ 364.049642] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049647] __dma_map_sg_attrs+0x90/0xe0 [ 364.049651] dma_map_sgtable+0x25/0x40 [ 364.049654] amdgpu_bo_move+0x59a/0x850 [amdgpu] [ 364.049935] ? srso_return_thunk+0x5/0x5f [ 364.049939] ? amdgpu_ttm_tt_populate+0x5d/0xc0 [amdgpu] [ 364.050095] ttm_bo_handle_move_mem+0xc3/0x180 [ttm] [ 364.050103] ttm_bo_validate+0xc1/0x160 [ttm] [ 364.050108] ? amdgpu_ttm_tt_get_user_pages+0xe5/0x1b0 [amdgpu] [ 364.050263] amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu+0xa12/0xc90 [amdgpu] [ 364.050473] kfd_ioctl_alloc_memory_of_gpu+0x16b/0x3b0 [amdgpu] [ 364.050680] kfd_ioctl+0x3c2/0x530 [amdgpu] [ 364.050866] ? __pfx_kfd_ioctl_alloc_memory_of_gpu+0x10/0x10 [amdgpu] [ 364.051054] ? srso_return_thunk+0x5/0x5f [ 364.051057] ? tomoyo_file_ioctl+0x20/0x30 [ 364.051063] __x64_sys_ioctl+0x9c/0xd0 [ 364.051068] x64_sys_call+0x1219/0x20d0 [ 364.051073] do_syscall_64+0x51/0x120 [ 364.051077] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 364.051081] RIP: 0033:0x7fb2d2f1a94f The Linux kernel CVE team has assigned CVE-2024-56594 to this issue. Affected and fixed versions =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Fixed in 5.4.287 with commit b5807a08954fdf914ef80b49aaa6cda965ecc95c Fixed in 5.10.231 with commit 13c3a54f48a612a117dfd82a9dd91732261e869d Fixed in 5.15.174 with commit 76581147b05c2adb6b47bbc697521725f10224e4 Fixed in 6.1.120 with commit ff0346a74627a5f607a33a3852586f8c7f678329 Fixed in 6.6.66 with commit b9e52a96ec92245bf15dabba1d3d862d7a03efb8 Fixed in 6.12.5 with commit 76649ccf97e2cd72b62e34ed2fba6e0f89497eab Fixed in 6.13-rc1 with commit e2e97435783979124ba92d6870415c57ecfef6a5 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=3DCVE-2024-56594 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The file(s) affected by this issue are: drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c Mitigation =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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/b5807a08954fdf914ef80b49aaa6cda965ecc95c https://git.kernel.org/stable/c/13c3a54f48a612a117dfd82a9dd91732261e869d https://git.kernel.org/stable/c/76581147b05c2adb6b47bbc697521725f10224e4 https://git.kernel.org/stable/c/ff0346a74627a5f607a33a3852586f8c7f678329 https://git.kernel.org/stable/c/b9e52a96ec92245bf15dabba1d3d862d7a03efb8 https://git.kernel.org/stable/c/76649ccf97e2cd72b62e34ed2fba6e0f89497eab https://git.kernel.org/stable/c/e2e97435783979124ba92d6870415c57ecfef6a5