Message ID | 56D97F6702000078000D9565@prv-mh.provo.novell.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 04/03/16 11:28, Jan Beulich wrote: > Alternatives patching code picks the most suitable NOPs for the > running system, so simply use it to replace the pre-populated ones. > > Use an arbitrary, always available feature to key off from. I would be tempted to introduce X86_FEATURE_ALWAYS as an alias of X86_FEATURE_LM, or even a new synthetic feature. The choice of LM is explained in the commit message, but will be non-obvious to people reading the code. ~Andrew
>>> On 07.03.16 at 18:43, <andrew.cooper3@citrix.com> wrote: > On 04/03/16 11:28, Jan Beulich wrote: >> Alternatives patching code picks the most suitable NOPs for the >> running system, so simply use it to replace the pre-populated ones. >> >> Use an arbitrary, always available feature to key off from. > > I would be tempted to introduce X86_FEATURE_ALWAYS as an alias of > X86_FEATURE_LM, or even a new synthetic feature. The choice of LM is > explained in the commit message, but will be non-obvious to people > reading the code. Okay, as an alias. Jan
--- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -185,6 +185,7 @@ ENTRY(compat_restore_all_guest) mov %rax, %cr4 .Lcr4_alt_end: .section .altinstructions, "a" + altinstruction_entry .Lcr4_orig, .Lcr4_orig, X86_FEATURE_LM, 12, 0 altinstruction_entry .Lcr4_orig, .Lcr4_alt, X86_FEATURE_SMEP, 12, \ (.Lcr4_alt_end - .Lcr4_alt) altinstruction_entry .Lcr4_orig, .Lcr4_alt, X86_FEATURE_SMAP, 12, \ --- a/xen/include/asm-x86/asm_defns.h +++ b/xen/include/asm-x86/asm_defns.h @@ -204,6 +204,7 @@ void ret_from_intr(void); 662: __ASM_##op; \ .popsection; \ .pushsection .altinstructions, "a"; \ + altinstruction_entry 661b, 661b, X86_FEATURE_LM, 3, 0; \ altinstruction_entry 661b, 662b, X86_FEATURE_SMAP, 3, 3; \ .popsection @@ -215,6 +216,7 @@ void ret_from_intr(void); .pushsection .altinstr_replacement, "ax"; \ 668: call cr4_smep_smap_restore; \ .section .altinstructions, "a"; \ + altinstruction_entry 667b, 667b, X86_FEATURE_LM, 5, 0; \ altinstruction_entry 667b, 668b, X86_FEATURE_SMEP, 5, 5; \ altinstruction_entry 667b, 668b, X86_FEATURE_SMAP, 5, 5; \ .popsection