]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/speculation: Read per-cpu value of x86_spec_ctrl_priv in x86_virt_spec_ctrl()
authorAlejandro Jimenez <alejandro.j.jimenez@oracle.com>
Mon, 15 Apr 2019 16:21:50 +0000 (12:21 -0400)
committerBrian Maly <brian.maly@oracle.com>
Fri, 10 May 2019 23:11:53 +0000 (19:11 -0400)
commit6f9087745d0e417267386e0f7744b7a223c828f5
tree3af2e61fd7f575ce10274e9b5eb35a0fbba7f311
parent5a415bc0a3b989c3ada14a68c697515738694633
x86/speculation: Read per-cpu value of x86_spec_ctrl_priv in x86_virt_spec_ctrl()

In x86_virt_spec_ctrl(), when IBRS is in use on the host, the baseline to
restore the host SPEC_CTRL must be taken from the privileged value which
has the IBRS bit set. In addition, it must be read from the per cpu variable
(x86_spec_ctrl_priv_cpu) that holds the SPEC_CTRL MSR for the current cpu.

Currently, this line:

hostval = this_cpu_read(x86_spec_ctrl_priv);

incorrectly uses the global x86_spec_ctrl_priv instead of the correct
per-cpu variable x86_spec_ctrl_priv_cpu, which assigns spurious values
to hostval.
Fix this issue by reading the correct per-cpu value instead of the
global.

Orabug: 29526401

Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
arch/x86/kernel/cpu/bugs_64.c