CVE-2024-57897: drm/amdkfd: Correct the migration DMA map direction
In the Linux kernel, the following vulnerability has been resolved:
drm/amdkfd: Correct the migration DMA map direction
The SVM DMA device map direction should be set the same as the DMA unmap setting, otherwise the DMA core will report the following warning.
Before finialize this solution, there're some discussion on the DMA mapping type(stream-based or coherent) in this KFD migration case, followed by https://lore.kernel.org/all/04d4ab32 -45a1-4b88-86ee-fb0f35a0ca40@amd.com/T/.
As there's no dmasyncsinglefor() in the DMA buffer accessed that because this migration operation should be sync properly and automatically. Give that there's might not be a performance problem in various cache sync policy of DMA sync. Therefore, in order to simplify the DMA direction setting alignment, let's set the DMA map direction as BIDIRECTIONAL.
[ 150.834218] WARNING: CPU: 8 PID: 1812 at kernel/dma/debug.c:1028 checkunmap+0x1cc/0x930 [ 150.834225] Modules linked in: amdgpu(OE) amdxcp drmexec(OE) gpusched drmbuddy(OE) drmttmhelper(OE) ttm(OE) drmsuballochelper(OE) drmdisplayhelper(OE) drmkmshelper(OE) i2calgobit rpcsecgsskrb5 authrpcgss nfsv4 nfs lockd grace netfs xtconntrack xtMASQUERADE nfconntracknetlink xfrmuser xfrmalgo iptablenat xtaddrtype iptablefilter brnetfilter nvmefabrics overlay nfnetlinkcttimeout nfnetlink openvswitch nsh nfconncount nfnat nfconntrack nfdefragipv6 nfdefragipv4 libcrc32c bridge stp llc schfqcodel intelraplmsr amdatl intelraplcommon sndhdacodecrealtek sndhdacodecgeneric sndhdascodeccomponent sndhdacodechdmi sndhdaintel sndinteldspcfg edacmceamd sndpciacp6x sndhdacodec sndacpconfig sndhdacore sndhwdep sndsocacpi kvmamd sunrpc sndpcm kvm binfmtmisc sndseqmidi crct10difpclmul sndseqmidievent ghashclmulniintel sha512ssse3 sndrawmidi nlsiso88591 sha256ssse3 sha1ssse3 sndseq aesniintel sndseqdevice cryptosimd sndtimer cryptd inputleds [ 150.834310] wmibmof serioraw k10temp rapl snd sp5100tco ipmidevintf soundcore ccp ipmimsghandler cm32181 industrialio machid msr parportpc ppdev lp parport efipstore drm(OE) iptables xtables pcistub crc32pclmul nvme ahci libahci i2cpiix4 r8169 nvmecore i2cdesignwarepci realtek i2cccgxucsi video wmi hidgeneric cdcether usbnet usbhid hid r8152 mii [ 150.834354] CPU: 8 PID: 1812 Comm: rocrtst64 Tainted: G OE 6.10.0-custom #492 [ 150.834358] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS RMJ1009A 06/13/2021 [ 150.834360] RIP: 0010:checkunmap+0x1cc/0x930 [ 150.834363] Code: c0 4c 89 4d c8 e8 34 bf 86 00 4c 8b 4d c8 4c 8b 45 c0 48 8b 4d b8 48 89 c6 41 57 4c 89 ea 48 c7 c7 80 49 b4 84 e8 b4 81 f3 ff <0f> 0b 48 c7 c7 04 83 ac 84 e8 76 ba fc ff 41 8b 76 4c 49 8d 7e 50 [ 150.834365] RSP: 0018:ffffaac5023739e0 EFLAGS: 00010086 [ 150.834368] RAX: 0000000000000000 RBX: ffffffff8566a2e0 RCX: 0000000000000027 [ 150.834370] RDX: ffff8f6a8f621688 RSI: 0000000000000001 RDI: ffff8f6a8f621680 [ 150.834372] RBP: ffffaac502373a30 R08: 00000000000000c9 R09: ffffaac502373850 [ 150.834373] R10: ffffaac502373848 R11: ffffffff84f46328 R12: ffffaac502373a40 [ 150.834375] R13: ffff8f6741045330 R14: ffff8f6741a77700 R15: ffffffff84ac831b [ 150.834377] FS: 00007faf0fc94c00(0000) GS:ffff8f6a8f600000(0000) knlGS:0000000000000000 [ 150.834379] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 150.834381] CR2: 00007faf0b600020 CR3: 000000010a52e000 CR4: 0000000000350ef0 [ 150.834383] Call Trace: [ 150.834385] <TASK> [ 150.834387] ? showregs+0x6d/0x80 [ 150.834393] ? warn+0x8c/0x140 [ 150.834397] ? checkunmap+0x1cc/0x930 [ 150.834400] ? reportbug+0x193/0x1a0 [ 150.834406] ? handlebug+0x46/0x80 [ 150.834410] ? excinvalidop+0x1d/0x80 [ 150.834413] ? asmexcinvalidop+0x1f/0x30 [ 150.834420] ? checkunmap+0x1cc/0x930 [ 150.834425] debugdmaunmappage+0x86/0x90 [ 150.834431] ? srsoreturnthunk+0x5/0x5f [ 150.834435] ---truncated---
Other sources
This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.
— Launchpad
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-57897?
CVE-2024-57897 has not been assigned a specific severity rating yet, but it addresses a critical concern in DMA mapping within the Linux kernel.
How do I fix CVE-2024-57897?
To remediate CVE-2024-57897, ensure that your Linux kernel is updated to the latest stable version that includes the fix for this vulnerability.
Which versions of the Linux kernel are affected by CVE-2024-57897?
CVE-2024-57897 affects specific versions of the Linux kernel but the details on the exact versions need to be confirmed from the kernel update announcements.
What components are involved in CVE-2024-57897?
CVE-2024-57897 specifically involves the DRM (Direct Rendering Manager) and the AMD KFD (Kernel Fusion Driver) components in the Linux kernel.
Is CVE-2024-57897 an exploit or a vulnerability?
CVE-2024-57897 is classified as a vulnerability that has been addressed, not an active exploit.