From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D86ABC00144 for ; Mon, 1 Aug 2022 19:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234397AbiHATD7 (ORCPT ); Mon, 1 Aug 2022 15:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234261AbiHATDX (ORCPT ); Mon, 1 Aug 2022 15:03:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0772B326E2; Mon, 1 Aug 2022 12:02:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3DAEEB8163D; Mon, 1 Aug 2022 19:02:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A385C433C1; Mon, 1 Aug 2022 19:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659380571; bh=ai9n7In6AvAmJCXp8dgLUdN/R33ZQxYkQ1xdEtuRzyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJ1qFUOuCRn3kWaSGgLWeW/uWPhH/GJYXaJhbhP0Z2g9D33UNc1rqoSw9Sda0QoWS jatA/nWZDzSSPLQ0uq29JwuUANTnmS/JOlXpMd44ZDCmm0PeHf2eqsKW4Xi1qLi7ND Hjig+VXHaQAl8h7dE+ljwYp6v3QjB7OD6J5l8RMfQORI7Shova/Qzcg7aR2z24Kzn8 sBlXfeBXSPUA12F7KyKG2Hr8w+43HI9OLOnuyErXlZNU3kDe5hoJYi8foN1cVQo//3 0Z9bRlyuVFCNIOl58pVnkIdk5QEb4XmfXKLd865HHs/Bia+/JMA1LMeXBvTDOXFPEq ed2Qkkb8CfFug== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Ellerman , Sudip Mukherjee , Sasha Levin , christophe.leroy@csgroup.eu, peterz@infradead.org, paulus@ozlabs.org, ast@kernel.org, aneesh.kumar@linux.ibm.com, dja@axtens.net, masahiroy@kernel.org, npiggin@gmail.com, linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.15 3/8] powerpc/64s: Disable stack variable initialisation for prom_init Date: Mon, 1 Aug 2022 15:02:38 -0400 Message-Id: <20220801190243.3818811-3-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220801190243.3818811-1-sashal@kernel.org> References: <20220801190243.3818811-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ 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 Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220718134418.354114-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index b1b23b4d56ba..ed91d5b9ffc6 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27FDEC00144 for ; Mon, 1 Aug 2022 19:03:53 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LxSFz3Yj4z3dr6 for ; Tue, 2 Aug 2022 05:03:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=LJ1qFUOu; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=sashal@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=LJ1qFUOu; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LxSDt2y8qz3bmY for ; Tue, 2 Aug 2022 05:02:54 +1000 (AEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 787D061218; Mon, 1 Aug 2022 19:02:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A385C433C1; Mon, 1 Aug 2022 19:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659380571; bh=ai9n7In6AvAmJCXp8dgLUdN/R33ZQxYkQ1xdEtuRzyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJ1qFUOuCRn3kWaSGgLWeW/uWPhH/GJYXaJhbhP0Z2g9D33UNc1rqoSw9Sda0QoWS jatA/nWZDzSSPLQ0uq29JwuUANTnmS/JOlXpMd44ZDCmm0PeHf2eqsKW4Xi1qLi7ND Hjig+VXHaQAl8h7dE+ljwYp6v3QjB7OD6J5l8RMfQORI7Shova/Qzcg7aR2z24Kzn8 sBlXfeBXSPUA12F7KyKG2Hr8w+43HI9OLOnuyErXlZNU3kDe5hoJYi8foN1cVQo//3 0Z9bRlyuVFCNIOl58pVnkIdk5QEb4XmfXKLd865HHs/Bia+/JMA1LMeXBvTDOXFPEq ed2Qkkb8CfFug== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 3/8] powerpc/64s: Disable stack variable initialisation for prom_init Date: Mon, 1 Aug 2022 15:02:38 -0400 Message-Id: <20220801190243.3818811-3-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220801190243.3818811-1-sashal@kernel.org> References: <20220801190243.3818811-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , peterz@infradead.org, masahiroy@kernel.org, ast@kernel.org, npiggin@gmail.com, aneesh.kumar@linux.ibm.com, linuxppc-dev@lists.ozlabs.org, Sudip Mukherjee , dja@axtens.net Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Michael Ellerman [ 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 Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220718134418.354114-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index b1b23b4d56ba..ed91d5b9ffc6 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