All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tao Cui <cui.tao@linux.dev>
To: chenhuacai@kernel.org
Cc: kernel@xen0n.name, loongarch@lists.linux.dev, cui.tao@linux.dev,
	Tao Cui <cuitao@kylinos.cn>
Subject: [PATCH] LoongArch: Use pmdp_get() in spurious_fault()
Date: Sun,  6 Dec 2026 14:24:04 +0800	[thread overview]
Message-ID: <20261206062404.306981-1-cui.tao@linux.dev> (raw)

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


                 reply	other threads:[~2026-12-06  6:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261206062404.306981-1-cui.tao@linux.dev \
    --to=cui.tao@linux.dev \
    --cc=chenhuacai@kernel.org \
    --cc=cuitao@kylinos.cn \
    --cc=kernel@xen0n.name \
    --cc=loongarch@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.