x86/speculation: Protect against userspace-userspace spectreRSB
authorJiri Kosina <jkosina@suse.cz>
Thu, 26 Jul 2018 11:14:55 +0000 (13:14 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 30 Jul 2018 22:45:15 +0000 (00:45 +0200)
commitfdf82a7856b32d905c39afc85e34364491e46346
tree9aaead977f0e8179b929ee98ca2b2914fc119b7d
parentca38dc8f2724d101038b1205122c93a1c7f38f11
x86/speculation: Protect against userspace-userspace spectreRSB

The article "Spectre Returns! Speculation Attacks using the Return Stack
Buffer" [1] describes two new (sub-)variants of spectrev2-like attacks,
making use solely of the RSB contents even on CPUs that don't fallback to
BTB on RSB underflow (Skylake+).

Mitigate userspace-userspace attacks by always unconditionally filling RSB on
context switch when the generic spectrev2 mitigation has been enabled.

[1] https://arxiv.org/pdf/1807.07940.pdf

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/nycvar.YFH.7.76.1807261308190.997@cbobk.fhfr.pm
arch/x86/kernel/cpu/bugs.c