From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Ellerman <mpe@ellerman.id.au>, Sudip Mukherjee <sudipm.mukherjee@gmail.com>, Sasha Levin <sashal@kernel.org>, christophe.leroy@csgroup.eu, ast@kernel.org, peterz@infradead.org, paulus@ozlabs.org, npiggin@gmail.com, dja@axtens.net, masahiroy@kernel.org, aneesh.kumar@linux.ibm.com, linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.18 04/10] powerpc/64s: Disable stack variable initialisation for prom_init Date: Mon, 1 Aug 2022 15:02:16 -0400 [thread overview] Message-ID: <20220801190222.3818378-4-sashal@kernel.org> (raw) In-Reply-To: <20220801190222.3818378-1-sashal@kernel.org> From: Michael Ellerman <mpe@ellerman.id.au> [ Upstream commit be640317a1d0b9cf42fedb2debc2887a7cfa38de ] With GCC 12 allmodconfig prom_init fails to build: Error: External symbol 'memset' referenced from prom_init.c make[2]: *** [arch/powerpc/kernel/Makefile:204: arch/powerpc/kernel/prom_init_check] Error 1 The allmodconfig build enables KASAN, so all calls to memset in prom_init should be converted to __memset by the #ifdefs in asm/string.h, because prom_init must use the non-KASAN instrumented versions. The build failure happens because there's a call to memset that hasn't been caught by the pre-processor and converted to __memset. Typically that's because it's a memset generated by the compiler itself, and that is the case here. With GCC 12, allmodconfig enables CONFIG_INIT_STACK_ALL_PATTERN, which causes the compiler to emit memset calls to initialise on-stack variables with a pattern. Because prom_init is non-user-facing boot-time only code, as a workaround just disable stack variable initialisation to unbreak the build. Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220718134418.354114-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin <sashal@kernel.org> --- arch/powerpc/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 4ddd161aef32..63c384c3e6d4 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -20,6 +20,7 @@ CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_prom_init.o += -fno-stack-protector CFLAGS_prom_init.o += -DDISABLE_BRANCH_PROFILING CFLAGS_prom_init.o += -ffreestanding +CFLAGS_prom_init.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized) ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -- 2.35.1
WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sasha Levin <sashal@kernel.org>, peterz@infradead.org, masahiroy@kernel.org, ast@kernel.org, npiggin@gmail.com, aneesh.kumar@linux.ibm.com, linuxppc-dev@lists.ozlabs.org, Sudip Mukherjee <sudipm.mukherjee@gmail.com>, dja@axtens.net Subject: [PATCH AUTOSEL 5.18 04/10] powerpc/64s: Disable stack variable initialisation for prom_init Date: Mon, 1 Aug 2022 15:02:16 -0400 [thread overview] Message-ID: <20220801190222.3818378-4-sashal@kernel.org> (raw) In-Reply-To: <20220801190222.3818378-1-sashal@kernel.org> From: Michael Ellerman <mpe@ellerman.id.au> [ Upstream commit be640317a1d0b9cf42fedb2debc2887a7cfa38de ] With GCC 12 allmodconfig prom_init fails to build: Error: External symbol 'memset' referenced from prom_init.c make[2]: *** [arch/powerpc/kernel/Makefile:204: arch/powerpc/kernel/prom_init_check] Error 1 The allmodconfig build enables KASAN, so all calls to memset in prom_init should be converted to __memset by the #ifdefs in asm/string.h, because prom_init must use the non-KASAN instrumented versions. The build failure happens because there's a call to memset that hasn't been caught by the pre-processor and converted to __memset. Typically that's because it's a memset generated by the compiler itself, and that is the case here. With GCC 12, allmodconfig enables CONFIG_INIT_STACK_ALL_PATTERN, which causes the compiler to emit memset calls to initialise on-stack variables with a pattern. Because prom_init is non-user-facing boot-time only code, as a workaround just disable stack variable initialisation to unbreak the build. Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220718134418.354114-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin <sashal@kernel.org> --- arch/powerpc/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 4ddd161aef32..63c384c3e6d4 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -20,6 +20,7 @@ CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_prom_init.o += -fno-stack-protector CFLAGS_prom_init.o += -DDISABLE_BRANCH_PROFILING CFLAGS_prom_init.o += -ffreestanding +CFLAGS_prom_init.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized) ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -- 2.35.1
next prev parent reply other threads:[~2022-08-01 19:02 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-01 19:02 [PATCH AUTOSEL 5.18 01/10] pinctrl: Don't allow PINCTRL_AMD to be a module Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 02/10] drm/amdgpu: Remove one duplicated ef removal Sasha Levin 2022-08-01 19:02 ` Sasha Levin 2022-08-01 19:02 ` Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 03/10] ntfs: fix use-after-free in ntfs_ucsncmp() Sasha Levin 2022-08-01 19:02 ` Sasha Levin [this message] 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 04/10] powerpc/64s: Disable stack variable initialisation for prom_init Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 05/10] spi: spi-rspi: Fix PIO fallback on RZ platforms Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 06/10] mmu_gather: Let there be one tlb_{start,end}_vma() implementation Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 07/10] mmu_gather: Force tlb-flush VM_PFNMAP vmas Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 08/10] netfilter: nf_tables: add rescheduling points during loop detection walks Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 09/10] netfilter: nft_queue: only allow supported familes and hooks Sasha Levin 2022-08-01 19:02 ` [PATCH AUTOSEL 5.18 10/10] ARM: findbit: fix overflowing offset Sasha Levin 2022-08-01 19:02 ` Sasha Levin
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=20220801190222.3818378-4-sashal@kernel.org \ --to=sashal@kernel.org \ --cc=aneesh.kumar@linux.ibm.com \ --cc=ast@kernel.org \ --cc=christophe.leroy@csgroup.eu \ --cc=dja@axtens.net \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=masahiroy@kernel.org \ --cc=mpe@ellerman.id.au \ --cc=npiggin@gmail.com \ --cc=paulus@ozlabs.org \ --cc=peterz@infradead.org \ --cc=stable@vger.kernel.org \ --cc=sudipm.mukherjee@gmail.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.