Borislav Petkov
cfb52a5a09
x86/microcode: Request microcode on the BSP
...
... so that any newer version can land in the cache and can later be
fished out by the application functions. Do that before grabbing the
hotplug lock.
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Tom Lendacky <thomas.lendacky@amd.com >
Tested-by: Ashok Raj <ashok.raj@intel.com >
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Link: https://lkml.kernel.org/r/20180228102846.13447-7-bp@alien8.de
2018-03-08 10:19:26 +01:00
Borislav Petkov
d8c3b52c00
x86/microcode/intel: Look into the patch cache first
...
The cache might contain a newer patch - look in there first.
A follow-on change will make sure newest patches are loaded into the
cache of microcode patches.
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Tom Lendacky <thomas.lendacky@amd.com >
Tested-by: Ashok Raj <ashok.raj@intel.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Link: https://lkml.kernel.org/r/20180228102846.13447-6-bp@alien8.de
2018-03-08 10:19:26 +01:00
Ashok Raj
30ec26da99
x86/microcode: Do not upload microcode if CPUs are offline
...
Avoid loading microcode if any of the CPUs are offline, and issue a
warning. Having different microcode revisions on the system at any time
is outright dangerous.
[ Borislav: Massage changelog. ]
Signed-off-by: Ashok Raj <ashok.raj@intel.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Tom Lendacky <thomas.lendacky@amd.com >
Tested-by: Ashok Raj <ashok.raj@intel.com >
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Link: http://lkml.kernel.org/r/1519352533-15992-4-git-send-email-ashok.raj@intel.com
Link: https://lkml.kernel.org/r/20180228102846.13447-5-bp@alien8.de
2018-03-08 10:19:26 +01:00
Ashok Raj
91df9fdf51
x86/microcode/intel: Writeback and invalidate caches before updating microcode
...
Updating microcode is less error prone when caches have been flushed and
depending on what exactly the microcode is updating. For example, some
of the issues around certain Broadwell parts can be addressed by doing a
full cache flush.
[ Borislav: Massage it and use native_wbinvd() in both cases. ]
Signed-off-by: Ashok Raj <ashok.raj@intel.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Tom Lendacky <thomas.lendacky@amd.com >
Tested-by: Ashok Raj <ashok.raj@intel.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Link: http://lkml.kernel.org/r/1519352533-15992-3-git-send-email-ashok.raj@intel.com
Link: https://lkml.kernel.org/r/20180228102846.13447-4-bp@alien8.de
2018-03-08 10:19:25 +01:00
Ashok Raj
c182d2b7d0
x86/microcode/intel: Check microcode revision before updating sibling threads
...
After updating microcode on one of the threads of a core, the other
thread sibling automatically gets the update since the microcode
resources on a hyperthreaded core are shared between the two threads.
Check the microcode revision on the CPU before performing a microcode
update and thus save us the WRMSR 0x79 because it is a particularly
expensive operation.
[ Borislav: Massage changelog and coding style. ]
Signed-off-by: Ashok Raj <ashok.raj@intel.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Tom Lendacky <thomas.lendacky@amd.com >
Tested-by: Ashok Raj <ashok.raj@intel.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Link: http://lkml.kernel.org/r/1519352533-15992-2-git-send-email-ashok.raj@intel.com
Link: https://lkml.kernel.org/r/20180228102846.13447-3-bp@alien8.de
2018-03-08 10:19:25 +01:00
Borislav Petkov
854857f594
x86/microcode: Get rid of struct apply_microcode_ctx
...
It is a useless remnant from earlier times. Use the ucode_state enum
directly.
No functional change.
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Tom Lendacky <thomas.lendacky@amd.com >
Tested-by: Ashok Raj <ashok.raj@intel.com >
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com >
Link: https://lkml.kernel.org/r/20180228102846.13447-2-bp@alien8.de
2018-03-08 10:19:25 +01:00
Konrad Rzeszutek Wilk
36268223c1
x86/spectre_v2: Don't check microcode versions when running under hypervisors
...
As:
1) It's known that hypervisors lie about the environment anyhow (host
mismatch)
2) Even if the hypervisor (Xen, KVM, VMWare, etc) provided a valid
"correct" value, it all gets to be very murky when migration happens
(do you provide the "new" microcode of the machine?).
And in reality the cloud vendors are the ones that should make sure that
the microcode that is running is correct and we should just sing lalalala
and trust them.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com >
Cc: Wanpeng Li <kernellwp@gmail.com >
Cc: kvm <kvm@vger.kernel.org >
Cc: Krčmář <rkrcmar@redhat.com >
Cc: Borislav Petkov <bp@alien8.de >
CC: "H. Peter Anvin" <hpa@zytor.com >
CC: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180226213019.GE9497@char.us.oracle.com
2018-03-08 10:13:02 +01:00
Andy Lutomirski
076ca272a1
x86/vsyscall/64: Drop "native" vsyscalls
...
Since Linux v3.2, vsyscalls have been deprecated and slow. From v3.2
on, Linux had three vsyscall modes: "native", "emulate", and "none".
"emulate" is the default. All known user programs work correctly in
emulate mode, but vsyscalls turn into page faults and are emulated.
This is very slow. In "native" mode, the vsyscall page is easily
usable as an exploit gadget, but vsyscalls are a bit faster -- they
turn into normal syscalls. (This is in contrast to vDSO functions,
which can be much faster than syscalls.) In "none" mode, there are
no vsyscalls.
For all practical purposes, "native" was really just a chicken bit
in case something went wrong with the emulation. It's been over six
years, and nothing has gone wrong. Delete it.
Signed-off-by: Andy Lutomirski <luto@kernel.org >
Acked-by: Kees Cook <keescook@chromium.org >
Acked-by: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dominik Brodowski <linux@dominikbrodowski.net >
Cc: Kernel Hardening <kernel-hardening@lists.openwall.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/519fee5268faea09ae550776ce969fa6e88668b0.1520449896.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-08 06:48:15 +01:00
Dominik Brodowski
91c5f0de64
x86/entry/64/compat: Save one instruction in entry_INT80_compat()
...
As %rdi is never user except in the following push, there is no
need to restore %rdi to the original value.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Linus Torvalds <torvalds@linux-foundation.org >
Acked-by: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: luto@amacapital.net
Cc: viro@zeniv.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-07 07:57:31 +01:00
Dominik Brodowski
af52201d99
x86/entry: Do not special-case clone(2) in compat entry
...
With the CPU renaming registers on its own, and all the overhead of the
syscall entry/exit, it is doubtful whether the compiled output of
mov %r8, %rax
mov %rcx, %r8
mov %rax, %rcx
jmpq sys_clone
is measurably slower than the hand-crafted version of
xchg %r8, %rcx
So get rid of this special case.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Linus Torvalds <torvalds@linux-foundation.org >
Acked-by: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: luto@amacapital.net
Cc: viro@zeniv.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-07 07:57:31 +01:00
Dominik Brodowski
4ddb45db30
x86/syscalls: Use COMPAT_SYSCALL_DEFINEx() macros for x86-only compat syscalls
...
While at it, convert declarations of type "unsigned" to "unsigned int".
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Linus Torvalds <torvalds@linux-foundation.org >
Acked-by: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: luto@amacapital.net
Cc: viro@zeniv.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-07 07:57:30 +01:00
Dominik Brodowski
7c2178c1ff
x86/syscalls: Use proper syscall definition for sys_ioperm()
...
Using SYSCALL_DEFINEx() is recommended, so use it also here.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Linus Torvalds <torvalds@linux-foundation.org >
Acked-by: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: luto@amacapital.net
Cc: viro@zeniv.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-07 07:57:30 +01:00
Dominik Brodowski
a41e2ab08e
x86/entry: Remove stale syscall prototype
...
sys32_vm86_warning() is long gone.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Linus Torvalds <torvalds@linux-foundation.org >
Acked-by: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: luto@amacapital.net
Cc: viro@zeniv.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-07 07:57:30 +01:00
Dominik Brodowski
b411991e0c
x86/syscalls/32: Simplify $entry == $compat entries
...
If the compat entry point is equivalent to the native entry point, it
does not need to be specified explicitly.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Linus Torvalds <torvalds@linux-foundation.org >
Acked-by: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: luto@amacapital.net
Cc: viro@zeniv.linux.org.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-07 07:57:29 +01:00
Josh Poimboeuf
63474dc4ac
objtool: Fix 32-bit build
...
Fix the objtool build when cross-compiling a 64-bit kernel on a 32-bit
host. This also simplifies read_retpoline_hints() a bit and makes its
implementation similar to most of the other annotation reading
functions.
Reported-by: Sven Joachim <svenjoac@gmx.de >
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Fixes: b5bc2231b8 ("objtool: Add retpoline validation")
Link: http://lkml.kernel.org/r/2ca46c636c23aa9c9d57d53c75de4ee3ddf7a7df.1520380691.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-03-07 07:50:38 +01:00
Thomas Gleixner
945fd17ab6
x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table
...
The separation of the cpu_entry_area from the fixmap missed the fact that
on 32bit non-PAE kernels the cpu_entry_area mapping might not be covered in
initial_page_table by the previous synchronizations.
This results in suspend/resume failures because 32bit utilizes initial page
table for resume. The absence of the cpu_entry_area mapping results in a
triple fault, aka. insta reboot.
With PAE enabled this works by chance because the PGD entry which covers
the fixmap and other parts incindentally provides the cpu_entry_area
mapping as well.
Synchronize the initial page table after setting up the cpu entry
area. Instead of adding yet another copy of the same code, move it to a
function and invoke it from the various places.
It needs to be investigated if the existing calls in setup_arch() and
setup_per_cpu_areas() can be replaced by the later invocation from
setup_cpu_entry_areas(), but that's beyond the scope of this fix.
Fixes: 92a0f81d89 ("x86/cpu_entry_area: Move it out of the fixmap")
Reported-by: Woody Suwalski <terraluna977@gmail.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Woody Suwalski <terraluna977@gmail.com >
Cc: William Grant <william.grant@canonical.com >
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1802282137290.1392@nanos.tec.linutronix.de
2018-03-01 09:48:27 +01:00
Josh Poimboeuf
1402fd8ed7
objtool: Fix another switch table detection issue
...
Continue the switch table detection whack-a-mole. Add a check to
distinguish KASAN data reads from switch data reads. The switch jump
tables in .rodata have relocations associated with them.
This fixes the following warning:
crypto/asymmetric_keys/x509_cert_parser.o: warning: objtool: x509_note_pkey_algo()+0xa4: sibling call from callable instruction with modified stack frame
Reported-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Arnd Bergmann <arnd@arndb.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lkml.kernel.org/r/d7c8853022ad47d158cb81e953a40469fc08a95e.1519784382.git.jpoimboe@redhat.com
2018-02-28 16:03:19 +01:00
Juergen Gross
71c208dd54
x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend
...
Older Xen versions (4.5 and before) might have problems migrating pv
guests with MSR_IA32_SPEC_CTRL having a non-zero value. So before
suspending zero that MSR and restore it after being resumed.
Signed-off-by: Juergen Gross <jgross@suse.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Jan Beulich <jbeulich@suse.com >
Cc: stable@vger.kernel.org
Cc: xen-devel@lists.xenproject.org
Cc: boris.ostrovsky@oracle.com
Link: https://lkml.kernel.org/r/20180226140818.4849-1-jgross@suse.com
2018-02-28 16:03:19 +01:00
Paolo Bonzini
946fbbc13d
KVM/VMX: Optimize vmx_vcpu_run() and svm_vcpu_run() by marking the RDMSR path as unlikely()
...
vmx_vcpu_run() and svm_vcpu_run() are large functions, and giving
branch hints to the compiler can actually make a substantial cycle
difference by keeping the fast path contiguous in memory.
With this optimization, the retpoline-guest/retpoline-host case is
about 50 cycles faster.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Reviewed-by: Jim Mattson <jmattson@google.com >
Cc: David Woodhouse <dwmw@amazon.co.uk >
Cc: KarimAllah Ahmed <karahmed@amazon.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: kvm@vger.kernel.org
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20180222154318.20361-3-pbonzini@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-23 08:24:36 +01:00
Paolo Bonzini
ecb586bd29
KVM/x86: Remove indirect MSR op calls from SPEC_CTRL
...
Having a paravirt indirect call in the IBRS restore path is not a
good idea, since we are trying to protect from speculative execution
of bogus indirect branch targets. It is also slower, so use
native_wrmsrl() on the vmentry path too.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Reviewed-by: Jim Mattson <jmattson@google.com >
Cc: David Woodhouse <dwmw@amazon.co.uk >
Cc: KarimAllah Ahmed <karahmed@amazon.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: kvm@vger.kernel.org
Cc: stable@vger.kernel.org
Fixes: d28b387fb7
Link: http://lkml.kernel.org/r/20180222154318.20361-2-pbonzini@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-23 08:24:35 +01:00
Peter Zijlstra
d5028ba8ee
objtool, retpolines: Integrate objtool with retpoline support more closely
...
Disable retpoline validation in objtool if your compiler sucks, and otherwise
select the validation stuff for CONFIG_RETPOLINE=y (most builds would already
have it set due to ORC).
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:32 +01:00
Josh Poimboeuf
0ca7d5baa1
x86/entry/64: Simplify ENCODE_FRAME_POINTER
...
On 64-bit, the stack pointer is always aligned on interrupt, so instead
of setting the LSB of the pt_regs address, we can just add 1 to it.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andrew Lutomirski <luto@kernel.org >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dominik Brodowski <linux@dominikbrodowski.net >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/20180221024214.lhl5jfgw33c4vz3m@treble
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:07 +01:00
Josh Poimboeuf
9fbcc57aa1
extable: Make init_kernel_text() global
...
Convert init_kernel_text() to a global function and use it in a few
places instead of manually comparing _sinittext and _einittext.
Note that kallsyms.h has a very similar function called
is_kernel_inittext(), but its end check is inclusive. I'm not sure
whether that's intentional behavior, so I didn't touch it.
Suggested-by: Jason Baron <jbaron@akamai.com >
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/4335d02be8d45ca7d265d2f174251d0b7ee6c5fd.1519051220.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:06 +01:00
Josh Poimboeuf
dc1dd184c2
jump_label: Warn on failed jump_label patching attempt
...
Currently when the jump label code encounters an address which isn't
recognized by kernel_text_address(), it just silently fails.
This can be dangerous because jump labels are used in a variety of
places, and are generally expected to work. Convert the silent failure
to a warning.
This won't warn about attempted writes to tracepoints in __init code
after initmem has been freed, as those are already guarded by the
entry->code check.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/de3a271c93807adb7ed48f4e946b4f9156617680.1519051220.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:06 +01:00
Josh Poimboeuf
3335224470
jump_label: Explicitly disable jump labels in __init code
...
After initmem has been freed, any jump labels in __init code are
prevented from being written to by the kernel_text_address() check in
__jump_label_update(). However, this check is quite broad. If
kernel_text_address() were to return false for any other reason, the
jump label write would fail silently with no warning.
For jump labels in module init code, entry->code is set to zero to
indicate that the entry is disabled. Do the same thing for core kernel
init code. This makes the behavior more consistent, and will also make
it more straightforward to detect non-init jump label write failures in
the next patch.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Acked-by: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/c52825c73f3a174e8398b6898284ec20d4deb126.1519051220.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:05 +01:00
Dominik Brodowski
f3d415ea46
x86/entry/64: Open-code switch_to_thread_stack()
...
Open-code the two instances which called switch_to_thread_stack(). This
allows us to remove the wrapper around DO_SWITCH_TO_THREAD_STACK.
While at it, update the UNWIND hint to reflect where the IRET frame is,
and update the commentary to reflect what we are actually doing here.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: dan.j.williams@intel.com
Link: http://lkml.kernel.org/r/20180220210113.6725-7-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:05 +01:00
Dominik Brodowski
b2855d8d2d
x86/entry/64: Move ASM_CLAC to interrupt_entry()
...
Moving ASM_CLAC to interrupt_entry means two instructions (addq / pushq
and call interrupt_entry) are not covered by it. However, it offers a
noticeable size reduction (-.2k):
text data bss dec hex filename
16882 0 0 16882 41f2 entry_64.o-orig
16623 0 0 16623 40ef entry_64.o
Suggested-by: Brian Gerst <brgerst@gmail.com >
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: dan.j.williams@intel.com
Link: http://lkml.kernel.org/r/20180220210113.6725-6-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:05 +01:00
Dominik Brodowski
3aa99fc3e7
x86/entry/64: Remove 'interrupt' macro
...
It is now trivial to call interrupt_entry() and then the actual worker.
Therefore, remove the interrupt macro and open code it all.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: dan.j.williams@intel.com
Link: http://lkml.kernel.org/r/20180220210113.6725-5-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:04 +01:00
Dominik Brodowski
90a6acc4e7
x86/entry/64: Move the switch_to_thread_stack() call to interrupt_entry()
...
We can also move the CLD, SWAPGS, and the switch_to_thread_stack() call
to the interrupt_entry() helper function. As we do not want call depths
of two, convert switch_to_thread_stack() to a macro.
However, switch_to_thread_stack() has another user in entry_64_compat.S,
which currently expects it to be a function. To keep the code changes
in this patch minimal, create a wrapper function.
The switch to a macro means that there is some binary code duplication
if CONFIG_IA32_EMULATION=y is enabled. Therefore, the size reduction
differs whether CONFIG_IA32_EMULATION is enabled or not:
CONFIG_IA32_EMULATION=y (-0.13k):
text data bss dec hex filename
17158 0 0 17158 4306 entry_64.o-orig
17028 0 0 17028 4284 entry_64.o
CONFIG_IA32_EMULATION=n (-0.27k):
text data bss dec hex filename
17158 0 0 17158 4306 entry_64.o-orig
16882 0 0 16882 41f2 entry_64.o
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: dan.j.williams@intel.com
Link: http://lkml.kernel.org/r/20180220210113.6725-4-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:04 +01:00
Dominik Brodowski
2ba6474104
x86/entry/64: Move ENTER_IRQ_STACK from interrupt macro to interrupt_entry
...
Moving the switch to IRQ stack from the interrupt macro to the helper
function requires some trickery: All ENTER_IRQ_STACK really cares about
is where the "original" stack -- meaning the GP registers etc. -- is
stored. Therefore, we need to offset the stored RSP value by 8 whenever
ENTER_IRQ_STACK is called from within a function. In such cases, and
after switching to the IRQ stack, we need to push the "original" return
address (i.e. the return address from the call to the interrupt entry
function) to the IRQ stack.
This trickery allows us to carve another .85k from the text size (it
would be more except for the additional unwind hints):
text data bss dec hex filename
18006 0 0 18006 4656 entry_64.o-orig
17158 0 0 17158 4306 entry_64.o
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: dan.j.williams@intel.com
Link: http://lkml.kernel.org/r/20180220210113.6725-3-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:03 +01:00
Dominik Brodowski
0e34d22634
x86/entry/64: Move PUSH_AND_CLEAR_REGS from interrupt macro to helper function
...
The PUSH_AND_CLEAR_REGS macro is able to insert the GP registers
"above" the original return address. This allows us to move a sizeable
part of the interrupt entry macro to an interrupt entry helper function:
text data bss dec hex filename
21088 0 0 21088 5260 entry_64.o-orig
18006 0 0 18006 4656 entry_64.o
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: dan.j.williams@intel.com
Link: http://lkml.kernel.org/r/20180220210113.6725-2-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:03 +01:00
Ingo Molnar
d72f4e29e6
x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP
...
firmware_restrict_branch_speculation_*() recently started using
preempt_enable()/disable(), but those are relatively high level
primitives and cause build failures on some 32-bit builds.
Since we want to keep <asm/nospec-branch.h> low level, convert
them to macros to avoid header hell...
Cc: David Woodhouse <dwmw@amazon.co.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: arjan.van.de.ven@intel.com
Cc: bp@alien8.de
Cc: dave.hansen@intel.com
Cc: jmattson@google.com
Cc: karahmed@amazon.de
Cc: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Cc: rkrcmar@redhat.com
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 16:54:03 +01:00
Peter Zijlstra
ca41b97ed9
objtool: Add module specific retpoline rules
...
David allowed retpolines in .init.text, except for modules, which will
trip up objtool retpoline validation, fix that.
Requested-by: David Woodhouse <dwmw2@infradead.org >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 09:05:05 +01:00
Peter Zijlstra
b5bc2231b8
objtool: Add retpoline validation
...
David requested a objtool validation pass for CONFIG_RETPOLINE=y enabled
builds, where it validates no unannotated indirect jumps or calls are
left.
Add an additional .discard.retpoline_safe section to allow annotating
the few indirect sites that are required and safe.
Requested-by: David Woodhouse <dwmw2@infradead.org >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 09:05:04 +01:00
Peter Zijlstra
43a4525f80
objtool: Use existing global variables for options
...
Use the existing global variables instead of passing them around and
creating duplicate global variables.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 09:05:04 +01:00
Peter Zijlstra
531bb52a86
x86/mm/sme, objtool: Annotate indirect call in sme_encrypt_execute()
...
This is boot code and thus Spectre-safe: we run this _way_ before userspace
comes along to have a chance to poison our branch predictor.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Borislav Petkov <bp@suse.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Tom Lendacky <thomas.lendacky@amd.com >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 09:05:04 +01:00
Peter Zijlstra
bd89004f63
x86/boot, objtool: Annotate indirect jump in secondary_startup_64()
...
The objtool retpoline validation found this indirect jump. Seeing how
it's on CPU bringup before we run userspace it should be safe, annotate
it.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 09:05:03 +01:00
Peter Zijlstra
3010a0663f
x86/paravirt, objtool: Annotate indirect calls
...
Paravirt emits indirect calls which get flagged by objtool retpoline
checks, annotate it away because all these indirect calls will be
patched out before we start userspace.
This patching happens through alternative_instructions() ->
apply_paravirt() -> pv_init_ops.patch() which will eventually end up
in paravirt_patch_default(). This function _will_ write direct
alternatives.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 09:05:03 +01:00
Peter Zijlstra
9e0e3c5130
x86/speculation, objtool: Annotate indirect calls/jumps for objtool
...
Annotate the indirect calls/jumps in the CALL_NOSPEC/JUMP_NOSPEC
alternatives.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-21 09:05:03 +01:00
David Woodhouse
87358710c1
x86/retpoline: Support retpoline builds with Clang
...
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
Reviewed-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: arjan.van.de.ven@intel.com
Cc: bp@alien8.de
Cc: dave.hansen@intel.com
Cc: jmattson@google.com
Cc: karahmed@amazon.de
Cc: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Cc: rkrcmar@redhat.com
Link: http://lkml.kernel.org/r/1519037457-7643-5-git-send-email-dwmw@amazon.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 11:17:58 +01:00
David Woodhouse
dd84441a79
x86/speculation: Use IBRS if available before calling into firmware
...
Retpoline means the kernel is safe because it has no indirect branches.
But firmware isn't, so use IBRS for firmware calls if it's available.
Block preemption while IBRS is set, although in practice the call sites
already had to be doing that.
Ignore hpwdt.c for now. It's taking spinlocks and calling into firmware
code, from an NMI handler. I don't want to touch that with a bargepole.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
Reviewed-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: arjan.van.de.ven@intel.com
Cc: bp@alien8.de
Cc: dave.hansen@intel.com
Cc: jmattson@google.com
Cc: karahmed@amazon.de
Cc: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Cc: rkrcmar@redhat.com
Link: http://lkml.kernel.org/r/1519037457-7643-2-git-send-email-dwmw@amazon.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:38:33 +01:00
David Woodhouse
d1c99108af
Revert "x86/retpoline: Simplify vmexit_fill_RSB()"
...
This reverts commit 1dde7415e9 . By putting
the RSB filling out of line and calling it, we waste one RSB slot for
returning from the function itself, which means one fewer actual function
call we can make if we're doing the Skylake abomination of call-depth
counting.
It also changed the number of RSB stuffings we do on vmexit from 32,
which was correct, to 16. Let's just stop with the bikeshedding; it
didn't actually *fix* anything anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: arjan.van.de.ven@intel.com
Cc: bp@alien8.de
Cc: dave.hansen@intel.com
Cc: jmattson@google.com
Cc: karahmed@amazon.de
Cc: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Cc: rkrcmar@redhat.com
Link: http://lkml.kernel.org/r/1519037457-7643-4-git-send-email-dwmw@amazon.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:38:26 +01:00
Jan Beulich
8554004a02
x86-64/realmode: Add instruction suffix
...
Omitting suffixes from instructions in AT&T mode is bad practice when
operand size cannot be determined by the assembler from register
operands, and is likely going to be warned about by upstream GAS in the
future (mine does already). Add the single missing suffix here.
Signed-off-by: Jan Beulich <jbeulich@suse.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/5A8AF5F602000078001A9230@prv-mh.provo.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:33:41 +01:00
Jan Beulich
f2f18b16c7
x86/LDT: Avoid warning in 32-bit builds with older gcc
...
BUG() doesn't always imply "no return", and hence should be followed by
a return statement even if that's obviously (to a human) unreachable.
Signed-off-by: Jan Beulich <jbeulich@suse.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/5A8AF2AA02000078001A91E9@prv-mh.provo.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:33:40 +01:00
Jan Beulich
6262b6e78c
x86/IO-APIC: Avoid warning in 32-bit builds
...
Constants wider than 32 bits should be tagged with ULL.
Signed-off-by: Jan Beulich <jbeulich@suse.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/5A8AF23F02000078001A91E5@prv-mh.provo.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:33:40 +01:00
Jan Beulich
700b7c5409
x86/asm: Improve how GEN_*_SUFFIXED_RMWcc() specify clobbers
...
Commit:
df3405245a ("x86/asm: Add suffix macro for GEN_*_RMWcc()")
... introduced "suffix" RMWcc operations, adding bogus clobber specifiers:
For one, on x86 there's no point explicitly clobbering "cc".
In fact, with GCC properly fixed, this results in an overlap being detected by
the compiler between outputs and clobbers.
Furthermore it seems bad practice to me to have clobber specification
and use of the clobbered register(s) disconnected - it should rather be
at the invocation place of that GEN_{UN,BIN}ARY_SUFFIXED_RMWcc() macros
that the clobber is specified which this particular invocation needs.
Drop the "cc" clobber altogether and move the "cx" one to refcount.h.
Signed-off-by: Jan Beulich <jbeulich@suse.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/5A8AF1F802000078001A91E1@prv-mh.provo.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:33:39 +01:00
Jann Horn
3b3a9268bb
x86/mm: Remove stale comment about KMEMCHECK
...
This comment referred to a conditional call to kmemcheck_hide() that was
here until commit 4950276672 ("kmemcheck: remove annotations").
Now that kmemcheck has been removed, it doesn't make sense anymore.
Signed-off-by: Jann Horn <jannh@google.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20180219175039.253089-1-jannh@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:33:39 +01:00
Jan Beulich
842cef9113
x86/mm: Fix {pmd,pud}_{set,clear}_flags()
...
Just like pte_{set,clear}_flags() their PMD and PUD counterparts should
not do any address translation. This was outright wrong under Xen
(causing a dead boot with no useful output on "suitable" systems), and
produced needlessly more complicated code (even if just slightly) when
paravirt was enabled.
Signed-off-by: Jan Beulich <jbeulich@suse.com >
Reviewed-by: Juergen Gross <jgross@suse.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/5A8AF1BB02000078001A91C3@prv-mh.provo.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-20 09:33:39 +01:00
Dominik Brodowski
ced5d0bf60
x86/entry/64: Use 'xorl' for faster register clearing
...
On some x86 CPU microarchitectures using 'xorq' to clear general-purpose
registers is slower than 'xorl'. As 'xorl' is sufficient to clear all
64 bits of these registers due to zero-extension [*], switch the x86
64-bit entry code to use 'xorl'.
No change in functionality and no change in code size.
[*] According to Intel 64 and IA-32 Architecture Software Developer's
Manual, section 3.4.1.1, the result of 32-bit operands are "zero-
extended to a 64-bit result in the destination general-purpose
register." The AMD64 Architecture Programmer’s Manual Volume 3,
Appendix B.1, describes the same behaviour.
Suggested-by: Denys Vlasenko <dvlasenk@redhat.com >
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/20180214175924.23065-3-linux@dominikbrodowski.net
[ Improved on the changelog a bit. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-17 11:14:33 +01:00
Dominik Brodowski
9e809d15d6
x86/entry: Reduce the code footprint of the 'idtentry' macro
...
Play a little trick in the generic PUSH_AND_CLEAR_REGS macro
to insert the GP registers "above" the original return address.
This allows us to (re-)insert the macro in error_entry() and
paranoid_entry() and to remove it from the idtentry macro. This
reduces the static footprint significantly:
text data bss dec hex filename
24307 0 0 24307 5ef3 entry_64.o-orig
20987 0 0 20987 51fb entry_64.o
Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/20180214175924.23065-2-linux@dominikbrodowski.net
[ Small tweaks to comments. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2018-02-17 11:14:33 +01:00