{"id":"CVE-2026-98520","kind":"vulnerability","aliases":["CVE-2026-98520"],"related":[],"title":"Linux kernel amdgpu KFD: use-after-free and rwsem hang on GPU reset","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ndrm/amdkfd: fix use-after-free and multi-container gap in kfd_dev_mapping\n\nkfd_dev_mapping caches the address_space of the first /dev/kfd opener\nso that the GPU reset path can call unmap_mapping_range() to zap all\nuserspace mappings of doorbell and MMIO ranges.  This design has two\nbugs that both manifest under SRIOV with multiple containers:\n\n1. Use-after-free / rwsem deadlock.  The cached pointer refers to an\n   inode owned by the first opener's container.  When that container\n   exits and its inode is released, kfd_dev_mapping becomes a dangling\n   pointer.  A subsequent GPU reset dereferences it inside\n   unmap_mapping_range(), which takes i_mmap_rwsem on the freed inode,\n   causing a hard hang observable as an uninterruptible rwsem wait.\n\n2. Multi-container gap.  Only the first opener's address_space is cached;\n   VMAs created by later openers live in a different address_space and\n   are never reached by unmap_mapping_range().  After a GPU reset those\n   stale mappings keep doorbell and MMIO pages accessible to guest\n   userspace with no GPU behind them, risking PCIe transaction timeouts\n   and NMI panics.\n\nFix both bugs with the same approach used by DRM core (drm_drv.c):\ncreate a private pseudo-filesystem at module init time and allocate one\nanonymous inode from it.  In kfd_open() redirect every opener's\nfile->f_mapping to that inode's address_space.  The inode is\nmodule-owned, lives exactly as long as the amdgpu module, and collects\nVMAs from all openers in one address_space.  A single\nunmap_mapping_range() call in the reset path then correctly reaches\nevery container's mappings with no dangling pointer risk.\n\nThe hang manifests as an NMI backtrace on the GPU reset workqueue stuck\nspinning in rwsem_down_read_slowpath() with a corrupted i_mmap_rwsem:\n\n  Workqueue: amdgpu-reset-dev xgpu_ai_mailbox_flr_work [amdgpu]\n  Call Trace:\n   <TASK>\n   kvm_wait+0x1f/0x40\n   __pv_queued_spin_lock_slowpath+0x31d/0x3a0\n   _raw_spin_lock_irq+0x51/0x80\n   rwsem_down_read_slowpath+0xb3/0x550\n   down_read+0x48/0xd0\n   unmap_mapping_range+0x71/0x140\n   kfd_dev_unmap_mapping_range+0x5b/0x140 [amdgpu]\n   amdgpu_amdkfd_clear_kfd_mapping+0xd8/0x190 [amdgpu]\n   amdgpu_device_gpu_recover+0x232/0x450 [amdgpu]\n   xgpu_ai_mailbox_flr_work+0xb5/0xc0 [amdgpu]\n   process_one_work+0x18e/0x3e0\n   worker_thread+0x2e3/0x420\n   kthread+0x10a/0x230\n\n(cherry picked from commit 1128b4a52de1572e87431de837fd9850cb99542c)","summary":"The amdgpu KFD driver cached the address space of the first /dev/kfd opener, which becomes a dangling pointer when that container exits, and later openers' mappings were not zapped on GPU reset. The result is a kernel hang on GPU reset under SRIOV with multiple containers, and stale doorbell and MMIO mappings left reachable by guest userspace.","severity":"unknown","cvss":null,"epss":null,"exploited":false,"exploited_at":null,"products":[],"ecosystems":[],"tags":["amdgpu","kfd","linux-kernel","rocm","runtime","sriov"],"not_affected_if":["no-amd-gpu","no-sriov"],"how_to_check":"- unknown","fix":"- Update the Linux kernel to a release that includes commit 1128b4a52de1572e87431de837fd9850cb99542c (the sources do not name the fixed version)","status":"open","published_at":"2026-10-18T16:17:03+00:00","first_seen_at":"2026-10-23T21:57:15+00:00","triaged_at":"2026-10-25T05:25:14+00:00","updated_at":"2026-10-25T05:25:14+00:00","category":"runtime","confidence":0.6,"triage":{"at":"2026-10-25T05:25:14Z","model":"claude-haiku-5-5","output":{"fix":"- Update the Linux kernel to a release that includes commit 1128b4a52de1572e87431de837fd9850cb99542c (the sources do not name the fixed version)","reach":"local","title":"Linux kernel amdgpu KFD: use-after-free and rwsem hang on GPU reset","impact":"medium","summary":"The amdgpu KFD driver cached the address space of the first /dev/kfd opener, which becomes a dangling pointer when that container exits, and later openers' mappings were not zapped on GPU reset. The result is a kernel hang on GPU reset under SRIOV with multiple containers, and stale doorbell and MMIO mappings left reachable by guest userspace.","category":"runtime","nicknames":[],"who_cares":["linux-kernel","amdgpu","sriov","rocm","kfd"],"confidence":0.6,"needs_auth":"unknown","worst_case":"GPU reset hangs the kernel; guest userspace keeps stale doorbell access","analyst_note":"Find the fixed kernel version and stable backport list for commit 1128b4a52de1572e87431de837fd9850cb99542c via the NVD entry or kernel.org stable tree.","how_to_check":"- unknown","needs_analyst":true,"not_affected_if":["no-amd-gpu","no-sriov"],"who_is_affected":"Systems running the Linux kernel amdgpu driver with KFD (ROCm compute) under SRIOV virtualization with multiple containers or guests sharing the GPU. Systems without AMD GPUs using SRIOV, or not using KFD, are unlikely to be affected; the sources do not say more.","user_interaction":"no","needs_special_setup":"yes","severity_if_unknown":"unknown"},"cost_usd":0.000733,"input_tokens":4325,"output_tokens":602,"severity_before":"unknown"},"analyst_status":null,"analyst_note":null,"search":"'+0':416C,423C,429C,435C,439C,444C,451C,459C,466C,474C,480C,484C,487C '-2026':16A,19A '-98520':17A,20A '/dev/kfd':40B,121C '1':157C '1128b4a52de1572e87431de837fd9850cb99542c':493C '2':223C 'access':268C 'address':35B,116C,233C,246C,328C,352C 'ai':407C,470C 'alloc':308C 'amdgpu':3A,21B,30B,342C,403C,411C,453C,454C,461C,462C,468C,476C 'amdgpu-reset-dev':402C 'amdkfd':455C 'anonym':310C 'approach':290C 'backtrac':382C 'becom':43B,190C 'behind':275C 'bug':148C,286C 'cach':33B,114C,165C,236C 'call':130C,359C,412C 'caus':213C 'cherri':489C 'clear':456C 'collect':345C 'commit':492C 'contain':49B,74B,105C,156C,177C,180C,226C,368C 'core':294C 'correct':365C 'corrupt':397C 'creat':238C,297C 'cve':15A,18A 'dangl':45B,192C,373C 'deadlock':163C 'derefer':198C 'design':145C 'dev':109C,112C,188C,405C,447C 'devic':463C 'differ':245C 'doorbel':77B,140C,264C 'driver':32B 'drm':293C,295C 'drm/amdkfd':96C 'drv.c':296C 'everi':318C,367C 'exact':337C 'exit':50B,181C 'f':322C 'file':321C 'filesystem':302C 'first':39B,120C,174C,230C 'fix':97C,284C 'flr':409C,472C 'follow':91C 'free':8A,101C,161C 'freed':211C 'gap':106C,227C 'gpu':13A,59B,68B,126C,196C,258C,274C,385C,464C 'guest':84B,270C 'hang':11A,66B,216C,377C 'hard':215C 'init':305C 'inod':170C,184C,212C,311C,326C,331C 'insid':200C 'irq':428C 'keep':263C 'kernel':2A,25B,65B,89C 'kfd':4A,22B,31B,108C,111C,187C,315C,446C,457C 'kthread':486C 'kvm':414C 'later':52B,240C 'left':81B 'linux':1A,24B,88C 'linux-kernel':23B 'live':242C,336C 'lock':421C,427C 'long':339C 'mailbox':408C,471C 'manifest':151C,378C 'map':54B,80B,110C,113C,132C,138C,189C,202C,254C,262C,323C,357C,370C,442C,449C,458C 'mmap':207C,399C 'mmio':79B,142C,266C 'modul':304C,334C,343C 'module-own':333C 'multi':104C,225C 'multi-contain':103C,224C 'multipl':73B,155C 'never':250C 'nmi':282C,381C 'observ':217C 'one':309C,351C,478C 'open':41B,53B,122C,175C,231C,241C,316C,319C,349C 'own':171C,335C 'page':267C 'panic':283C 'path':128C,363C 'pcie':278C 'pick':490C 'pointer':46B,166C,193C,374C 'privat':299C 'process':477C 'pseudo':301C 'pseudo-filesystem':300C 'pv':418C 'queu':419C 'rang':133C,143C,203C,255C,358C,443C,450C 'raw':425C 'reach':251C,366C 'reachabl':82B 'read':393C,433C,438C 'recov':465C 'redirect':317C 'refer':167C 'releas':186C 'reset':14A,60B,69B,127C,197C,259C,362C,386C,404C 'resolv':95C 'result':62B 'risk':277C,375C 'rocm':26B 'runtim':27B 'rwsem':10A,162C,208C,221C,391C,400C,431C 'singl':355C 'slowpath':394C,422C,434C 'space':36B,117C,234C,247C,329C,353C 'spin':389C,420C,426C 'sriov':28B,71B,153C 'stale':76B,261C 'stuck':388C 'subsequ':195C 'take':205C 'thread':483C 'time':306C 'timeout':280C 'trace':413C 'transact':279C 'two':147C 'uninterrupt':220C 'unmap':131C,201C,253C,356C,441C,448C 'use':6A,99C,159C,291C 'use-after-fre':5A,98C,158C 'userspac':85B,137C,271C 'vmas':237C,346C 'vulner':92C 'wait':222C,415C 'work':410C,473C,479C 'worker':482C 'workqueu':387C,401C 'x10a/0x230':488C 'x18e/0x3e0':481C 'x1f/0x40':417C 'x232/0x450':467C 'x2e3/0x420':485C 'x31d/0x3a0':424C 'x48/0xd0':440C 'x51/0x80':430C 'x5b/0x140':452C 'x71/0x140':445C 'xb3/0x550':436C 'xb5/0xc0':475C 'xd8/0x190':460C 'xgpu':406C,469C 'zap':57B,135C","nicknames":[],"mitigations":[],"who_affected":"Systems running the Linux kernel amdgpu driver with KFD (ROCm compute) under SRIOV virtualization with multiple containers or guests sharing the GPU. Systems without AMD GPUs using SRIOV, or not using KFD, are unlikely to be affected; the sources do not say more.","tier":"C","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-18T16:17:03+00:00","kev":null,"cvss_vector":null,"cvss_by":null,"poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-98520","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-98520","severity":null,"published_at":"2026-10-18T16:17:03+00:00","modified_at":"2026-10-19T10:19:05+00:00","first_seen_at":"2026-10-23T21:57:15+00:00","fetched_at":"2026-10-23T22:28:56+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}