From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
linux-rt-devel@lists.linux.dev,
Xie Yuanbin <xieyuanbin1@huawei.com>,
Arnd Bergmann <arnd@arndb.de>,
Linus Walleij <linus.walleij@linaro.org>,
"Yadi.hu" <yadi.hu@windriver.com>
Subject: Re: [PATCH v3 2/5] ARM: mm: fault: Enable interrupts before invoking __do_user_fault()
Date: Tue, 2 Dec 2025 15:18:16 +0100 [thread overview]
Message-ID: <20251202141816.wfHNUMFK@linutronix.de> (raw)
In-Reply-To: <20251110145555.2555055-3-bigeasy@linutronix.de>
On 2025-11-10 15:55:52 [+0100], To linux-arm-kernel@lists.infradead.org wrote:
|
| https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9460/1
|
| Moved to Discarded.
|
| This makes the issues with the branch predictor hardening worse if this
| patch is merged on its own - since this adds another path where
| interrupts are enabled before calling harden_branch_predictor() in
| __do_user_fault(). It would be sensible to move the interrupt enable
| into __do_user_fault().
|
| *** PLEASE DO NOT REPLY TO THIS MESSAGE ***
I thought that we apply both.
In 9462/1 I am moving harden_branch_predictor() out of __do_user_fault()
because do_page_fault() needs the hardening before the interrupts are
enabled. Do mean something like
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 2bc828a1940c0..f70b98fb562b3 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -186,6 +186,7 @@ __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig,
if (addr > TASK_SIZE)
harden_branch_predictor();
+ local_irq_enable();
#ifdef CONFIG_DEBUG_USER
if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
((user_debug & UDBG_BUS) && (sig == SIGBUS))) {
@@ -274,8 +275,13 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
/* Enable interrupts if they were enabled in the parent context. */
- if (interrupts_enabled(regs))
+ if (interrupts_enabled(regs)) {
+ if (addr >= TASK_SIZE && user_mode(regs)) {
+ __do_user_fault(addr, fsr, SIGSEGV, SEGV_MAPERR, regs);
+ return 0;
+ }
local_irq_enable();
+ }
/*
* If we're in an interrupt or have no user
instead both patches? So now we end up in __do_user_fault() via
do_page_fault() with enabled interrupts but only for addr < TASK_SIZE
which does not involve harden_branch_predictor().
Sebastian
next prev parent reply other threads:[~2025-12-02 14:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 14:55 [PATCH v3 0/5] ARM: Remaining PREEMPT_RT bits Sebastian Andrzej Siewior
2025-11-10 14:55 ` [PATCH v3 1/5] ARM: mm: fault: Move harden_branch_predictor() before interrupts are enabled Sebastian Andrzej Siewior
2025-11-10 14:55 ` [PATCH v3 2/5] ARM: mm: fault: Enable interrupts before invoking __do_user_fault() Sebastian Andrzej Siewior
2025-12-02 14:18 ` Sebastian Andrzej Siewior [this message]
2025-12-02 15:46 ` Russell King (Oracle)
2025-12-02 16:05 ` Sebastian Andrzej Siewior
2025-11-10 14:55 ` [PATCH v3 3/5] ARM: Disable jump-label on PREEMPT_RT Sebastian Andrzej Siewior
2025-11-10 14:55 ` [PATCH v3 4/5] ARM: Disable HIGHPTE on PREEMPT_RT kernels Sebastian Andrzej Siewior
2025-11-10 14:55 ` [PATCH v3 5/5] ARM: Allow to enable RT Sebastian Andrzej Siewior
2025-11-11 15:16 ` [PATCH v3 0/5] ARM: Remaining PREEMPT_RT bits Arnd Bergmann
2025-11-11 15:59 ` Sebastian Andrzej Siewior
2025-11-12 2:53 ` Bryan Brattlof
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=20251202141816.wfHNUMFK@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=arnd@arndb.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux@armlinux.org.uk \
--cc=xieyuanbin1@huawei.com \
--cc=yadi.hu@windriver.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).