Skip to content

Commit db88697

Browse files
nathanchancetorvalds
authored andcommitted
x86/speculation: Use DECLARE_PER_CPU for x86_spec_ctrl_current
Clang warns: 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; ^ 1 error generated. The declaration should be using DECLARE_PER_CPU instead so all attributes stay in sync. Cc: stable@vger.kernel.org Fixes: fc02735 ("KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9bd572e commit db88697

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/x86/include/asm/nospec-branch.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <asm/cpufeatures.h>
1212
#include <asm/msr-index.h>
1313
#include <asm/unwind_hints.h>
14+
#include <asm/percpu.h>
1415

1516
#define RETPOLINE_THUNK_SIZE 32
1617

@@ -280,7 +281,7 @@ static inline void indirect_branch_prediction_barrier(void)
280281

281282
/* The Intel SPEC CTRL MSR base value cache */
282283
extern u64 x86_spec_ctrl_base;
283-
extern u64 x86_spec_ctrl_current;
284+
DECLARE_PER_CPU(u64, x86_spec_ctrl_current);
284285
extern void write_spec_ctrl_current(u64 val, bool force);
285286
extern u64 spec_ctrl_current(void);
286287

0 commit comments

Comments
 (0)