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 X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16C0BC4338F for ; Mon, 16 Aug 2021 08:40:08 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 73ED161B26 for ; Mon, 16 Aug 2021 08:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 73ED161B26 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gp6zp1Jt4z3cQZ for ; Mon, 16 Aug 2021 18:40:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.235.10; helo=pegase2.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=) Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Gp6zL0mPbz2yLN for ; Mon, 16 Aug 2021 18:39:40 +1000 (AEST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Gp6zG0jX4z9sVQ; Mon, 16 Aug 2021 10:39:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QeIOGfVnfAuW; Mon, 16 Aug 2021 10:39:38 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Gp6zF6rKQz9sVN; Mon, 16 Aug 2021 10:39:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D03FE8B78B; Mon, 16 Aug 2021 10:39:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id SOZVl7nXecqU; Mon, 16 Aug 2021 10:39:37 +0200 (CEST) Received: from [172.25.230.100] (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 95EC28B788; Mon, 16 Aug 2021 10:39:37 +0200 (CEST) Subject: Re: [PATCH 2/3] powerpc: Fix undefined static key To: Joel Stanley , Paul Mackerras , Michael Neuling , Anton Blanchard , Michael Ellerman , Nicholas Piggin , linuxppc-dev@lists.ozlabs.org References: <20210816082403.2293846-1-joel@jms.id.au> <20210816082403.2293846-3-joel@jms.id.au> From: Christophe Leroy Message-ID: <492edb10-ccef-c6f2-2fd3-71cf8ae54cfc@csgroup.eu> Date: Mon, 16 Aug 2021 10:39:32 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210816082403.2293846-3-joel@jms.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr 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: Daniel Axtens Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Le 16/08/2021 à 10:24, Joel Stanley a écrit : > When CONFIG_PPC_BARRIER_NOSPEC=n, security.c is not built leading to a > missing definition of uaccess_flush_key. > > LD vmlinux.o > MODPOST vmlinux.symvers > MODINFO modules.builtin.modinfo > GEN modules.builtin > LD .tmp_vmlinux.kallsyms1 > powerpc64le-linux-gnu-ld: arch/powerpc/kernel/align.o:(.toc+0x0): undefined reference to `uaccess_flush_key' > powerpc64le-linux-gnu-ld: arch/powerpc/kernel/signal_64.o:(.toc+0x0): undefined reference to `uaccess_flush_key' > powerpc64le-linux-gnu-ld: arch/powerpc/kernel/process.o:(.toc+0x0): undefined reference to `uaccess_flush_key' > powerpc64le-linux-gnu-ld: arch/powerpc/kernel/traps.o:(.toc+0x0): undefined reference to `uaccess_flush_key' > powerpc64le-linux-gnu-ld: arch/powerpc/kernel/hw_breakpoint_constraints.o:(.toc+0x0): undefined reference to `uaccess_flush_key' > powerpc64le-linux-gnu-ld: arch/powerpc/kernel/ptrace/ptrace.o:(.toc+0x0): more undefined references to `uaccess_flush_key' follow > make[1]: *** [Makefile:1176: vmlinux] Error 1 > > Hack one in to fix the build. > > Signed-off-by: Joel Stanley > --- > arch/powerpc/include/asm/security_features.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/powerpc/include/asm/security_features.h b/arch/powerpc/include/asm/security_features.h > index 792eefaf230b..46ade7927a4c 100644 > --- a/arch/powerpc/include/asm/security_features.h > +++ b/arch/powerpc/include/asm/security_features.h > @@ -39,6 +39,9 @@ static inline bool security_ftr_enabled(u64 feature) > return !!(powerpc_security_features & feature); > } > > +#ifndef CONFIG_PPC_BARRIER_NOSPEC > +DEFINE_STATIC_KEY_FALSE(uaccess_flush_key); > +#endif It will then be re-defined by each file that includes asm/security_features.h .... You can't use a DEFINE_ in a .h You have to fix the problem at its source. Cleanest way I see it to modify asm/book3s/64/kup.h and something like if (IS_ENABLED(CONFIG_PPC_BARRIER_NOSPEC) && static_branch_unlikely(&uaccess_flush_key) > > // Features indicating support for Spectre/Meltdown mitigations > >