diff options
| -rw-r--r-- | arch/x86/entry/entry_32.S | 5 | ||||
| -rw-r--r-- | arch/x86/entry/entry_64.S | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index ace8f321a5a1..a1f28a54f23a 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <asm/asm.h> | 44 | #include <asm/asm.h> |
| 45 | #include <asm/smap.h> | 45 | #include <asm/smap.h> |
| 46 | #include <asm/frame.h> | 46 | #include <asm/frame.h> |
| 47 | #include <asm/nospec-branch.h> | ||
| 47 | 48 | ||
| 48 | .section .entry.text, "ax" | 49 | .section .entry.text, "ax" |
| 49 | 50 | ||
| @@ -290,7 +291,7 @@ ENTRY(ret_from_fork) | |||
| 290 | 291 | ||
| 291 | /* kernel thread */ | 292 | /* kernel thread */ |
| 292 | 1: movl %edi, %eax | 293 | 1: movl %edi, %eax |
| 293 | call *%ebx | 294 | CALL_NOSPEC %ebx |
| 294 | /* | 295 | /* |
| 295 | * A kernel thread is allowed to return here after successfully | 296 | * A kernel thread is allowed to return here after successfully |
| 296 | * calling do_execve(). Exit to userspace to complete the execve() | 297 | * calling do_execve(). Exit to userspace to complete the execve() |
| @@ -919,7 +920,7 @@ common_exception: | |||
| 919 | movl %ecx, %es | 920 | movl %ecx, %es |
| 920 | TRACE_IRQS_OFF | 921 | TRACE_IRQS_OFF |
| 921 | movl %esp, %eax # pt_regs pointer | 922 | movl %esp, %eax # pt_regs pointer |
| 922 | call *%edi | 923 | CALL_NOSPEC %edi |
| 923 | jmp ret_from_exception | 924 | jmp ret_from_exception |
| 924 | END(common_exception) | 925 | END(common_exception) |
| 925 | 926 | ||
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index ed31d00dc5ee..59874bc1aed2 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <asm/pgtable_types.h> | 37 | #include <asm/pgtable_types.h> |
| 38 | #include <asm/export.h> | 38 | #include <asm/export.h> |
| 39 | #include <asm/frame.h> | 39 | #include <asm/frame.h> |
| 40 | #include <asm/nospec-branch.h> | ||
| 40 | #include <linux/err.h> | 41 | #include <linux/err.h> |
| 41 | 42 | ||
| 42 | #include "calling.h" | 43 | #include "calling.h" |
| @@ -187,7 +188,7 @@ ENTRY(entry_SYSCALL_64_trampoline) | |||
| 187 | */ | 188 | */ |
| 188 | pushq %rdi | 189 | pushq %rdi |
| 189 | movq $entry_SYSCALL_64_stage2, %rdi | 190 | movq $entry_SYSCALL_64_stage2, %rdi |
| 190 | jmp *%rdi | 191 | JMP_NOSPEC %rdi |
| 191 | END(entry_SYSCALL_64_trampoline) | 192 | END(entry_SYSCALL_64_trampoline) |
| 192 | 193 | ||
| 193 | .popsection | 194 | .popsection |
| @@ -266,7 +267,12 @@ entry_SYSCALL_64_fastpath: | |||
| 266 | * It might end up jumping to the slow path. If it jumps, RAX | 267 | * It might end up jumping to the slow path. If it jumps, RAX |
| 267 | * and all argument registers are clobbered. | 268 | * and all argument registers are clobbered. |
| 268 | */ | 269 | */ |
| 270 | #ifdef CONFIG_RETPOLINE | ||
| 271 | movq sys_call_table(, %rax, 8), %rax | ||
| 272 | call __x86_indirect_thunk_rax | ||
| 273 | #else | ||
| 269 | call *sys_call_table(, %rax, 8) | 274 | call *sys_call_table(, %rax, 8) |
| 275 | #endif | ||
| 270 | .Lentry_SYSCALL_64_after_fastpath_call: | 276 | .Lentry_SYSCALL_64_after_fastpath_call: |
| 271 | 277 | ||
| 272 | movq %rax, RAX(%rsp) | 278 | movq %rax, RAX(%rsp) |
| @@ -438,7 +444,7 @@ ENTRY(stub_ptregs_64) | |||
| 438 | jmp entry_SYSCALL64_slow_path | 444 | jmp entry_SYSCALL64_slow_path |
| 439 | 445 | ||
| 440 | 1: | 446 | 1: |
| 441 | jmp *%rax /* Called from C */ | 447 | JMP_NOSPEC %rax /* Called from C */ |
| 442 | END(stub_ptregs_64) | 448 | END(stub_ptregs_64) |
| 443 | 449 | ||
| 444 | .macro ptregs_stub func | 450 | .macro ptregs_stub func |
| @@ -517,7 +523,7 @@ ENTRY(ret_from_fork) | |||
| 517 | 1: | 523 | 1: |
| 518 | /* kernel thread */ | 524 | /* kernel thread */ |
| 519 | movq %r12, %rdi | 525 | movq %r12, %rdi |
| 520 | call *%rbx | 526 | CALL_NOSPEC %rbx |
| 521 | /* | 527 | /* |
| 522 | * A kernel thread is allowed to return here after successfully | 528 | * A kernel thread is allowed to return here after successfully |
| 523 | * calling do_execve(). Exit to userspace to complete the execve() | 529 | * calling do_execve(). Exit to userspace to complete the execve() |
