Skip to content

Commit 39d64ee

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/percpu: Correct PER_CPU_VAR() usage to include symbol and its addend
The PER_CPU_VAR() macro should be applied to a symbol and its addend. Inconsistent usage is currently harmless, but needs to be corrected before %rip-relative addressing is introduced to the PER_CPU_VAR() macro. No functional changes intended. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: linux-kernel@vger.kernel.org Cc: Brian Gerst <brgerst@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Sean Christopherson <seanjc@google.com>
1 parent 24b8a23 commit 39d64ee

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

arch/x86/entry/calling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ For 32-bit we have the following conventions - kernel is built with
173173
.endm
174174

175175
#define THIS_CPU_user_pcid_flush_mask \
176-
PER_CPU_VAR(cpu_tlbstate) + TLB_STATE_user_pcid_flush_mask
176+
PER_CPU_VAR(cpu_tlbstate + TLB_STATE_user_pcid_flush_mask)
177177

178178
.macro SWITCH_TO_USER_CR3_NOSTACK scratch_reg:req scratch_reg2:req
179179
ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI

arch/x86/entry/entry_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@
305305
.macro CHECK_AND_APPLY_ESPFIX
306306
#ifdef CONFIG_X86_ESPFIX32
307307
#define GDT_ESPFIX_OFFSET (GDT_ENTRY_ESPFIX_SS * 8)
308-
#define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + GDT_ESPFIX_OFFSET
308+
#define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page + GDT_ESPFIX_OFFSET)
309309

310310
ALTERNATIVE "jmp .Lend_\@", "", X86_BUG_ESPFIX
311311

arch/x86/entry/entry_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ SYM_FUNC_START(__switch_to_asm)
252252

253253
#ifdef CONFIG_STACKPROTECTOR
254254
movq TASK_stack_canary(%rsi), %rbx
255-
movq %rbx, PER_CPU_VAR(fixed_percpu_data) + FIXED_stack_canary
255+
movq %rbx, PER_CPU_VAR(fixed_percpu_data + FIXED_stack_canary)
256256
#endif
257257

258258
/*

arch/x86/kernel/head_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ SYM_CODE_START(soft_restart_cpu)
449449
UNWIND_HINT_END_OF_STACK
450450

451451
/* Find the idle task stack */
452-
movq PER_CPU_VAR(pcpu_hot) + X86_current_task, %rcx
452+
movq PER_CPU_VAR(pcpu_hot + X86_current_task), %rcx
453453
movq TASK_threadsp(%rcx), %rsp
454454

455455
jmp .Ljump_to_C_code

0 commit comments

Comments
 (0)