From: Rohan McLure <rmclure@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: elver@google.com, arnd@arndb.de, gautam@linux.ibm.com,
Rohan McLure <rmclure@linux.ibm.com>,
npiggin@gmail.com, will@kernel.org
Subject: [PATCH 3/3] powerpc/64: Only warn for kuap locked when KCSAN not present
Date: Mon, 27 Nov 2023 16:46:47 +1100 [thread overview]
Message-ID: <20231127054648.1205221-4-rmclure@linux.ibm.com> (raw)
In-Reply-To: <20231127054648.1205221-2-rmclure@linux.ibm.com>
Arbitrary instrumented locations, including syscall handlers, can call
arch_local_irq_restore() transitively when KCSAN is enabled, and in turn
also replay_soft_interrupts_irqrestore(). The precondition on entry to
this routine that is checked is that KUAP is enabled (user access
prohibited). Failure to meet this condition only triggers a warning
however, and afterwards KUAP is enabled anyway. That is, KUAP being
disabled on entry is in fact permissable, but not possible on an
uninstrumented kernel.
Disable this assertion only when KCSAN is enabled.
Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
---
arch/powerpc/kernel/irq_64.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/irq_64.c b/arch/powerpc/kernel/irq_64.c
index 938e66829eae..1b7e8ebb052a 100644
--- a/arch/powerpc/kernel/irq_64.c
+++ b/arch/powerpc/kernel/irq_64.c
@@ -189,7 +189,8 @@ static inline __no_kcsan void replay_soft_interrupts_irqrestore(void)
* and re-locking AMR but we shouldn't get here in the first place,
* hence the warning.
*/
- kuap_assert_locked();
+ if (!IS_ENABLED(CONFIG_KCSAN))
+ kuap_assert_locked();
if (kuap_state != AMR_KUAP_BLOCKED)
set_kuap(AMR_KUAP_BLOCKED);
--
2.43.0
prev parent reply other threads:[~2023-11-27 5:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 5:46 [PATCH 1/3] asm-generic/mmiowb: Mark accesses to fix KCSAN warnings Rohan McLure
2023-11-27 5:46 ` [PATCH 2/3] powerpc: Apply __always_inline to interrupt_{enter,exit}_prepare() Rohan McLure
2023-11-27 5:46 ` Rohan McLure [this message]
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=20231127054648.1205221-4-rmclure@linux.ibm.com \
--to=rmclure@linux.ibm.com \
--cc=arnd@arndb.de \
--cc=elver@google.com \
--cc=gautam@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=will@kernel.org \
/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).