From: Andrew Cooper Date: Tue, 17 Oct 2017 10:46:42 +0000 (+0100) Subject: Update XSA-182 PoC to cope with linear pagetables being globally disabled X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1b1a64ea971788e18fbd31bb1c9cbb05aaa4b36a;p=people%2Fandrewcoop%2Fxen-test-framework.git Update XSA-182 PoC to cope with linear pagetables being globally disabled 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 --- diff --git a/tests/xsa-182/main.c b/tests/xsa-182/main.c index 2c750e1..2cbe5d9 100644 --- a/tests/xsa-182/main.c +++ b/tests/xsa-182/main.c @@ -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;