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 C48DAC43334 for ; Wed, 13 Jul 2022 12:22:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235165AbiGMMWg (ORCPT ); Wed, 13 Jul 2022 08:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235991AbiGMMWc (ORCPT ); Wed, 13 Jul 2022 08:22:32 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38BB9E2A2E; Wed, 13 Jul 2022 05:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=TcBfClxdcPPLZTVh2Tcevitg6Ai2r8deiaUkH5/8lM0=; b=d2j+/Xv5K+y1JSBxZaxTeOKH5Z TWUuileEAoqTdJk0ZWJRwP7XZcb1wwOcrMDY/3z7H9WoKoCWJaGONv2PPAWLLk6u97Kc6GMmxVgz7 jg6XBi3QOsqOOGdNTFQx0FQx9cci4lIRz7y8OHQ1iYHXIK80p5II1NOUrvj86GrohPxCQsVykBBPP qMxNhMq5UgdIgTrsu5RnCJaAEwcX5JVEnPZyNR0lcmwJfR51nu6AqkXgXChlxMeVvQL2aUm4mOAv9 4/C/D97Yj4CJ/ol8dr5Hhn9aVSbH9XS2LWdyefTUFnetIsmwL1k1EuosOeOoEF2oRdwyJqOEaVcvL hDp1Pa0w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBbNT-003Yyq-Pd; Wed, 13 Jul 2022 12:22:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 87D77300252; Wed, 13 Jul 2022 14:22:01 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 72786201DA175; Wed, 13 Jul 2022 14:22:01 +0200 (CEST) Date: Wed, 13 Jul 2022 14:22:01 +0200 From: Peter Zijlstra To: "Sudip Mukherjee (Codethink)" Cc: Josh Poimboeuf , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Linus Torvalds Subject: Re: mainline build failure due to fc02735b14ff ("KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS") Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 13, 2022 at 01:35:22PM +0200, Peter Zijlstra wrote: > On Wed, Jul 13, 2022 at 12:28:38PM +0100, Sudip Mukherjee (Codethink) wrote: > > Hi All, > > > > The latest mainline kernel branch fails to build for x86_64 allmodconfig > > with clang and the error is: > > > > arch/x86/kernel/cpu/bugs.c:58:21: error: section attribute is specified on redeclared variable [-Werror,-Wsection] > > DEFINE_PER_CPU(u64, x86_spec_ctrl_current); > > ^ > > ./arch/x86/include/asm/nospec-branch.h:283:12: note: previous declaration is here > > extern u64 x86_spec_ctrl_current; > > > > > > git bisect pointed to fc02735b14ff ("KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS") > > > > I will be happy to test any patch or provide any extra log if needed. > > I suspect something like this will do. > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > index bb05ed4f46bd..6398d39e66b0 100644 > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -280,7 +280,7 @@ static inline void indirect_branch_prediction_barrier(void) > > /* The Intel SPEC CTRL MSR base value cache */ > extern u64 x86_spec_ctrl_base; > -extern u64 x86_spec_ctrl_current; > +DECLARE_PER_CPU(u64, x86_spec_ctrl_current); > extern void write_spec_ctrl_current(u64 val, bool force); > extern u64 spec_ctrl_current(void); > I hate headers... --- diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index bb05ed4f46bd..cbc3b8348939 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -280,7 +280,6 @@ static inline void indirect_branch_prediction_barrier(void) /* The Intel SPEC CTRL MSR base value cache */ extern u64 x86_spec_ctrl_base; -extern u64 x86_spec_ctrl_current; extern void write_spec_ctrl_current(u64 val, bool force); extern u64 spec_ctrl_current(void); diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index be7c19374fdd..b64512978534 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -6831,6 +6831,8 @@ void noinstr vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp) } } +DECLARE_PER_CPU(u64, x86_spec_ctrl_current); + void noinstr vmx_spec_ctrl_restore_host(struct vcpu_vmx *vmx, unsigned int flags) {