From: Paul Mackerras <paulus@ozlabs.org>
To: linuxppc-dev@ozlabs.org
Cc: Daniel Axtens <dja@axtens.net>
Subject: [PATCH v2 5/6] powerpc/kasan: Disable address sanitization in kexec paths
Date: Wed, 18 May 2022 20:07:05 +1000 [thread overview]
Message-ID: <YoTFSQ2TUSEaDdVC@cleo> (raw)
In-Reply-To: <YoTEb2BaH3MDkH+2@cleo>
From: Daniel Axtens <dja@axtens.net>
The kexec code paths involve code that necessarily run in real mode,
as CPUs are disabled and control is transferred to the new kernel.
Disable address sanitization for the kexec code and the functions
called in real mode on CPUs being disabled.
[paulus@ozlabs.org: combined a few work-in-progress commits of
Daniel's and wrote the commit message.]
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
arch/powerpc/kexec/Makefile | 2 ++
arch/powerpc/platforms/pseries/Makefile | 3 +++
arch/powerpc/sysdev/xics/xics-common.c | 4 ++--
arch/powerpc/sysdev/xive/common.c | 4 ++--
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kexec/Makefile b/arch/powerpc/kexec/Makefile
index b6c52608cb49..0c2abe7f9908 100644
--- a/arch/powerpc/kexec/Makefile
+++ b/arch/powerpc/kexec/Makefile
@@ -13,3 +13,5 @@ obj-$(CONFIG_KEXEC_FILE) += file_load.o ranges.o file_load_$(BITS).o elf_$(BITS)
GCOV_PROFILE_core_$(BITS).o := n
KCOV_INSTRUMENT_core_$(BITS).o := n
UBSAN_SANITIZE_core_$(BITS).o := n
+KASAN_SANITIZE_core.o := n
+KASAN_SANITIZE_core_$(BITS) := n
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index b407fdeb6e78..98e878c32a21 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -35,3 +35,6 @@ obj-$(CONFIG_ARCH_HAS_CC_PLATFORM) += cc_platform.o
# nothing that operates in real mode is safe for KASAN
KASAN_SANITIZE_ras.o := n
+KASAN_SANITIZE_kexec.o := n
+#machine_kexec
+KASAN_SANITIZE_setup.o := n
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index f3fb2a12124c..322b2b8bd467 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -146,7 +146,7 @@ void __init xics_smp_probe(void)
#endif /* CONFIG_SMP */
-void xics_teardown_cpu(void)
+noinstr void xics_teardown_cpu(void)
{
struct xics_cppr *os_cppr = this_cpu_ptr(&xics_cppr);
@@ -159,7 +159,7 @@ void xics_teardown_cpu(void)
icp_ops->teardown_cpu();
}
-void xics_kexec_teardown_cpu(int secondary)
+noinstr void xics_kexec_teardown_cpu(int secondary)
{
xics_teardown_cpu();
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 1ca5564bda9d..87b825b7401d 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -1241,7 +1241,7 @@ static int xive_setup_cpu_ipi(unsigned int cpu)
return 0;
}
-static void xive_cleanup_cpu_ipi(unsigned int cpu, struct xive_cpu *xc)
+noinstr static void xive_cleanup_cpu_ipi(unsigned int cpu, struct xive_cpu *xc)
{
unsigned int xive_ipi_irq = xive_ipi_cpu_to_irq(cpu);
@@ -1634,7 +1634,7 @@ void xive_flush_interrupt(void)
#endif /* CONFIG_SMP */
-void xive_teardown_cpu(void)
+noinstr void xive_teardown_cpu(void)
{
struct xive_cpu *xc = __this_cpu_read(xive_cpu);
unsigned int cpu = smp_processor_id();
--
2.35.3
next prev parent reply other threads:[~2022-05-18 10:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 10:03 [PATCH v2 0/6] KASAN support for 64-bit Book 3S powerpc Paul Mackerras
2022-05-18 10:04 ` [PATCH v2 1/6] kasan: Document support on 32-bit powerpc Paul Mackerras
2022-05-18 10:04 ` [PATCH v2 2/6] powerpc/mm/kasan: rename kasan_init_32.c to init_32.c Paul Mackerras
2022-05-18 10:05 ` [PATCH v2 3/6] powerpc: Book3S 64-bit outline-only KASAN support Paul Mackerras
2022-06-02 15:18 ` Guenter Roeck
2022-05-18 10:06 ` [PATCH v2 4/6] powerpc/kasan: Don't instrument non-maskable or raw interrupts Paul Mackerras
2022-05-18 10:07 ` Paul Mackerras [this message]
2022-05-18 10:07 ` [PATCH v2 6/6] Documentation/kasan: Update details of KASAN on powerpc Paul Mackerras
2022-11-14 12:49 ` Christophe Leroy
2022-05-18 13:29 ` [PATCH v2 0/6] KASAN support for 64-bit Book 3S powerpc Christophe Leroy
2022-05-24 11:09 ` Michael Ellerman
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=YoTFSQ2TUSEaDdVC@cleo \
--to=paulus@ozlabs.org \
--cc=dja@axtens.net \
--cc=linuxppc-dev@ozlabs.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).