From: Lorenz Hetterich <lorenz.hetterich@cispa.de>
To: <chenhuacai@kernel.org>
Cc: <loongarch@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
Lorenz Hetterich <lorenz.hetterich@cispa.de>
Subject: [PATCH 1/2] Loongarch: Fix stale value in __do_page_fault()
Date: Wed, 18 Mar 2026 16:18:20 +0100 [thread overview]
Message-ID: <20260318151821.190439-2-lorenz.hetterich@cispa.de> (raw)
In-Reply-To: <20260318151821.190439-1-lorenz.hetterich@cispa.de>
__do_page_fault() calls kprobe_page_fault without setting
current->thread.trap_nr first.
Hence, kprobe_page_fault is called with a stale trapnr.
Set current->thread.trap_nr before calling kprobe_page_fault.
Signed-off-by: Lorenz Hetterich <lorenz.hetterich@cispa.de>
---
arch/loongarch/mm/fault.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/loongarch/mm/fault.c b/arch/loongarch/mm/fault.c
index 2c93d33356e5..c7703bdec4fc 100644
--- a/arch/loongarch/mm/fault.c
+++ b/arch/loongarch/mm/fault.c
@@ -182,6 +182,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs,
struct vm_area_struct *vma = NULL;
vm_fault_t fault;
+ current->thread.trap_nr = read_csr_excode();
if (kprobe_page_fault(regs, current->thread.trap_nr))
return;
--
2.43.0
next prev parent reply other threads:[~2026-03-18 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 15:18 [PATCH 0/2] Fix issues in LoongArch page fault handling Lorenz Hetterich
2026-03-18 15:18 ` Lorenz Hetterich [this message]
2026-03-19 8:30 ` [PATCH 1/2] Loongarch: Fix stale value in __do_page_fault() Huacai Chen
2026-03-18 15:18 ` [PATCH 2/2] LoongArch: Set FAULT_FLAG_INSTRUCTION " Lorenz Hetterich
2026-03-19 8:30 ` Huacai Chen
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=20260318151821.190439-2-lorenz.hetterich@cispa.de \
--to=lorenz.hetterich@cispa.de \
--cc=chenhuacai@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®