diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-03-24 14:44:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-24 15:57:31 -0400 |
commit | dca5b52ad76b10c3adc29e2a006d4b1721c44a8d (patch) | |
tree | b79f6b022a0a69d60db1cd001b8284c1eb74bce0 | |
parent | f9d71854b4fe9b22ca199c4676da5a6ece1e5c17 (diff) |
x86/asm/entry/64: Rename THREAD_INFO() to ASM_THREAD_INFO()
The THREAD_INFO() macro has a somewhat confusingly generic name,
defined in a generic .h C header file. It also does not make it
clear that it constructs a memory operand for use in assembly
code.
Rename it to ASM_THREAD_INFO() to make it all glaringly
obvious on first glance.
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/20150324184442.GC14760@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/ia32/ia32entry.S | 30 | ||||
-rw-r--r-- | arch/x86/include/asm/thread_info.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/entry_64.S | 4 |
3 files changed, 19 insertions, 19 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 32e94aec6073..5d2641ce9957 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -127,7 +127,7 @@ ENTRY(ia32_sysenter_target) | |||
127 | CFI_REL_OFFSET rsp,0 | 127 | CFI_REL_OFFSET rsp,0 |
128 | pushfq_cfi | 128 | pushfq_cfi |
129 | /*CFI_REL_OFFSET rflags,0*/ | 129 | /*CFI_REL_OFFSET rflags,0*/ |
130 | movl THREAD_INFO(TI_sysenter_return, %rsp, 3*8), %r10d | 130 | movl ASM_THREAD_INFO(TI_sysenter_return, %rsp, 3*8), %r10d |
131 | CFI_REGISTER rip,r10 | 131 | CFI_REGISTER rip,r10 |
132 | pushq_cfi $__USER32_CS | 132 | pushq_cfi $__USER32_CS |
133 | /*CFI_REL_OFFSET cs,0*/ | 133 | /*CFI_REL_OFFSET cs,0*/ |
@@ -159,8 +159,8 @@ ENTRY(ia32_sysenter_target) | |||
159 | jnz sysenter_fix_flags | 159 | jnz sysenter_fix_flags |
160 | sysenter_flags_fixed: | 160 | sysenter_flags_fixed: |
161 | 161 | ||
162 | orl $TS_COMPAT, THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) | 162 | orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) |
163 | testl $_TIF_WORK_SYSCALL_ENTRY, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 163 | testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
164 | CFI_REMEMBER_STATE | 164 | CFI_REMEMBER_STATE |
165 | jnz sysenter_tracesys | 165 | jnz sysenter_tracesys |
166 | cmpq $(IA32_NR_syscalls-1),%rax | 166 | cmpq $(IA32_NR_syscalls-1),%rax |
@@ -177,10 +177,10 @@ sysenter_dispatch: | |||
177 | movq %rax,RAX(%rsp) | 177 | movq %rax,RAX(%rsp) |
178 | DISABLE_INTERRUPTS(CLBR_NONE) | 178 | DISABLE_INTERRUPTS(CLBR_NONE) |
179 | TRACE_IRQS_OFF | 179 | TRACE_IRQS_OFF |
180 | testl $_TIF_ALLWORK_MASK, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 180 | testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
181 | jnz sysexit_audit | 181 | jnz sysexit_audit |
182 | sysexit_from_sys_call: | 182 | sysexit_from_sys_call: |
183 | andl $~TS_COMPAT,THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) | 183 | andl $~TS_COMPAT,ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) |
184 | /* clear IF, that popfq doesn't enable interrupts early */ | 184 | /* clear IF, that popfq doesn't enable interrupts early */ |
185 | andl $~0x200,EFLAGS(%rsp) | 185 | andl $~0x200,EFLAGS(%rsp) |
186 | movl RIP(%rsp),%edx /* User %eip */ | 186 | movl RIP(%rsp),%edx /* User %eip */ |
@@ -225,7 +225,7 @@ sysexit_from_sys_call: | |||
225 | .endm | 225 | .endm |
226 | 226 | ||
227 | .macro auditsys_exit exit | 227 | .macro auditsys_exit exit |
228 | testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 228 | testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
229 | jnz ia32_ret_from_sys_call | 229 | jnz ia32_ret_from_sys_call |
230 | TRACE_IRQS_ON | 230 | TRACE_IRQS_ON |
231 | ENABLE_INTERRUPTS(CLBR_NONE) | 231 | ENABLE_INTERRUPTS(CLBR_NONE) |
@@ -240,7 +240,7 @@ sysexit_from_sys_call: | |||
240 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi | 240 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi |
241 | DISABLE_INTERRUPTS(CLBR_NONE) | 241 | DISABLE_INTERRUPTS(CLBR_NONE) |
242 | TRACE_IRQS_OFF | 242 | TRACE_IRQS_OFF |
243 | testl %edi, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 243 | testl %edi, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
244 | jz \exit | 244 | jz \exit |
245 | CLEAR_RREGS | 245 | CLEAR_RREGS |
246 | jmp int_with_check | 246 | jmp int_with_check |
@@ -262,7 +262,7 @@ sysenter_fix_flags: | |||
262 | 262 | ||
263 | sysenter_tracesys: | 263 | sysenter_tracesys: |
264 | #ifdef CONFIG_AUDITSYSCALL | 264 | #ifdef CONFIG_AUDITSYSCALL |
265 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 265 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
266 | jz sysenter_auditsys | 266 | jz sysenter_auditsys |
267 | #endif | 267 | #endif |
268 | SAVE_EXTRA_REGS | 268 | SAVE_EXTRA_REGS |
@@ -346,8 +346,8 @@ ENTRY(ia32_cstar_target) | |||
346 | 1: movl (%r8),%r9d | 346 | 1: movl (%r8),%r9d |
347 | _ASM_EXTABLE(1b,ia32_badarg) | 347 | _ASM_EXTABLE(1b,ia32_badarg) |
348 | ASM_CLAC | 348 | ASM_CLAC |
349 | orl $TS_COMPAT, THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) | 349 | orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) |
350 | testl $_TIF_WORK_SYSCALL_ENTRY, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 350 | testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
351 | CFI_REMEMBER_STATE | 351 | CFI_REMEMBER_STATE |
352 | jnz cstar_tracesys | 352 | jnz cstar_tracesys |
353 | cmpq $IA32_NR_syscalls-1,%rax | 353 | cmpq $IA32_NR_syscalls-1,%rax |
@@ -364,10 +364,10 @@ cstar_dispatch: | |||
364 | movq %rax,RAX(%rsp) | 364 | movq %rax,RAX(%rsp) |
365 | DISABLE_INTERRUPTS(CLBR_NONE) | 365 | DISABLE_INTERRUPTS(CLBR_NONE) |
366 | TRACE_IRQS_OFF | 366 | TRACE_IRQS_OFF |
367 | testl $_TIF_ALLWORK_MASK, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 367 | testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
368 | jnz sysretl_audit | 368 | jnz sysretl_audit |
369 | sysretl_from_sys_call: | 369 | sysretl_from_sys_call: |
370 | andl $~TS_COMPAT, THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) | 370 | andl $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) |
371 | RESTORE_RSI_RDI_RDX | 371 | RESTORE_RSI_RDI_RDX |
372 | movl RIP(%rsp),%ecx | 372 | movl RIP(%rsp),%ecx |
373 | CFI_REGISTER rip,rcx | 373 | CFI_REGISTER rip,rcx |
@@ -402,7 +402,7 @@ sysretl_audit: | |||
402 | 402 | ||
403 | cstar_tracesys: | 403 | cstar_tracesys: |
404 | #ifdef CONFIG_AUDITSYSCALL | 404 | #ifdef CONFIG_AUDITSYSCALL |
405 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 405 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
406 | jz cstar_auditsys | 406 | jz cstar_auditsys |
407 | #endif | 407 | #endif |
408 | xchgl %r9d,%ebp | 408 | xchgl %r9d,%ebp |
@@ -469,8 +469,8 @@ ENTRY(ia32_syscall) | |||
469 | this could be a problem. */ | 469 | this could be a problem. */ |
470 | ALLOC_PT_GPREGS_ON_STACK | 470 | ALLOC_PT_GPREGS_ON_STACK |
471 | SAVE_C_REGS_EXCEPT_R891011 | 471 | SAVE_C_REGS_EXCEPT_R891011 |
472 | orl $TS_COMPAT, THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) | 472 | orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) |
473 | testl $_TIF_WORK_SYSCALL_ENTRY, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 473 | testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
474 | jnz ia32_tracesys | 474 | jnz ia32_tracesys |
475 | cmpq $(IA32_NR_syscalls-1),%rax | 475 | cmpq $(IA32_NR_syscalls-1),%rax |
476 | ja ia32_badsys | 476 | ja ia32_badsys |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 224285b674ca..ea2dbe82cba3 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -222,7 +222,7 @@ static inline unsigned long current_stack_pointer(void) | |||
222 | * currently at exactly SIZEOF_PTREGS bytes away from the top of the | 222 | * currently at exactly SIZEOF_PTREGS bytes away from the top of the |
223 | * stack: | 223 | * stack: |
224 | * | 224 | * |
225 | * mov THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS), %eax | 225 | * mov ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS), %eax |
226 | * | 226 | * |
227 | * will translate to: | 227 | * will translate to: |
228 | * | 228 | * |
@@ -230,7 +230,7 @@ static inline unsigned long current_stack_pointer(void) | |||
230 | * | 230 | * |
231 | * which is below the current RSP by almost 16K. | 231 | * which is below the current RSP by almost 16K. |
232 | */ | 232 | */ |
233 | #define THREAD_INFO(field, reg, off) ((field)+(off)-THREAD_SIZE)(reg) | 233 | #define ASM_THREAD_INFO(field, reg, off) ((field)+(off)-THREAD_SIZE)(reg) |
234 | 234 | ||
235 | #endif | 235 | #endif |
236 | 236 | ||
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 8f01a4f1cf9e..daf5d94c0e78 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -249,7 +249,7 @@ GLOBAL(system_call_after_swapgs) | |||
249 | pushq_cfi_reg r11 /* pt_regs->r11 */ | 249 | pushq_cfi_reg r11 /* pt_regs->r11 */ |
250 | sub $(6*8),%rsp /* pt_regs->bp,bx,r12-15 not saved */ | 250 | sub $(6*8),%rsp /* pt_regs->bp,bx,r12-15 not saved */ |
251 | 251 | ||
252 | testl $_TIF_WORK_SYSCALL_ENTRY, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 252 | testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
253 | jnz tracesys | 253 | jnz tracesys |
254 | system_call_fastpath: | 254 | system_call_fastpath: |
255 | #if __SYSCALL_MASK == ~0 | 255 | #if __SYSCALL_MASK == ~0 |
@@ -267,7 +267,7 @@ system_call_fastpath: | |||
267 | * Has incompletely filled pt_regs, iret frame is also incomplete. | 267 | * Has incompletely filled pt_regs, iret frame is also incomplete. |
268 | */ | 268 | */ |
269 | ret_from_sys_call: | 269 | ret_from_sys_call: |
270 | testl $_TIF_ALLWORK_MASK, THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) | 270 | testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) |
271 | jnz int_ret_from_sys_call /* Go the slow path */ | 271 | jnz int_ret_from_sys_call /* Go the slow path */ |
272 | 272 | ||
273 | LOCKDEP_SYS_EXIT | 273 | LOCKDEP_SYS_EXIT |