]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/log
mirror_ubuntu-artful-kernel.git
6 years agoUBUNTU: Start new release
Stefan Bader [Tue, 23 Jan 2018 08:13:39 +0000 (09:13 +0100)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
6 years agoUBUNTU: Ubuntu-4.13.0-31.34 Ubuntu-4.13.0-31.34
Marcelo Henrique Cerri [Fri, 19 Jan 2018 12:16:44 +0000 (10:16 -0200)]
UBUNTU: Ubuntu-4.13.0-31.34

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoUBUNTU: [Config] KERNEL_NOBP=y
Marcelo Henrique Cerri [Thu, 18 Jan 2018 16:12:55 +0000 (14:12 -0200)]
UBUNTU: [Config] KERNEL_NOBP=y

CVE-2017-5753
CVE-2017-5715

Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoUBUNTU: SAUCE: s390: print messages for gmb and nobp
Marcelo Henrique Cerri [Thu, 18 Jan 2018 16:12:54 +0000 (14:12 -0200)]
UBUNTU: SAUCE: s390: print messages for gmb and nobp

CVE-2017-5753
CVE-2017-5715

Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoUBUNTU: SAUCE: s390: improve cpu alternative handling for gmb and nobp
Martin Schwidefsky [Thu, 18 Jan 2018 16:12:53 +0000 (14:12 -0200)]
UBUNTU: SAUCE: s390: improve cpu alternative handling for gmb and nobp

CVE-2017-5753
CVE-2017-5715

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoUBUNTU: Start new release
Stefan Bader [Thu, 18 Jan 2018 14:39:39 +0000 (15:39 +0100)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
6 years agoUBUNTU: Ubuntu-4.13.0-30.33 Ubuntu-4.13.0-30.33
Marcelo Henrique Cerri [Mon, 15 Jan 2018 18:50:32 +0000 (16:50 -0200)]
UBUNTU: Ubuntu-4.13.0-30.33

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoUBUNTU: [Packaging] git-ubuntu-log -- handle multiple bugs/cves better
Andy Whitcroft [Mon, 15 Jan 2018 13:26:19 +0000 (13:26 +0000)]
UBUNTU: [Packaging] git-ubuntu-log -- handle multiple bugs/cves better

BugLink: http://bugs.launchpad.net/bugs/1743383
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoRevert "scsi: libsas: allow async aborts"
Marcelo Henrique Cerri [Mon, 15 Jan 2018 17:52:34 +0000 (15:52 -0200)]
Revert "scsi: libsas: allow async aborts"

BugLink: http://bugs.launchpad.net/bugs/1726519
This reverts commit 909657615d9b3ce709be4fd95b9a9e8c8c7c2be6.

Acked-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agokvm: vmx: Scrub hardware GPRs at VM-exit
Jim Mattson [Wed, 3 Jan 2018 22:31:38 +0000 (14:31 -0800)]
kvm: vmx: Scrub hardware GPRs at VM-exit

CVE-2017-5753
CVE-2017-5715

commit 0cb5b30698fdc8f6b4646012e3acb4ddce430788 upstream.

Guest GPR values are live in the hardware GPRs at VM-exit.  Do not
leave any guest values in hardware GPRs after the guest GPR values are
saved to the vcpu_vmx structure.

This is a partial mitigation for CVE 2017-5715 and CVE 2017-5753.
Specifically, it defeats the Project Zero PoC for CVE 2017-5715.

Suggested-by: Eric Northup <digitaleric@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Eric Northup <digitaleric@google.com>
Reviewed-by: Benjamin Serebrin <serebrin@google.com>
Reviewed-by: Andrew Honig <ahonig@google.com>
[Paolo: Add AMD bits, Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoRevert "x86/svm: Add code to clear registers on VM exit"
Andy Whitcroft [Mon, 15 Jan 2018 11:38:44 +0000 (11:38 +0000)]
Revert "x86/svm: Add code to clear registers on VM exit"

CVE-2017-5753
CVE-2017-5715

This reverts commit 95177e2c17c2cba93d431e18c7c563cc00b303e6.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
6 years agoUBUNTU: SAUCE: x86/microcode: Extend post microcode reload to support IBPB feature...
Andy Whitcroft [Mon, 15 Jan 2018 09:21:17 +0000 (09:21 +0000)]
UBUNTU: SAUCE: x86/microcode: Extend post microcode reload to support IBPB feature -- repair missmerge

CVE-2017-5753
CVE-2017-5715

Fix missmerge leading to removal of late_initcall().

Signed-off-by: Andy Whitcroft <apw@canonical.com>
6 years agoUBUNTU: Start new release
Marcelo Henrique Cerri [Mon, 15 Jan 2018 18:00:09 +0000 (16:00 -0200)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoUBUNTU: Ubuntu-4.13.0-29.32 Ubuntu-4.13.0-29.32
Kleber Sacilotto de Souza [Fri, 12 Jan 2018 11:13:58 +0000 (12:13 +0100)]
UBUNTU: Ubuntu-4.13.0-29.32

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoRevert "UBUNTU: [Config] updateconfigs to enable GENERIC_CPU_VULNERABILITIES"
Kleber Sacilotto de Souza [Fri, 12 Jan 2018 11:07:31 +0000 (12:07 +0100)]
Revert "UBUNTU: [Config] updateconfigs to enable GENERIC_CPU_VULNERABILITIES"

CVE-2017-5754

This reverts commit 569df03939310feb1763c76cb94200b0338d7682.

CONFIG_GENERIC_CPU_VULNERABILITIES is not needed anymore after reverting
the sysfs cpu vulnerabilites patches.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoRevert "sysfs/cpu: Add vulnerability folder"
Kleber Sacilotto de Souza [Fri, 12 Jan 2018 10:53:30 +0000 (11:53 +0100)]
Revert "sysfs/cpu: Add vulnerability folder"

CVE-2017-5754

This reverts commit 3aae516fba5eb821948a8ce19d8e38076d070b8f.

The vulnerability sysfs entries have been reverted, so the documentation
and sysfs directory needs to be reverted as well.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoRevert "sysfs/cpu: Fix typos in vulnerability documentation"
Kleber Sacilotto de Souza [Fri, 12 Jan 2018 10:51:08 +0000 (11:51 +0100)]
Revert "sysfs/cpu: Fix typos in vulnerability documentation"

CVE-2017-5754

This reverts commit 45e5402e8f1ae636a95247f09e2a6052fe7e1c43.

The vulnerability sysfs entries have been reverted, so the documentation
and sysfs directory needs to be reverted as well.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoRevert "x86/cpu: Implement CPU vulnerabilites sysfs functions"
Kleber Sacilotto de Souza [Fri, 12 Jan 2018 10:36:01 +0000 (11:36 +0100)]
Revert "x86/cpu: Implement CPU vulnerabilites sysfs functions"

CVE-2017-5754

This reverts commit 7e4c83e48151935197387bc98ac893c590b25b6d.

The upstream commits are not ready yet to display mitigation status for
spectre_v1 and spectre_v2, so revert this commit to avoid confusion.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: Start new release
Kleber Sacilotto de Souza [Fri, 12 Jan 2018 11:02:57 +0000 (12:02 +0100)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: Ubuntu-4.13.0-28.31 Ubuntu-4.13.0-28.31
Seth Forshee [Thu, 11 Jan 2018 23:48:34 +0000 (17:48 -0600)]
UBUNTU: Ubuntu-4.13.0-28.31

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
6 years agoUBUNTU: SAUCE: x86/kvm: Fix stuff_RSB() for 32-bit
William Grant [Thu, 11 Jan 2018 23:05:42 +0000 (17:05 -0600)]
UBUNTU: SAUCE: x86/kvm: Fix stuff_RSB() for 32-bit

CVE-2017-5753
CVE-2017-5715

Signed-off-by: William Grant <wgrant@ubuntu.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
6 years agoUBUNTU: Start new release
Seth Forshee [Thu, 11 Jan 2018 23:43:58 +0000 (17:43 -0600)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
6 years agoUBUNTU: Ubuntu-4.13.0-27.30 Ubuntu-4.13.0-27.30
Marcelo Henrique Cerri [Thu, 11 Jan 2018 20:42:34 +0000 (18:42 -0200)]
UBUNTU: Ubuntu-4.13.0-27.30

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agox86/microcode/AMD: Add support for fam17h microcode loading
Tom Lendacky [Thu, 30 Nov 2017 22:46:40 +0000 (16:46 -0600)]
x86/microcode/AMD: Add support for fam17h microcode loading

CVE-2017-5753
CVE-2017-5715

The size for the Microcode Patch Block (MPB) for an AMD family 17h
processor is 3200 bytes.  Add a #define for fam17h so that it does
not default to 2048 bytes and fail a microcode load/update.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@alien8.de>
Link: https://lkml.kernel.org/r/20171130224640.15391.40247.stgit@tlendack-t1.amdoffice.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit f4e9b7af0cd58dd039a0fb2cd67d57cea4889abf)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agoUBUNTU: [Config] updateconfigs to enable GENERIC_CPU_VULNERABILITIES
Kleber Sacilotto de Souza [Thu, 11 Jan 2018 19:14:31 +0000 (20:14 +0100)]
UBUNTU: [Config] updateconfigs to enable GENERIC_CPU_VULNERABILITIES

The new kernel config option was added by commit "sysfs/cpu: Add
vulnerability folder".

CVE-2017-5754
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: [Config] Disable CONFIG_PPC_DEBUG_RFI
Marcelo Henrique Cerri [Wed, 10 Jan 2018 20:17:08 +0000 (18:17 -0200)]
UBUNTU: [Config] Disable CONFIG_PPC_DEBUG_RFI

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Make the fallback robust against memory corruption
Michael Ellerman [Tue, 9 Jan 2018 15:43:00 +0000 (21:13 +0530)]
UBUNTU: SAUCE: rfi-flush: Make the fallback robust against memory corruption

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
The load dependency we add in the fallback flush relies on the value
we loaded from the fallback area being zero. Although that should
always be the case, bugs happen, so make the code robust against any
corruption by xor'ing it with itself.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Fix some RFI conversions in the KVM code
Michael Ellerman [Mon, 8 Jan 2018 06:39:52 +0000 (12:09 +0530)]
UBUNTU: SAUCE: rfi-flush: Fix some RFI conversions in the KVM code

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Spotted by Paul.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Fix the 32-bit KVM build
Michael Ellerman [Mon, 8 Jan 2018 06:39:45 +0000 (12:09 +0530)]
UBUNTU: SAUCE: rfi-flush: Fix the 32-bit KVM build

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Spotted by Paul.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Fallback flush add load dependency
Nicholas Piggin [Mon, 8 Jan 2018 06:39:37 +0000 (12:09 +0530)]
UBUNTU: SAUCE: rfi-flush: Fallback flush add load dependency

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Add a data dependency on loads for the fallback flush. This
reduces or eliminates instances of incomplete flushing on P8 and
P9.

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Use rfi-flush in printks
Michael Ellerman [Sun, 7 Jan 2018 13:07:03 +0000 (00:07 +1100)]
UBUNTU: SAUCE: rfi-flush: Use rfi-flush in printks

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Add no_rfi_flush and nopti comandline options
Michael Ellerman [Sun, 7 Jan 2018 12:52:42 +0000 (23:52 +1100)]
UBUNTU: SAUCE: rfi-flush: Add no_rfi_flush and nopti comandline options

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
We use the x86 'nopti' option because all the documenation on earth is
going to refer to that, and we can guess what users mean when they
specify that - they want to avoid any overhead due to Meltdown
mitigations.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Refactor the macros so the nops are defined once
Michael Ellerman [Sun, 7 Jan 2018 11:02:02 +0000 (22:02 +1100)]
UBUNTU: SAUCE: rfi-flush: Refactor the macros so the nops are defined once

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
To avoid a bug like the previous commit ever happening again, put the
nops in a single place.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Fix HRFI_TO_UNKNOWN
Michael Ellerman [Sun, 7 Jan 2018 10:52:36 +0000 (21:52 +1100)]
UBUNTU: SAUCE: rfi-flush: Fix HRFI_TO_UNKNOWN

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
We forgot to expand the number of nops in HRFI_TO_UNKNOWN when we
expanded the number of nops. The result is we actually overwrite the
rfid with a nop, which is not good. Luckily this is only used in
denorm_done, which is not hit often.

Spotted by Ram.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Fix the fallback flush to actually activate
Michael Ellerman [Sat, 6 Jan 2018 15:50:16 +0000 (21:20 +0530)]
UBUNTU: SAUCE: rfi-flush: Fix the fallback flush to actually activate

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Since we now have three nops, we need to branch further to get over
the nops to the branch to the fallback flush.

Instead of putting the branch in slot 1 and branching by 8, put it in
0 and branch all the way to keep it simple.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Put the fallback flushes in the real trampoline section
Michael Ellerman [Sat, 6 Jan 2018 15:50:07 +0000 (21:20 +0530)]
UBUNTU: SAUCE: rfi-flush: Put the fallback flushes in the real trampoline section

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Otherwise they end up somewhere random depending on what code preceeds
them, which varies depending on CONFIG options. The HRFI version at
least needs to be below __end_interrupts so that the HMI early handler
can call it.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Rework pseries logic to be more cautious
Michael Ellerman [Sat, 6 Jan 2018 15:49:57 +0000 (21:19 +0530)]
UBUNTU: SAUCE: rfi-flush: Rework pseries logic to be more cautious

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Rather than assuming a successful return from the hcall will tell us a
valid flush type, if the hcall doesn't select one of the known flush
types use the fallback.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Rework powernv logic to be more cautious
Michael Ellerman [Sat, 6 Jan 2018 15:49:45 +0000 (21:19 +0530)]
UBUNTU: SAUCE: rfi-flush: Rework powernv logic to be more cautious

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Assume we need to do the fallback flush, unless firmware tells us
explicitly not to, by having the two needs-l1d-flush properties set to
disabled.

The previous logic assumed that the existence of a "fw-features"
node with no further properties was sufficient to indicate the flush
wasn't needed.

This should make no difference in practice with current firmwares,
because the "fw-features" node has only just been introduced, so there
are no machines in the wild which have an empty "fw-features" node.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Add barriers to the fallback L1D flushing
Balbir Singh [Fri, 5 Jan 2018 17:25:48 +0000 (22:55 +0530)]
UBUNTU: SAUCE: rfi-flush: Add barriers to the fallback L1D flushing

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Add a hwsync after DCBT_STOP_ALL_STREAM_IDS to order loads/
stores prior to stopping prefetch with loads and stores
as a part of the flushing. A lwsync is needed to ensure
that after we don't mix the flushing of one congruence class
with another

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Add speculation barrier before ori 30,30,0 flush
Nicholas Piggin [Fri, 5 Jan 2018 13:50:48 +0000 (19:20 +0530)]
UBUNTU: SAUCE: rfi-flush: Add speculation barrier before ori 30,30,0 flush

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
add an ori 31,31,0 speculation barrier ahead of the ori 30,30,0 flush
type, which was found necessary to completely flush out all lines.

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Allow HV to advertise multiple flush types
Michael Ellerman [Fri, 5 Jan 2018 13:47:42 +0000 (19:17 +0530)]
UBUNTU: SAUCE: rfi-flush: Allow HV to advertise multiple flush types

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
To enable migration between machines with different flush types
enabled, allow the hypervisor to advertise more than one flush type,
and if we see that we patch both in. On any given machine only one
will be active (due to firmware configuration), but a kernel will be
able to migrate between machines with different flush instructions
enabled without modification.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Support more than one flush type at once
Michael Ellerman [Fri, 5 Jan 2018 13:47:17 +0000 (19:17 +0530)]
UBUNTU: SAUCE: rfi-flush: Support more than one flush type at once

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Expand the RFI section to two nop slots
Michael Ellerman [Fri, 5 Jan 2018 13:46:58 +0000 (19:16 +0530)]
UBUNTU: SAUCE: rfi-flush: Expand the RFI section to two nop slots

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Push the instruction selection down to the patching routine
Michael Ellerman [Fri, 5 Jan 2018 13:43:57 +0000 (19:13 +0530)]
UBUNTU: SAUCE: rfi-flush: Push the instruction selection down to the patching routine

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Make l1d_flush_type bit flags
Michael Ellerman [Fri, 5 Jan 2018 13:21:41 +0000 (18:51 +0530)]
UBUNTU: SAUCE: rfi-flush: Make l1d_flush_type bit flags

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
So we can select more than one.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Implement congruence-first fallback flush
Nicholas Piggin [Fri, 5 Jan 2018 12:28:06 +0000 (17:58 +0530)]
UBUNTU: SAUCE: rfi-flush: Implement congruence-first fallback flush

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
This patch chnages the fallback flush to load all ways of a set,
then move to the next set. This is the best way to flush the cache,
accoring to HW people.

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: KVM: Revert the implementation of H_GET_CPU_CHARACTERISTICS
Michael Ellerman [Fri, 5 Jan 2018 12:27:24 +0000 (17:57 +0530)]
UBUNTU: SAUCE: KVM: Revert the implementation of H_GET_CPU_CHARACTERISTICS

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
After discussions this needs to be in Qemu, to deal with migration and
other complications.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: kvmppc_skip_(H)interrupt returns to host kernel
Michael Ellerman [Fri, 5 Jan 2018 12:26:52 +0000 (17:56 +0530)]
UBUNTU: SAUCE: rfi-flush: kvmppc_skip_(H)interrupt returns to host kernel

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Add HRFI_TO_UNKNOWN and use it in denorm
Michael Ellerman [Fri, 5 Jan 2018 12:25:53 +0000 (17:55 +0530)]
UBUNTU: SAUCE: rfi-flush: Add HRFI_TO_UNKNOWN and use it in denorm

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: rfi-flush: Make DEBUG_RFI a CONFIG option
Michael Ellerman [Fri, 5 Jan 2018 12:23:23 +0000 (17:53 +0530)]
UBUNTU: SAUCE: rfi-flush: Make DEBUG_RFI a CONFIG option

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoUBUNTU: SAUCE: powerpc: Secure memory rfi flush
Ananth N Mavinakayanahalli [Fri, 5 Jan 2018 04:20:56 +0000 (15:20 +1100)]
UBUNTU: SAUCE: powerpc: Secure memory rfi flush

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742772
This puts a nop before each rfid/hrfid and patches in an L1-D
cache flush instruction where possible.

It provides /sys/devices/system/cpu/secure_memory_protection which can
report and can patch the rfi flushes at runtime.

This has some debug checking in the rfi instructions to make sure
we're returning to the context we think we are, so we can avoid
some flushes.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agos390: add ppa to kernel entry / exit
Martin Schwidefsky [Thu, 21 Dec 2017 08:17:59 +0000 (09:17 +0100)]
s390: add ppa to kernel entry / exit

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742771
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agos390: introduce CPU alternatives
Vasily Gorbik [Tue, 2 Jan 2018 10:26:25 +0000 (10:26 +0000)]
s390: introduce CPU alternatives

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1742771
Implement CPU alternatives, which allows to optionally patch newer
instructions at runtime, based on CPU facilities availability.

A new kernel boot parameter "noaltinstr" disables patching.

Current implementation is derived from x86 alternatives. Although
ideal instructions padding (when altinstr is longer then oldinstr)
is added at compile time, and no oldinstr nops optimization has to be
done at runtime. Also couple of compile time sanity checks are done:
1. oldinstr and altinstr must be <= 254 bytes long,
2. oldinstr and altinstr must not have an odd length.

alternative(oldinstr, altinstr, facility);
alternative_2(oldinstr, altinstr1, facility1, altinstr2, facility2);

Both compile time and runtime padding consists of either 6/4/2 bytes nop
or a jump (brcl) + 2 bytes nop filler if padding is longer then 6 bytes.

.altinstructions and .altinstr_replacement sections are part of
__init_begin : __init_end region and are freed after initialization.

Signed-off-by: Vasily Gorbik <gor@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agos390/spinlock: add gmb memory barrier
Martin Schwidefsky [Mon, 18 Dec 2017 06:58:11 +0000 (07:58 +0100)]
s390/spinlock: add gmb memory barrier

CVE-2017-5753
CVE-2017-5715

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agopowerpc: add gmb barrier
Andy Whitcroft [Wed, 20 Dec 2017 12:12:08 +0000 (12:12 +0000)]
powerpc: add gmb barrier

CVE-2017-5753
CVE-2017-5715

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/cpu/AMD: Remove now unused definition of MFENCE_RDTSC feature
Tom Lendacky [Wed, 20 Dec 2017 10:55:48 +0000 (10:55 +0000)]
x86/cpu/AMD: Remove now unused definition of MFENCE_RDTSC feature

CVE-2017-5753
CVE-2017-5715

With the switch to using LFENCE_RDTSC on AMD platforms there is no longer
a need for the MFENCE_RDTSC feature.  Remove it usage and definition.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/svm: Add code to clear registers on VM exit
Tom Lendacky [Wed, 20 Dec 2017 10:55:47 +0000 (10:55 +0000)]
x86/svm: Add code to clear registers on VM exit

CVE-2017-5753
CVE-2017-5715

Clear registers on VM exit to prevent speculative use of them.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/svm: Add code to clobber the RSB on VM exit
Tom Lendacky [Wed, 20 Dec 2017 10:55:47 +0000 (10:55 +0000)]
x86/svm: Add code to clobber the RSB on VM exit

CVE-2017-5753
CVE-2017-5715

Add code to overwrite the local CPU RSB entries from the previous less
privileged mode.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoKVM: x86: Add speculative control CPUID support for guests
Tom Lendacky [Wed, 20 Dec 2017 10:55:47 +0000 (10:55 +0000)]
KVM: x86: Add speculative control CPUID support for guests

CVE-2017-5753
CVE-2017-5715

Provide the guest with the speculative control CPUID related values.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/svm: Set IBPB when running a different VCPU
Tom Lendacky [Wed, 20 Dec 2017 10:55:47 +0000 (10:55 +0000)]
x86/svm: Set IBPB when running a different VCPU

CVE-2017-5753
CVE-2017-5715

Set IBPB (Indirect Branch Prediction Barrier) when the current CPU is
going to run a VCPU different from what was previously run.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/svm: Set IBRS value on VM entry and exit
Tom Lendacky [Wed, 20 Dec 2017 10:55:47 +0000 (10:55 +0000)]
x86/svm: Set IBRS value on VM entry and exit

CVE-2017-5753
CVE-2017-5715

Set/restore the guests IBRS value on VM entry. On VM exit back to the
kernel save the guest IBRS value and then set IBRS to 1.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoKVM: SVM: Do not intercept new speculative control MSRs
Tom Lendacky [Wed, 20 Dec 2017 10:55:47 +0000 (10:55 +0000)]
KVM: SVM: Do not intercept new speculative control MSRs

CVE-2017-5753
CVE-2017-5715

Allow guest access to the speculative control MSRs without being
intercepted.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/microcode: Extend post microcode reload to support IBPB feature
Tom Lendacky [Wed, 20 Dec 2017 10:55:47 +0000 (10:55 +0000)]
x86/microcode: Extend post microcode reload to support IBPB feature

CVE-2017-5753
CVE-2017-5715

Add an IBPB feature check to the speculative control update check after
a microcode reload.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/cpu/AMD: Add speculative control support for AMD
Tom Lendacky [Wed, 20 Dec 2017 10:52:54 +0000 (10:52 +0000)]
x86/cpu/AMD: Add speculative control support for AMD

CVE-2017-5753
CVE-2017-5715

Add speculative control support for AMD processors. For AMD, speculative
control is indicated as follows:

  CPUID EAX=0x00000007, ECX=0x00 return EDX[26] indicates support for
  both IBRS and IBPB.

  CPUID EAX=0x80000008, ECX=0x00 return EBX[12] indicates support for
  just IBPB.

On AMD family 0x10, 0x12 and 0x16 processors where either of the above
features are not supported, IBPB can be achieved by disabling
indirect branch predictor support in MSR 0xc0011021[14] at boot.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/entry: Use retpoline for syscall's indirect calls
Tim Chen [Thu, 9 Nov 2017 00:30:06 +0000 (16:30 -0800)]
x86/entry: Use retpoline for syscall's indirect calls

CVE-2017-5753
CVE-2017-5715

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/syscall: Clear unused extra registers on 32-bit compatible syscall entrance
Tim Chen [Sat, 16 Sep 2017 02:41:24 +0000 (19:41 -0700)]
x86/syscall: Clear unused extra registers on 32-bit compatible syscall entrance

CVE-2017-5753
CVE-2017-5715

To prevent the unused registers %r8-%r15, from being used speculatively,
we clear them upon syscall entrance for code hygiene in 32 bit compatible
mode.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/syscall: Clear unused extra registers on syscall entrance
Tim Chen [Tue, 19 Sep 2017 22:21:40 +0000 (15:21 -0700)]
x86/syscall: Clear unused extra registers on syscall entrance

CVE-2017-5753
CVE-2017-5715

To prevent the unused registers %r12-%r15, %rbp and %rbx from
being used speculatively, we clear them upon syscall entrance
for code hygiene.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/spec_ctrl: Add lock to serialize changes to ibrs and ibpb control
Tim Chen [Mon, 20 Nov 2017 21:47:54 +0000 (13:47 -0800)]
x86/spec_ctrl: Add lock to serialize changes to ibrs and ibpb control

CVE-2017-5753
CVE-2017-5715

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature
Tim Chen [Thu, 16 Nov 2017 12:47:48 +0000 (04:47 -0800)]
x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature

CVE-2017-5753
CVE-2017-5715

There are 2 ways to control IBPB and IBRS

1. At boot time
noibrs kernel boot parameter will disable IBRS usage
noibpb kernel boot parameter will disable IBPB usage
Otherwise if the above parameters are not specified, the system
will enable ibrs and ibpb usage if the cpu supports it.

2. At run time
echo 0 > /proc/sys/kernel/ibrs_enabled will turn off IBRS
echo 1 > /proc/sys/kernel/ibrs_enabled will turn on IBRS in kernel
echo 2 > /proc/sys/kernel/ibrs_enabled will turn on IBRS in both userspace and kernel

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
[marcelo.cerri@canonical.com: add x86 guards to kernel/smp.c]
[marcelo.cerri@canonical.com: include asm/msr.h under x86 guard in kernel/sysctl.c]
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
6 years agox86/kvm: Pad RSB on VM transition
Tim Chen [Sat, 21 Oct 2017 00:05:54 +0000 (17:05 -0700)]
x86/kvm: Pad RSB on VM transition

CVE-2017-5753
CVE-2017-5715

Add code to pad the local CPU's RSB entries to protect
from previous less privilege mode.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/kvm: Toggle IBRS on VM entry and exit
Tim Chen [Sat, 21 Oct 2017 00:04:35 +0000 (17:04 -0700)]
x86/kvm: Toggle IBRS on VM entry and exit

CVE-2017-5753
CVE-2017-5715

Restore guest IBRS on VM entry and set it to 1 on VM exit
back to kernel.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/kvm: Set IBPB when switching VM
Tim Chen [Fri, 13 Oct 2017 21:31:46 +0000 (14:31 -0700)]
x86/kvm: Set IBPB when switching VM

CVE-2017-5753
CVE-2017-5715

Set IBPB (Indirect branch prediction barrier) when switching VM.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/kvm: add MSR_IA32_SPEC_CTRL and MSR_IA32_PRED_CMD to kvm
Wei Wang [Tue, 7 Nov 2017 08:47:53 +0000 (16:47 +0800)]
x86/kvm: add MSR_IA32_SPEC_CTRL and MSR_IA32_PRED_CMD to kvm

CVE-2017-5753
CVE-2017-5715

Add field to access guest MSR_IA332_SPEC_CTRL and MSR_IA32_PRED_CMD state.

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/entry: Stuff RSB for entry to kernel for non-SMEP platform
Tim Chen [Wed, 15 Nov 2017 01:16:30 +0000 (17:16 -0800)]
x86/entry: Stuff RSB for entry to kernel for non-SMEP platform

CVE-2017-5753
CVE-2017-5715

Stuff RSB to prevent RSB underflow on non-SMEP platform.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/mm: Only set IBPB when the new thread cannot ptrace current thread
Tim Chen [Tue, 7 Nov 2017 21:52:42 +0000 (13:52 -0800)]
x86/mm: Only set IBPB when the new thread cannot ptrace current thread

CVE-2017-5753
CVE-2017-5715

To reduce overhead of setting IBPB, we only do that when
the new thread cannot ptrace the current one.  If the new
thread has ptrace capability on current thread, it is safe.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/mm: Set IBPB upon context switch
Tim Chen [Fri, 20 Oct 2017 19:56:29 +0000 (12:56 -0700)]
x86/mm: Set IBPB upon context switch

CVE-2017-5753
CVE-2017-5715

Set IBPB on context switch with changing of page table.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/idle: Disable IBRS when offlining cpu and re-enable on wakeup
Tim Chen [Wed, 15 Nov 2017 20:24:19 +0000 (12:24 -0800)]
x86/idle: Disable IBRS when offlining cpu and re-enable on wakeup

CVE-2017-5753
CVE-2017-5715

Clear IBRS when cpu is offlined and set it when brining it back online.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/idle: Disable IBRS entering idle and enable it on wakeup
Tim Chen [Tue, 7 Nov 2017 02:19:14 +0000 (18:19 -0800)]
x86/idle: Disable IBRS entering idle and enable it on wakeup

CVE-2017-5753
CVE-2017-5715

Clear IBRS on idle entry and set it on idle exit into kernel on mwait.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/enter: Use IBRS on syscall and interrupts
Tim Chen [Fri, 13 Oct 2017 21:25:00 +0000 (14:25 -0700)]
x86/enter: Use IBRS on syscall and interrupts

CVE-2017-5753
CVE-2017-5715

Set IBRS upon kernel entrance via syscall and interrupts. Clear it upon exit.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/enter: MACROS to set/clear IBRS and set IBPB
Tim Chen [Sat, 16 Sep 2017 01:04:53 +0000 (18:04 -0700)]
x86/enter: MACROS to set/clear IBRS and set IBPB

CVE-2017-5753
CVE-2017-5715

Setup macros to control IBRS and IBPB

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/feature: Report presence of IBPB and IBRS control
Tim Chen [Wed, 27 Sep 2017 19:09:14 +0000 (12:09 -0700)]
x86/feature: Report presence of IBPB and IBRS control

CVE-2017-5753
CVE-2017-5715

Report presence of IBPB and IBRS.

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/feature: Enable the x86 feature to control Speculation
Tim Chen [Thu, 24 Aug 2017 16:34:41 +0000 (09:34 -0700)]
x86/feature: Enable the x86 feature to control Speculation

CVE-2017-5753
CVE-2017-5715

cpuid ax=0x7, return rdx bit 26 to indicate presence of this feature
IA32_SPEC_CTRL (0x48) and IA32_PRED_CMD (0x49)
IA32_SPEC_CTRL, bit0 – Indirect Branch Restricted Speculation (IBRS)
IA32_PRED_CMD,  bit0 – Indirect Branch Prediction Barrier (IBPB)

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoudf: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:56 +0000 (13:11 +0300)]
udf: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agonet: mpls: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:55 +0000 (13:11 +0300)]
net: mpls: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agofs: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:54 +0000 (13:11 +0300)]
fs: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoipv6: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:53 +0000 (13:11 +0300)]
ipv6: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agouserns: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:52 +0000 (13:11 +0300)]
userns: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoThermal/int340x: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:51 +0000 (13:11 +0300)]
Thermal/int340x: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agocw1200: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:50 +0000 (13:11 +0300)]
cw1200: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agoqla2xxx: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:49 +0000 (13:11 +0300)]
qla2xxx: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agop54: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:48 +0000 (13:11 +0300)]
p54: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agocarl9170: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:47 +0000 (13:11 +0300)]
carl9170: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

Real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agouvcvideo: prevent speculative execution
Elena Reshetova [Mon, 4 Sep 2017 10:11:46 +0000 (13:11 +0300)]
uvcvideo: prevent speculative execution

CVE-2017-5753
CVE-2017-5715

real commit text tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86, bpf, jit: prevent speculative execution when JIT is enabled
Elena Reshetova [Mon, 4 Sep 2017 10:11:45 +0000 (13:11 +0300)]
x86, bpf, jit: prevent speculative execution when JIT is enabled

CVE-2017-5753
CVE-2017-5715

When constant blinding is enabled (bpf_jit_harden = 1), this adds
a generic memory barrier (lfence for intel, mfence for AMD) before
emitting x86 jitted code for the BPF_ALU(64)_OR_X and BPF_ALU_LHS_X
(for BPF_REG_AX register) eBPF instructions. This is needed in order
to prevent speculative execution on out of bounds BPF_MAP array
indexes when JIT is enabled. This way an arbitary kernel memory is
not exposed through side-channel attacks.

For more details, please see this Google Project Zero report: tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agobpf: prevent speculative execution in eBPF interpreter
Elena Reshetova [Mon, 4 Sep 2017 10:11:44 +0000 (13:11 +0300)]
bpf: prevent speculative execution in eBPF interpreter

CVE-2017-5753
CVE-2017-5715

This adds a generic memory barrier before LD_IMM_DW and
LDX_MEM_B/H/W/DW eBPF instructions during eBPF program
execution in order to prevent speculative execution on out
of bound BFP_MAP array indexes. This way an arbitary kernel
memory is not exposed through side channel attacks.

For more details, please see this Google Project Zero report: tbd

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agolocking/barriers: introduce new memory barrier gmb()
Elena Reshetova [Mon, 4 Sep 2017 10:11:43 +0000 (13:11 +0300)]
locking/barriers: introduce new memory barrier gmb()

CVE-2017-5753
CVE-2017-5715

In constrast to existing mb() and rmb() barriers,
gmb() barrier is arch-independent and can be used to
implement any type of memory barrier.
In x86 case, it is either lfence or mfence, based on
processor type. ARM and others can define it according
to their needs.

Suggested-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/pti: Make unpoison of pgd for trusted boot work for real
Dave Hansen [Wed, 10 Jan 2018 22:49:39 +0000 (14:49 -0800)]
x86/pti: Make unpoison of pgd for trusted boot work for real

CVE-2017-5754

The inital fix for trusted boot and PTI potentially misses the pgd clearing
if pud_alloc() sets a PGD.  It probably works in *practice* because for two
adjacent calls to map_tboot_page() that share a PGD entry, the first will
clear NX, *then* allocate and set the PGD (without NX clear).  The second
call will *not* allocate but will clear the NX bit.

Defer the NX clearing to a point after it is known that all top-level
allocations have occurred.  Add a comment to clarify why.

[ tglx: Massaged changelog ]

Fixes: 262b6b30087 ("x86/tboot: Unbreak tboot with PTI enabled")
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Jon Masters <jcm@redhat.com>
Cc: "Tim Chen" <tim.c.chen@linux.intel.com>
Cc: gnomes@lxorguk.ukuu.org.uk
Cc: peterz@infradead.org
Cc: ning.sun@intel.com
Cc: tboot-devel@lists.sourceforge.net
Cc: andi@firstfloor.org
Cc: luto@kernel.org
Cc: law@redhat.com
Cc: pbonzini@redhat.com
Cc: torvalds@linux-foundation.org
Cc: gregkh@linux-foundation.org
Cc: dwmw@amazon.co.uk
Cc: nickc@redhat.com
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180110224939.2695CD47@viggo.jf.intel.com
(cherry picked from commit 8a931d1e24bacf01f00a35d43bfe7917256c5c49)
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/alternatives: Fix optimize_nops() checking
Borislav Petkov [Wed, 10 Jan 2018 11:28:16 +0000 (12:28 +0100)]
x86/alternatives: Fix optimize_nops() checking

CVE-2017-5754

The alternatives code checks only the first byte whether it is a NOP, but
with NOPs in front of the payload and having actual instructions after it
breaks the "optimized' test.

Make sure to scan all bytes before deciding to optimize the NOPs in there.

Reported-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Andrew Lutomirski <luto@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
Cc: Paul Turner <pjt@google.com>
Link: https://lkml.kernel.org/r/20180110112815.mgciyf5acwacphkq@pd.tnic
(cherry picked from commit 612e8e9350fd19cae6900cf36ea0c6892d1a0dca)
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agosysfs/cpu: Fix typos in vulnerability documentation
David Woodhouse [Tue, 9 Jan 2018 15:02:51 +0000 (15:02 +0000)]
sysfs/cpu: Fix typos in vulnerability documentation

CVE-2017-5754

Fixes: 87590ce6e ("sysfs/cpu: Add vulnerability folder")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
(cherry picked from commit 9ecccfaa7cb5249bd31bdceb93fcf5bedb8a24d8)
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
6 years agox86/cpu/AMD: Use LFENCE_RDTSC in preference to MFENCE_RDTSC
Tom Lendacky [Mon, 8 Jan 2018 22:09:32 +0000 (16:09 -0600)]
x86/cpu/AMD: Use LFENCE_RDTSC in preference to MFENCE_RDTSC

CVE-2017-5754

With LFENCE now a serializing instruction, use LFENCE_RDTSC in preference
to MFENCE_RDTSC.  However, since the kernel could be running under a
hypervisor that does not support writing that MSR, read the MSR back and
verify that the bit has been set successfully.  If the MSR can be read
and the bit is set, then set the LFENCE_RDTSC feature, otherwise set the
MFENCE_RDTSC feature.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Paul Turner <pjt@google.com>
Link: https://lkml.kernel.org/r/20180108220932.12580.52458.stgit@tlendack-t1.amdoffice.net
(cherry picked from commit 9c6a73c75864ad9fa49e5fa6513e4c4071c0e29f)
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>