]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Update XSA-182 PoC to cope with linear pagetables being globally disabled
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 17 Oct 2017 10:46:42 +0000 (11:46 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 17 Oct 2017 10:46:42 +0000 (11:46 +0100)
One mitigation for XSA-240 is a global disable of linear pagetables.  Cope in
such configurations by skipping the test.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
tests/xsa-182/main.c

index 2c750e1fe0f6976e5990639a9d9da9342c462f4d..2cbe5d99c7d557a9b63de2d623c9aac4fff55e4f 100644 (file)
@@ -65,15 +65,24 @@ void test_main(void)
     if ( !map_slot || !test_slot )
         return xtf_error("Insufficient free l4 slots\n");
 
-    mmu_update_t mu =
-        {
-            .ptr = cr3 + (map_slot * PTE_SIZE),
-            .val = cr3 | PF_SYM(AD, U, P),
-        };
+    mmu_update_t mu = {
+        .ptr = cr3 + (map_slot * PTE_SIZE),
+        .val = cr3 | PF_SYM(AD, U, P),
+    };
 
     printk("  Creating recursive l4 mapping\n");
-    if ( hypercall_mmu_update(&mu, 1, NULL, DOMID_SELF) )
-        return xtf_error("Recursive mapping failed\n");
+    int rc = hypercall_mmu_update(&mu, 1, NULL, DOMID_SELF);
+    switch ( rc )
+    {
+    case 0:
+        break;
+
+    case -EINVAL:
+        return xtf_skip("Skip: Linear pagetables disallowed\n");
+
+    default:
+        return xtf_error("Error: Recursive mapping failed: %d\n", rc);
+    }
 
     printk("  Remapping l4 RW\n");
     mu.val |= _PAGE_RW;