|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] Revert "x86: allow disabling sm{e, a}p for Xen itself"
commit 343f84be135e6f9e681960a9e235296eae159fc8
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Sep 5 15:04:53 2016 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 5 15:04:53 2016 +0200
Revert "x86: allow disabling sm{e,a}p for Xen itself"
This reverts commit 5fdea6577098eda065c794c79e1ae23f33f103af,
which is still buggy.
---
docs/misc/xen-command-line.markdown | 14 ++++----
xen/arch/x86/setup.c | 72 +++++++------------------------------
xen/include/asm-x86/asm_defns.h | 10 +++---
xen/include/asm-x86/cpufeature.h | 4 +--
4 files changed, 25 insertions(+), 75 deletions(-)
diff --git a/docs/misc/xen-command-line.markdown
b/docs/misc/xen-command-line.markdown
index 3690041..3a250cb 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1427,21 +1427,19 @@ enabling more sockets and cores to go into deeper sleep
states.
Set the serial transmit buffer size.
-### smap
-> `= <boolean> | hvm`
+### smep
+> `= <boolean>`
> Default: `true`
-Flag to enable Supervisor Mode Access Prevention
-Use `smap=hvm` to allow SMAP use by HVM guests only.
+Flag to enable Supervisor Mode Execution Protection
-### smep
-> `= <boolean> | hvm`
+### smap
+> `= <boolean>`
> Default: `true`
-Flag to enable Supervisor Mode Execution Protection
-Use `smep=hvm` to allow SMEP use by HVM guests only.
+Flag to enable Supervisor Mode Access Prevention
### snb\_igd\_quirk
> `= <boolean> | cap | <integer>`
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 27a0720..8ae897a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -61,6 +61,14 @@ boolean_param("nosmp", opt_nosmp);
static unsigned int __initdata max_cpus;
integer_param("maxcpus", max_cpus);
+/* smep: Enable/disable Supervisor Mode Execution Protection (default on). */
+static bool_t __initdata opt_smep = 1;
+boolean_param("smep", opt_smep);
+
+/* smap: Enable/disable Supervisor Mode Access Prevention (default on). */
+static bool_t __initdata opt_smap = 1;
+boolean_param("smap", opt_smap);
+
unsigned long __read_mostly cr4_pv32_mask;
/* Boot dom0 in pvh mode */
@@ -104,58 +112,6 @@ struct cpuinfo_x86 __read_mostly boot_cpu_data = { 0, 0,
0, 0, -1 };
unsigned long __read_mostly mmu_cr4_features = XEN_MINIMAL_CR4;
-/* smep: Enable/disable Supervisor Mode Execution Protection (default on). */
-#define SMEP_HVM_ONLY (-1)
-static s8 __initdata opt_smep = 1;
-static void __init parse_smep_param(char *s)
-{
- if ( !*s )
- {
- opt_smep = 1;
- return;
- }
-
- switch ( parse_bool(s) )
- {
- case 0:
- opt_smep = 0;
- return;
- case 1:
- opt_smep = 1;
- return;
- }
-
- if ( !strcmp(s, "hvm") )
- opt_smep = SMEP_HVM_ONLY;
-}
-custom_param("smep", parse_smep_param);
-
-/* smap: Enable/disable Supervisor Mode Access Prevention (default on). */
-#define SMAP_HVM_ONLY (-1)
-static s8 __initdata opt_smap = 1;
-static void __init parse_smap_param(char *s)
-{
- if ( !*s )
- {
- opt_smap = 1;
- return;
- }
-
- switch ( parse_bool(s) )
- {
- case 0:
- opt_smap = 0;
- return;
- case 1:
- opt_smap = 1;
- return;
- }
-
- if ( !strcmp(s, "hvm") )
- opt_smap = SMAP_HVM_ONLY;
-}
-custom_param("smap", parse_smap_param);
-
bool_t __read_mostly acpi_disabled;
bool_t __initdata acpi_force;
static char __initdata acpi_param[10] = "";
@@ -1448,16 +1404,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
if ( !opt_smep )
setup_clear_cpu_cap(X86_FEATURE_SMEP);
- else if ( opt_smep == 1 )
- __set_bit(X86_FEATURE_XEN_SMEP, boot_cpu_data.x86_capability);
- if ( boot_cpu_has(X86_FEATURE_XEN_SMEP) )
+ if ( cpu_has_smep )
set_in_cr4(X86_CR4_SMEP);
if ( !opt_smap )
setup_clear_cpu_cap(X86_FEATURE_SMAP);
- else if ( opt_smap == 1 )
- __set_bit(X86_FEATURE_XEN_SMAP, boot_cpu_data.x86_capability);
- if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+ if ( cpu_has_smap )
set_in_cr4(X86_CR4_SMAP);
cr4_pv32_mask = mmu_cr4_features & XEN_CR4_PV32_BITS;
@@ -1599,7 +1551,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
* This saves a large number of corner cases interactions with
* copy_from_user().
*/
- if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+ if ( cpu_has_smap )
{
cr4_pv32_mask &= ~X86_CR4_SMAP;
write_cr4(read_cr4() & ~X86_CR4_SMAP);
@@ -1619,7 +1571,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
bootstrap_map, cmdline) != 0)
panic("Could not set up DOM0 guest OS");
- if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+ if ( cpu_has_smap )
{
write_cr4(read_cr4() | X86_CR4_SMAP);
cr4_pv32_mask |= X86_CR4_SMAP;
diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index f1c6fa1..e36e78f 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -205,7 +205,7 @@ void ret_from_intr(void);
.popsection; \
.pushsection .altinstructions, "a"; \
altinstruction_entry 661b, 661b, X86_FEATURE_ALWAYS, 3, 0; \
- altinstruction_entry 661b, 662b, X86_FEATURE_XEN_SMAP, 3, 3; \
+ altinstruction_entry 661b, 662b, X86_FEATURE_SMAP, 3, 3; \
.popsection
#define ASM_STAC ASM_AC(STAC)
@@ -217,21 +217,21 @@ void ret_from_intr(void);
668: call cr4_pv32_restore; \
.section .altinstructions, "a"; \
altinstruction_entry 667b, 667b, X86_FEATURE_ALWAYS, 5, 0; \
- altinstruction_entry 667b, 668b, X86_FEATURE_XEN_SMEP, 5, 5; \
- altinstruction_entry 667b, 668b, X86_FEATURE_XEN_SMAP, 5, 5; \
+ altinstruction_entry 667b, 668b, X86_FEATURE_SMEP, 5, 5; \
+ altinstruction_entry 667b, 668b, X86_FEATURE_SMAP, 5, 5; \
.popsection
#else
static always_inline void clac(void)
{
/* Note: a barrier is implicit in alternative() */
- alternative(ASM_NOP3, __stringify(__ASM_CLAC), X86_FEATURE_XEN_SMAP);
+ alternative(ASM_NOP3, __stringify(__ASM_CLAC), X86_FEATURE_SMAP);
}
static always_inline void stac(void)
{
/* Note: a barrier is implicit in alternative() */
- alternative(ASM_NOP3, __stringify(__ASM_STAC), X86_FEATURE_XEN_SMAP);
+ alternative(ASM_NOP3, __stringify(__ASM_STAC), X86_FEATURE_SMAP);
}
#endif
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 0f6810a..bcdf5d6 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -17,8 +17,6 @@ XEN_CPUFEATURE(CPUID_FAULTING, (FSCAPINTS+0)*32+ 6) /* cpuid
faulting */
XEN_CPUFEATURE(CLFLUSH_MONITOR, (FSCAPINTS+0)*32+ 7) /* clflush reqd with
monitor */
XEN_CPUFEATURE(APERFMPERF, (FSCAPINTS+0)*32+ 8) /* APERFMPERF */
XEN_CPUFEATURE(MFENCE_RDTSC, (FSCAPINTS+0)*32+ 9) /* MFENCE synchronizes
RDTSC */
-XEN_CPUFEATURE(XEN_SMEP, (FSCAPINTS+0)*32+ 10) /* SMEP gets used by Xen
itself */
-XEN_CPUFEATURE(XEN_SMAP, (FSCAPINTS+0)*32+ 11) /* SMAP gets used by Xen
itself */
#define NCAPINTS (FSCAPINTS + 1) /* N 32-bit words worth of info */
@@ -68,6 +66,8 @@ XEN_CPUFEATURE(XEN_SMAP, (FSCAPINTS+0)*32+ 11) /* SMAP
gets used by Xen i
#define cpu_has_page1gb boot_cpu_has(X86_FEATURE_PAGE1GB)
#define cpu_has_fsgsbase boot_cpu_has(X86_FEATURE_FSGSBASE)
#define cpu_has_aperfmperf boot_cpu_has(X86_FEATURE_APERFMPERF)
+#define cpu_has_smep boot_cpu_has(X86_FEATURE_SMEP)
+#define cpu_has_smap boot_cpu_has(X86_FEATURE_SMAP)
#define cpu_has_fpu_sel (!boot_cpu_has(X86_FEATURE_NO_FPU_SEL))
#define cpu_has_ffxsr ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) \
&& boot_cpu_has(X86_FEATURE_FFXSR))
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |