HV: enable SMEP in hypervisor

- this patch is to enable SMEP in hypervisor, SMEP protects
   guests' memory from supervisor-mode instruction fetches,
   in other words, hypervisor which operating in supervisor
   mode can't fetch instructions from (guests' memory)
   linear addresses that are accessible in user mode.

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang
2018-06-14 18:22:51 +08:00
committed by Jack Ren
parent b2b49a64a9
commit 098c2e6788
4 changed files with 40 additions and 7 deletions

View File

@@ -495,6 +495,8 @@ void bsp_boot_init(void)
pr_fatal("Please apply the latest CPU uCode patch!");
}
enable_smep();
/* Initialize the shell */
shell_init();
@@ -546,6 +548,9 @@ void cpu_secondary_init(void)
* primary/boot CPU
*/
enable_paging(get_paging_pml4());
enable_smep();
early_init_lapic();
/* Find the logical ID of this CPU given the LAPIC ID