mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
6b3e64c237
If 'prctl' mode of user space protection from spectre v2 is selected on the kernel command-line, STIBP and IBPB are applied on tasks which restrict their indirect branch speculation via prctl. SECCOMP enables the SSBD mitigation for sandboxed tasks already, so it makes sense to prevent spectre v2 user space to user space attacks as well. The Intel mitigation guide documents how STIPB works: Setting bit 1 (STIBP) of the IA32_SPEC_CTRL MSR on a logical processor prevents the predicted targets of indirect branches on any logical processor of that core from being controlled by software that executes (or executed previously) on another logical processor of the same core. Ergo setting STIBP protects the task itself from being attacked from a task running on a different hyper-thread and protects the tasks running on different hyper-threads from being attacked. While the document suggests that the branch predictors are shielded between the logical processors, the observed performance regressions suggest that STIBP simply disables the branch predictor more or less completely. Of course the document wording is vague, but the fact that there is also no requirement for issuing IBPB when STIBP is used points clearly in that direction. The kernel still issues IBPB even when STIBP is used until Intel clarifies the whole mechanism. IBPB is issued when the task switches out, so malicious sandbox code cannot mistrain the branch predictor for the next user space task on the same logical processor. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: David Woodhouse <dwmw@amazon.co.uk> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Casey Schaufler <casey.schaufler@intel.com> Cc: Asit Mallick <asit.k.mallick@intel.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Jon Masters <jcm@redhat.com> Cc: Waiman Long <longman9394@gmail.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Dave Stewart <david.c.stewart@intel.com> Cc: Kees Cook <keescook@chromium.org> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20181125185006.051663132@linutronix.de |
||
---|---|---|
.. | ||
ABI | ||
accelerators | ||
accounting | ||
acpi | ||
admin-guide | ||
aoe | ||
arm | ||
arm64 | ||
auxdisplay | ||
backlight | ||
block | ||
blockdev | ||
bpf | ||
bus-devices | ||
cdrom | ||
cgroup-v1 | ||
cma | ||
connector | ||
console | ||
core-api | ||
cpu-freq | ||
cpuidle | ||
crypto | ||
dev-tools | ||
device-mapper | ||
devicetree | ||
doc-guide | ||
driver-api | ||
driver-model | ||
early-userspace | ||
EDID | ||
extcon | ||
fault-injection | ||
fb | ||
features | ||
filesystems | ||
firmware_class | ||
fmc | ||
fpga | ||
gpio | ||
gpu | ||
hid | ||
hwmon | ||
i2c | ||
ia64 | ||
ide | ||
iio | ||
infiniband | ||
input | ||
ioctl | ||
isdn | ||
kbuild | ||
kdump | ||
kernel-hacking | ||
laptops | ||
leds | ||
lightnvm | ||
livepatch | ||
locking | ||
m68k | ||
maintainer | ||
md | ||
media | ||
memory-devices | ||
mic | ||
mips | ||
misc-devices | ||
mmc | ||
mtd | ||
namespaces | ||
netlabel | ||
networking | ||
nfc | ||
nios2 | ||
nvdimm | ||
nvmem | ||
openrisc | ||
parisc | ||
PCI | ||
pcmcia | ||
perf | ||
phy | ||
platform | ||
power | ||
powerpc | ||
pps | ||
process | ||
pti | ||
ptp | ||
rapidio | ||
RCU | ||
riscv | ||
s390 | ||
scheduler | ||
scsi | ||
security | ||
serial | ||
sh | ||
sound | ||
sparc | ||
sphinx | ||
sphinx-static | ||
spi | ||
sysctl | ||
target | ||
thermal | ||
timers | ||
trace | ||
translations | ||
usb | ||
userspace-api | ||
virtual | ||
vm | ||
w1 | ||
watchdog | ||
wimax | ||
x86 | ||
xilinx | ||
xtensa | ||
.gitignore | ||
atomic_bitops.txt | ||
atomic_t.txt | ||
bt8xxgpio.txt | ||
btmrvl.txt | ||
bus-virt-phys-mapping.txt | ||
Changes | ||
clearing-warn-once.txt | ||
CodingStyle | ||
conf.py | ||
cpu-load.txt | ||
cputopology.txt | ||
crc32.txt | ||
dcdbas.txt | ||
debugging-modules.txt | ||
debugging-via-ohci1394.txt | ||
dell_rbu.txt | ||
digsig.txt | ||
DMA-API-HOWTO.txt | ||
DMA-API.txt | ||
DMA-attributes.txt | ||
DMA-ISA-LPC.txt | ||
docutils.conf | ||
dontdiff | ||
efi-stub.txt | ||
eisa.txt | ||
flexible-arrays.txt | ||
futex-requeue-pi.txt | ||
gcc-plugins.txt | ||
highuid.txt | ||
hw_random.txt | ||
hwspinlock.txt | ||
index.rst | ||
intel_txt.txt | ||
Intel-IOMMU.txt | ||
io_ordering.txt | ||
io-mapping.txt | ||
iostats.txt | ||
IPMI.txt | ||
IRQ-affinity.txt | ||
IRQ-domain.txt | ||
IRQ.txt | ||
irqflags-tracing.txt | ||
isa.txt | ||
isapnp.txt | ||
kernel-per-CPU-kthreads.txt | ||
kobject.txt | ||
kprobes.txt | ||
kref.txt | ||
ldm.txt | ||
lockup-watchdogs.txt | ||
logo.gif | ||
logo.txt | ||
lsm.txt | ||
lzo.txt | ||
mailbox.txt | ||
Makefile | ||
memory-barriers.txt | ||
men-chameleon-bus.txt | ||
nommu-mmap.txt | ||
ntb.txt | ||
numastat.txt | ||
padata.txt | ||
parport-lowlevel.txt | ||
percpu-rw-semaphore.txt | ||
phy.txt | ||
pi-futex.txt | ||
pnp.txt | ||
preempt-locking.txt | ||
pwm.txt | ||
rbtree.txt | ||
remoteproc.txt | ||
rfkill.txt | ||
robust-futex-ABI.txt | ||
robust-futexes.txt | ||
rpmsg.txt | ||
rtc.txt | ||
SAK.txt | ||
sgi-ioc4.txt | ||
siphash.txt | ||
SM501.txt | ||
smsc_ece1099.txt | ||
speculation.txt | ||
static-keys.txt | ||
SubmittingPatches | ||
svga.txt | ||
switchtec.txt | ||
sync_file.txt | ||
tee.txt | ||
this_cpu_ops.txt | ||
unaligned-memory-access.txt | ||
vfio-mediated-device.txt | ||
vfio.txt | ||
video-output.txt | ||
xillybus.txt | ||
xz.txt | ||
zorro.txt |