Skip to contentSkip to conversation

x86/cpuid: Tie SMAP to NX, for the shadow pagetable code

PATCH In review Andrew Cooper 2 participants 2 messages Oct 18, 2018 – Oct 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpuid: Tie SMAP to NX, for the shadow pagetable code

NX support in the host is required for the shadow pagetable code to handle SMAP correctly for guests.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: George Dunlap <[email protected]>
CC: Tim Deegan <[email protected]>

RFC because this is a little thorny.

Strictly speaking, it is "Xen uses NX in HVM guest context" as the prerequisite. We could in principle allow guests to use NX without using it in Xen, but that sounds like unnecessary complication. Also, we have no option to inhibit Xen from using NX if it finds it in hardware.

This dependency also doesn't need to occur for HAP guests.

In practice, all 64bit hardware (save the very first Intel 64bit CPUs) supports NX, and expressing the interlock like this is far easier than trying to account for it dynamically.

---
 xen/tools/gen-cpuid.py | 5 +++++
 1 file changed, 5 insertions(+)
xen/tools/gen-cpuid.py +5 -0
index 3fecae8..31fdee9 100755
@@ -239,6 +239,11 @@ def crunch_numbers(state):
         # absence of any enabled xstate.
         AVX: [FMA, FMA4, F16C, AVX2, XOP],
 
+        # This dependency exists solely for the shadow pagetable code.  If the
+        # host doesn't have NX support, the shadow pagetable code can't handle
+        # SMAP correctly for guests.
+        NX: [SMAP],
+
         # CX16 is only encodable in Long Mode.  LAHF_LM indicates that the
         # SAHF/LAHF instructions are reintroduced in Long Mode.  1GB
         # superpages, PCID and PKU are only available in 4 level paging.
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 18.10.18 at 12:34, <[email protected]> wrote:

NX support in the host is required for the shadow pagetable code to handle SMAP correctly for guests.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: George Dunlap <[email protected]>
CC: Tim Deegan <[email protected]>

RFC because this is a little thorny.

Strictly speaking, it is "Xen uses NX in HVM guest context" as the prerequisite. We could in principle allow guests to use NX without using it in Xen, but that sounds like unnecessary complication. Also, we have no option to inhibit Xen from using NX if it finds it in hardware.

Quoted 5 lines

This dependency also doesn't need to occur for HAP guests.

In practice, all 64bit hardware (save the very first Intel 64bit CPUs) supports NX, and expressing the interlock like this is far easier than trying to account for it dynamically.

Fine with me nevertheless:

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel