Skip to contentSkip to conversation

CVE-2026-98639: KVM: riscv: Fix NACL hfence entry update order

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 18

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

KVM: riscv: Fix NACL hfence entry update order

The SBI v3.0 specification (section 15.1.2) requires a nested HFENCE entry to be populated as follows:
1) find an unused entry with Config.Pending == 0
2) update the Page_Number and Page_Count words
3) update the Config word with Config.Pending set

__kvm_riscv_nacl_hfence() writes the Config word first, so the SBI implementation (or NACL hardware) can observe a pending entry with pnum/pcount values left over from the previous use of that entry, resulting in incorrect TLB flush ranges.

Write pnum and pcount first and the Config word last. Since the consumer is an external agent on coherent shared memory, use WRITE_ONCE() to stop the compiler from reordering the stores and smp_wmb() to make the parameter words globally visible before the Pending bit is set.

The Linux kernel CVE team has assigned CVE-2026-98639 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.13 with commit d466c19cead5904d4d5d92adb2b213b411d3b849 and fixed in 6.18.55 with commit d6de766d8d26d71b714f548192099112def50a9c
	Issue introduced in 6.13 with commit d466c19cead5904d4d5d92adb2b213b411d3b849 and fixed in 7.2.9 with commit 6da466502621381fa88a6684290923d25c559266
	Issue introduced in 6.13 with commit d466c19cead5904d4d5d92adb2b213b411d3b849 and fixed in 7.3-rc5 with commit b3d346838ec65fac7fd83f5dbcedd13cadfffddb

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-98639

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:
arch/riscv/kvm/nacl.c

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/d6de766d8d26d71b714f548192099112def50a9c
	https://git.kernel.org/stable/c/6da466502621381fa88a6684290923d25c559266
	https://git.kernel.org/stable/c/b3d346838ec65fac7fd83f5dbcedd13cadfffddb