From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Xie Yuanbin <xieyuanbin1@huawei.com>
Cc: linux-arm-kernel@lists.infradead.org,
torvalds@linux-foundation.org, viro@zeniv.linux.org.uk,
will@kernel.org
Subject: Re: [PATCH 1/3] ARM: allow __do_kernel_fault() to report execution of memory faults
Date: Tue, 9 Dec 2025 08:43:19 +0000 [thread overview]
Message-ID: <aTfhJ1yN5fB3T-De@shell.armlinux.org.uk> (raw)
In-Reply-To: <20251209040223.25069-1-xieyuanbin1@huawei.com>
On Tue, Dec 09, 2025 at 12:02:23PM +0800, Xie Yuanbin wrote:
> On Mon, 08 Dec 2025 12:34:54 +0000, Russell King wrote:
> > diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
> > index 2bc828a1940c..f0884bf91dfa 100644
> > --- a/arch/arm/mm/fault.c
> > +++ b/arch/arm/mm/fault.c
> > @@ -162,6 +162,8 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
> > */
> > if (addr < PAGE_SIZE) {
> > msg = "NULL pointer dereference";
> > + } else if (is_permission_fault(fsr) && fsr & FSR_LNX_PF) {
> > + msg = "execution of memory";
> > } else {
> > if (is_translation_fault(fsr) &&
> > kfence_handle_page_fault(addr, is_write_fault(fsr), regs))
>
> This patch caused a compilation error, is_permission_fault() is not
> defined. Fixed with:
Thanks - as you've guessed I have some other patches on top of this
which move the is_xxx_fault() into fault.h.
However, for the sake of this series, my preferred fix is to group
all the is_xxx_fault() inline functions together as the first patch
of this series:
8<===
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Subject: [PATCH] ARM: group is_permission_fault() with is_translation_fault()
Group is_permission_fault() with is_translation_fault(), which is
needed to use is_permission_fault() in __do_kernel_fault(). As
this is static inline, there is no need for this to be under
CONFIG_MMU.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
arch/arm/mm/fault.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 2bc828a1940c..f87f353e5a8b 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -128,6 +128,19 @@ static inline bool is_translation_fault(unsigned int fsr)
return false;
}
+static inline bool is_permission_fault(unsigned int fsr)
+{
+ int fs = fsr_fs(fsr);
+#ifdef CONFIG_ARM_LPAE
+ if ((fs & FS_MMU_NOLL_MASK) == FS_PERM_NOLL)
+ return true;
+#else
+ if (fs == FS_L1_PERM || fs == FS_L2_PERM)
+ return true;
+#endif
+ return false;
+}
+
static void die_kernel_fault(const char *msg, struct mm_struct *mm,
unsigned long addr, unsigned int fsr,
struct pt_regs *regs)
@@ -225,19 +238,6 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
}
#ifdef CONFIG_MMU
-static inline bool is_permission_fault(unsigned int fsr)
-{
- int fs = fsr_fs(fsr);
-#ifdef CONFIG_ARM_LPAE
- if ((fs & FS_MMU_NOLL_MASK) == FS_PERM_NOLL)
- return true;
-#else
- if (fs == FS_L1_PERM || fs == FS_L2_PERM)
- return true;
-#endif
- return false;
-}
-
#ifdef CONFIG_CPU_TTBR0_PAN
static inline bool ttbr0_usermode_access_allowed(struct pt_regs *regs)
{
--
2.47.3
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2025-12-09 8:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 12:34 [PATCH 0/3] ARM: fix hash_name() and branch predictor issues Russell King (Oracle)
2025-12-08 12:34 ` [PATCH 1/3] ARM: allow __do_kernel_fault() to report execution of memory faults Russell King (Oracle)
2025-12-09 4:02 ` Xie Yuanbin
2025-12-09 8:43 ` Russell King (Oracle) [this message]
2025-12-08 12:34 ` [PATCH 2/3] ARM: fix hash_name() fault Russell King (Oracle)
2025-12-08 12:35 ` [PATCH 3/3] ARM: fix branch predictor hardening Russell King (Oracle)
2025-12-08 15:08 ` [PATCH 0/3] ARM: fix hash_name() and branch predictor issues Xie Yuanbin
2025-12-08 15:59 ` Russell King (Oracle)
2025-12-08 16:47 ` Russell King (Oracle)
2025-12-09 2:52 ` Xie Yuanbin
2025-12-09 8:56 ` Xie Yuanbin
2025-12-09 8:59 ` Russell King (Oracle)
2025-12-09 9:09 ` Xie Yuanbin
2025-12-10 9:08 ` Xie Yuanbin
2025-12-10 15:11 ` Russell King (Oracle)
2025-12-11 4:07 ` Xie Yuanbin
2025-12-09 2:15 ` Xie Yuanbin
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=aTfhJ1yN5fB3T-De@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=will@kernel.org \
--cc=xieyuanbin1@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).