Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f072015c authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman
Browse files

powerpc: disable KASAN instrumentation on early/critical files.



All files containing functions run before kasan_early_init() is called
must have KASAN instrumentation disabled.

For those file, branch profiling also have to be disabled otherwise
each if () generates a call to ftrace_likely_update().

Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent b4abe38f
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -31,6 +31,18 @@ CFLAGS_REMOVE_btext.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_prom.o = $(CC_FLAGS_FTRACE)
endif

KASAN_SANITIZE_early_32.o := n
KASAN_SANITIZE_cputable.o := n
KASAN_SANITIZE_prom_init.o := n
KASAN_SANITIZE_btext.o := n

ifdef CONFIG_KASAN
CFLAGS_early_32.o += -DDISABLE_BRANCH_PROFILING
CFLAGS_cputable.o += -DDISABLE_BRANCH_PROFILING
CFLAGS_prom_init.o += -DDISABLE_BRANCH_PROFILING
CFLAGS_btext.o += -DDISABLE_BRANCH_PROFILING
endif

obj-y				:= cputable.o ptrace.o syscalls.o \
				   irq.o align.o signal_32.o pmc.o vdso.o \
				   process.o systbl.o idle.o \
+8 −0
Original line number Diff line number Diff line
@@ -8,6 +8,14 @@ ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)

KASAN_SANITIZE_code-patching.o := n
KASAN_SANITIZE_feature-fixups.o := n

ifdef CONFIG_KASAN
CFLAGS_code-patching.o += -DDISABLE_BRANCH_PROFILING
CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING
endif

obj-y += alloc.o code-patching.o feature-fixups.o

ifndef CONFIG_KASAN
+6 −0
Original line number Diff line number Diff line
@@ -5,6 +5,12 @@

ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)

KASAN_SANITIZE_ppc_mmu_32.o := n

ifdef CONFIG_KASAN
CFLAGS_ppc_mmu_32.o  		+= -DDISABLE_BRANCH_PROFILING
endif

obj-y				:= fault.o mem.o pgtable.o mmap.o \
				   init_$(BITS).o pgtable_$(BITS).o \
				   pgtable-frag.o \
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,12 @@
CFLAGS_bootx_init.o  		+= -fPIC
CFLAGS_bootx_init.o  		+= $(call cc-option, -fno-stack-protector)

KASAN_SANITIZE_bootx_init.o := n

ifdef CONFIG_KASAN
CFLAGS_bootx_init.o  		+= -DDISABLE_BRANCH_PROFILING
endif

ifdef CONFIG_FUNCTION_TRACER
# Do not trace early boot code
CFLAGS_REMOVE_bootx_init.o = $(CC_FLAGS_FTRACE)
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

KASAN_SANITIZE := n

targets += trampoline.o purgatory.ro kexec-purgatory.c

LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined
Loading