All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Use pmdp_get() in spurious_fault()
@ 2026-12-06  6:24 Tao Cui
  0 siblings, 0 replies; only message in thread
From: Tao Cui @ 2026-12-06  6:24 UTC (permalink / raw)
  To: chenhuacai; +Cc: kernel, loongarch, cui.tao, Tao Cui

From: Tao Cui <cuitao@kylinos.cn>

The spurious_fault() page table walk reads every level through the
pudp_get()/pmdp_get()/ptep_get() accessors except for the pmd_leaf()
check, which dereferences the pmd directly.  Commit f93f67d06b10
("LoongArch: Improve hardware page table walker") introduced this line
as the only bare dereference of the walk, so KCSAN flags a data race
on it against concurrent page table updates.  Use pmdp_get() like
everywhere else in the function.

Tested on x86_64 host with qemu-system-loongarch64 -M virt (TCG,
QEMU 11.1.1) and edk2-stable202408 firmware: the patched kernel boots
with no functional change; the data race is identified by KCSAN
inspection rather than a runtime splat.

Fixes: f93f67d06b10 ("LoongArch: Improve hardware page table walker")
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
---
 arch/loongarch/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/mm/fault.c b/arch/loongarch/mm/fault.c
index 2c93d33356e5..f54749cb5f2a 100644
--- a/arch/loongarch/mm/fault.c
+++ b/arch/loongarch/mm/fault.c
@@ -58,7 +58,7 @@ static int __kprobes spurious_fault(unsigned long write, unsigned long address)
 	if (!pmd_present(pmdp_get(pmd)))
 		return 0;
 
-	if (pmd_leaf(*pmd)) {
+	if (pmd_leaf(pmdp_get(pmd))) {
 		return write ? pmd_write(pmdp_get(pmd)) : 1;
 	} else {
 		pte = pte_offset_kernel(pmd, address);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-06  6:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-06  6:24 [PATCH] LoongArch: Use pmdp_get() in spurious_fault() Tao Cui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.