Skip to content
Snippets Groups Projects
Commit f1434c1d authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Yongqiang Liu
Browse files

x86/asm: Move native_write_cr0/4() out of line

mainline inclusion
from mainline-v5.3-rc1
commit 7652ac92
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I563FS
CVE: NA

--------------------------------

The pinning of sensitive CR0 and CR4 bits caused a boot crash when loading
the kvm_intel module on a kernel compiled with CONFIG_PARAVIRT=n.

The reason is that the static key which controls the pinning is marked RO
after init. The kvm_intel module contains a CR4 write which requires to
update the static key entry list. That obviously does not work when the key
is in a RO section.

With CONFIG_PARAVIRT enabled this does not happen because the CR4 write
uses the paravirt indirection and the actual write function is built in.

As the key is intended to be immutable after init, move
native_write_cr0/4() out of line.

While at it consolidate the update of the cr4 shadow variable and store the
value right away when the pinning is initialized on a booting CPU....
parent 1143d1dd
No related branches found
No related tags found
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment