Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3402475imw; Mon, 18 Jul 2022 07:30:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uud2qIyLw6H7av/VlsYxLwmsnIaRHP3pOcGIfiYZzVpkehh+FYCiN1Uxo/ipSKOy+Te1X8 X-Received: by 2002:a05:622a:64c:b0:31e:b6c3:133e with SMTP id a12-20020a05622a064c00b0031eb6c3133emr21760924qtb.142.1658154659699; Mon, 18 Jul 2022 07:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658154659; cv=none; d=google.com; s=arc-20160816; b=ZnBa0Sq82j8FIBdbbFldej/ijihDXVEMGQlC+XFDpZ3ffso3yuz//gcMY2CBN3B4B5 LasPR5Z9x5x0YDZCBEhy0+CuASeiPAgT03V0Cxt0+6oWzrzPHy/+FPGZ7stwlLnpFR4Z nwBpx5Qk98vKjnB8JCaQALVBvyeWuL7V0mUxf1dZ3TuNU1bz1y+oEgM5cvPZ6COurUDY ImgsQNWaRbvR/4td56HMO/td+08gA0P0xMchPbQtTyiBgLRfo/P2ThyV6+rjw6XZT6cp T1zVDdX54rOqOhWdCOHfEFiuKKInvDDUfNNdLbSQ2k8oKw/POpePjSFqel242/fZoWJz 1y1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ct7Bb9TEvoCcCMzYFWgojsTrBCyiQvnckSQyh1hVRXk=; b=mh91/ZVP55fUxeKR9idp8julKYYBL6aAaO/E6CZRxFxTQ9QF4UYnniGQGlABMDsZ6N Hb7WXqGOsiqjsVDwVgfmzDId7ovOe0M5BvaUbtUhlJFEnXK2+8zt+TnwC9l/6gOTYB1W 7IheLOVakhipe6vbIOUVreb/2aw9PUwGwaxPhhpuFatStGvFCltoVYNmkd6vbWg9SXRD UlDcYQKvCVYaTRRicfTx3zvw5J8RPgg0xIFhZEk0HVJS1/wgdJuQXiqcHh6MChIjymIc N+VaYsitrBgnN1QW+hAQGnJ4M4Qw9nGnccqsHCKPhAHVpkhCq+V45WI86WHke8k01A0e Y3aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=pp5pG25f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a05620a258400b006aed85efc84si5786981qko.80.2022.07.18.07.30.45; Mon, 18 Jul 2022 07:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=pp5pG25f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234749AbiGRNov (ORCPT + 99 others); Mon, 18 Jul 2022 09:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233482AbiGRNou (ORCPT ); Mon, 18 Jul 2022 09:44:50 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF02C19C1C; Mon, 18 Jul 2022 06:44:48 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4LmjrH1XNRz4xZB; Mon, 18 Jul 2022 23:44:47 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1658151887; bh=ct7Bb9TEvoCcCMzYFWgojsTrBCyiQvnckSQyh1hVRXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pp5pG25f9wQVNn9FX01c5sgo/IisHcF/8CvZa4R8kaqhPha+c9zSoODzcOqIrsJEL 3H5Gx6FkwDM1wcu3KzoWndoIH1dj5PwXXPbDgJ3X3KSqLraoFK6+t2H/AEsZ4Rmi6l MGSLSQ3MYkjDvElAC1u/ElxqimB5GsZ7ZMvxTfHcrbIuVw+xg/zVLeiWTK1RBq59uH dih19E9zzkt2HIi1lwCFgc6Tm2O66He0G6LkHbtHt2QH4/sp9XID2qsmRNPrJJcVZS /xA4/Q0UTQfkUHm246ns0jMU4EhzEML6WwTs+5XWttr1GiapF6tjxNVSG6xaJJH09m TwOIO1Tc77JFw== From: Michael Ellerman To: Cc: sudipm.mukherjee@gmail.com, keescook@chromium.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, torvalds@linux-foundation.org Subject: [PATCH] powerpc/64s: Disable stack variable initialisation for prom_init Date: Mon, 18 Jul 2022 23:44:18 +1000 Message-Id: <20220718134418.354114-1-mpe@ellerman.id.au> X-Mailer: git-send-email 2.35.3 In-Reply-To: <87cze3docs.fsf@mpe.ellerman.id.au> References: <87cze3docs.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/powerpc/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index f91f0f29a566..c8cf924bf9c0 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.3