head 1.2; access; symbols pkgsrc-2020Q2:1.1.0.32 pkgsrc-2020Q2-base:1.1 pkgsrc-2020Q1:1.1.0.12 pkgsrc-2020Q1-base:1.1 pkgsrc-2019Q4:1.1.0.34 pkgsrc-2019Q4-base:1.1 pkgsrc-2019Q3:1.1.0.30 pkgsrc-2019Q3-base:1.1 pkgsrc-2019Q2:1.1.0.28 pkgsrc-2019Q2-base:1.1 pkgsrc-2019Q1:1.1.0.26 pkgsrc-2019Q1-base:1.1 pkgsrc-2018Q4:1.1.0.24 pkgsrc-2018Q4-base:1.1 pkgsrc-2018Q3:1.1.0.22 pkgsrc-2018Q3-base:1.1 pkgsrc-2018Q2:1.1.0.20 pkgsrc-2018Q2-base:1.1 pkgsrc-2018Q1:1.1.0.18 pkgsrc-2018Q1-base:1.1 pkgsrc-2017Q4:1.1.0.16 pkgsrc-2017Q4-base:1.1 pkgsrc-2017Q3:1.1.0.14 pkgsrc-2017Q3-base:1.1 pkgsrc-2017Q2:1.1.0.10 pkgsrc-2017Q2-base:1.1 pkgsrc-2017Q1:1.1.0.8 pkgsrc-2017Q1-base:1.1 pkgsrc-2016Q4:1.1.0.6 pkgsrc-2016Q4-base:1.1 pkgsrc-2016Q3:1.1.0.4 pkgsrc-2016Q3-base:1.1 pkgsrc-2016Q2:1.1.0.2; locks; strict; comment @# @; 1.2 date 2020.08.19.10.39.23; author bouyer; state dead; branches; next 1.1; commitid DGAMglRf0Jde6FkC; 1.1 date 2016.07.26.15.38.00; author bouyer; state Exp; branches 1.1.2.1; next ; commitid B5mjV5Hf0TaouQfz; 1.1.2.1 date 2016.07.26.15.38.00; author spz; state dead; branches; next 1.1.2.2; commitid X9BJ5q4tiWY7R5gz; 1.1.2.2 date 2016.07.28.13.54.43; author spz; state Exp; branches; next ; commitid X9BJ5q4tiWY7R5gz; desc @@ 1.2 log @Remove xenkernel and xentools packages older than 4.11. They're not maintained anymore upstream, and don't build on supported NetBSD releases. @ text @$NetBSD: patch-XSA-182,v 1.1 2016/07/26 15:38:00 bouyer Exp $ backported from: From 798c1498f764bfaa7b0b955bab40b01b0610d372 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Mon, 11 Jul 2016 14:32:03 +0100 Subject: [PATCH] x86/pv: Remove unsafe bits from the mod_l?_entry() fastpath All changes in writeability and cacheability must go through full re-validation. Rework the logic as a whitelist, to make it clearer to follow. This is XSA-182 --- xen/arch/x86/mm.c.orig 2016-07-26 16:33:46.000000000 +0200 +++ xen/arch/x86/mm.c 2016-07-26 16:37:14.000000000 +0200 @@@@ -1860,6 +1860,14 @@@@ _t ## e_get_intpte(_o), _t ## e_get_intpte(_n), \ (_m), (_v), (_ad)) +/* + * PTE flags that a guest may change without re-validating the PTE. + * All other bits affect translation, caching, or Xen's safety. + */ +#define FASTPATH_FLAG_WHITELIST \ + (_PAGE_NX_BIT | _PAGE_AVAIL_HIGH | _PAGE_AVAIL | _PAGE_GLOBAL | \ + _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER) + /* Update the L1 entry at pl1e to new value nl1e. */ static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e, unsigned long gl1mfn, int preserve_ad, @@@@ -1900,8 +1908,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping, r/w and presence. */ - if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings.*/ + if ( !l1e_has_changed(ol1e, nl1e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l1e(nl1e, pt_dom); if ( UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu, @@@@ -1982,11 +1990,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping and presence. */ - if ( !l2e_has_changed(ol2e, nl2e, - unlikely(opt_allow_superpage) - ? _PAGE_PSE | _PAGE_RW | _PAGE_PRESENT - : _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings. */ + if ( !l2e_has_changed(ol2e, nl2e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l2e(nl2e, d); if ( UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu, preserve_ad) ) @@@@ -2051,8 +2056,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping and presence. */ - if ( !l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings. */ + if ( !l3e_has_changed(ol3e, nl3e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l3e(nl3e, d); rc = UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, vcpu, preserve_ad); @@@@ -2121,8 +2126,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping and presence. */ - if ( !l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings. */ + if ( !l4e_has_changed(ol4e, nl4e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l4e(nl4e, d); rc = UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, vcpu, preserve_ad); --- xen/include/asm-x86/page.h.orig 2014-09-02 08:22:57.000000000 +0200 +++ xen/include/asm-x86/page.h 2016-07-26 16:39:51.000000000 +0200 @@@@ -332,6 +332,7 @@@@ #define _PAGE_AVAIL2 0x800U #define _PAGE_AVAIL 0xE00U #define _PAGE_PSE_PAT 0x1000U +#define _PAGE_AVAIL_HIGH (0x7ffU << 12) #define _PAGE_PAGED 0x2000U #define _PAGE_SHARED 0x4000U @ 1.1 log @Apply security patch from XSA-182. Bump PKGREVISION xen 4.2 is not vulnerable to XSA-183. @ text @d1 1 a1 1 $NetBSD: patch-XSA-172,v 1.1 2016/05/12 15:42:58 bouyer Exp $ @ 1.1.2.1 log @file patch-XSA-182 was added on branch pkgsrc-2016Q2 on 2016-07-28 13:54:43 +0000 @ text @d1 91 @ 1.1.2.2 log @Pullup ticket #5071 - requested by bouyer sysutils/xenkernel42: security patch Revisions pulled up: - sysutils/xenkernel42/Makefile 1.22 - sysutils/xenkernel42/distinfo 1.20 - sysutils/xenkernel42/patches/patch-XSA-182 1.1 ------------------------------------------------------------------- Module Name: pkgsrc Committed By: bouyer Date: Tue Jul 26 15:38:00 UTC 2016 Modified Files: pkgsrc/sysutils/xenkernel42: Makefile distinfo Added Files: pkgsrc/sysutils/xenkernel42/patches: patch-XSA-182 Log Message: Apply security patch from XSA-182. Bump PKGREVISION xen 4.2 is not vulnerable to XSA-183. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 pkgsrc/sysutils/xenkernel42/Makefile cvs rdiff -u -r1.19 -r1.20 pkgsrc/sysutils/xenkernel42/distinfo cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/xenkernel42/patches/patch-XSA-182 @ text @a0 91 $NetBSD$ backported from: From 798c1498f764bfaa7b0b955bab40b01b0610d372 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Mon, 11 Jul 2016 14:32:03 +0100 Subject: [PATCH] x86/pv: Remove unsafe bits from the mod_l?_entry() fastpath All changes in writeability and cacheability must go through full re-validation. Rework the logic as a whitelist, to make it clearer to follow. This is XSA-182 --- xen/arch/x86/mm.c.orig 2016-07-26 16:33:46.000000000 +0200 +++ xen/arch/x86/mm.c 2016-07-26 16:37:14.000000000 +0200 @@@@ -1860,6 +1860,14 @@@@ _t ## e_get_intpte(_o), _t ## e_get_intpte(_n), \ (_m), (_v), (_ad)) +/* + * PTE flags that a guest may change without re-validating the PTE. + * All other bits affect translation, caching, or Xen's safety. + */ +#define FASTPATH_FLAG_WHITELIST \ + (_PAGE_NX_BIT | _PAGE_AVAIL_HIGH | _PAGE_AVAIL | _PAGE_GLOBAL | \ + _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER) + /* Update the L1 entry at pl1e to new value nl1e. */ static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e, unsigned long gl1mfn, int preserve_ad, @@@@ -1900,8 +1908,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping, r/w and presence. */ - if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings.*/ + if ( !l1e_has_changed(ol1e, nl1e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l1e(nl1e, pt_dom); if ( UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu, @@@@ -1982,11 +1990,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping and presence. */ - if ( !l2e_has_changed(ol2e, nl2e, - unlikely(opt_allow_superpage) - ? _PAGE_PSE | _PAGE_RW | _PAGE_PRESENT - : _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings. */ + if ( !l2e_has_changed(ol2e, nl2e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l2e(nl2e, d); if ( UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu, preserve_ad) ) @@@@ -2051,8 +2056,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping and presence. */ - if ( !l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings. */ + if ( !l3e_has_changed(ol3e, nl3e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l3e(nl3e, d); rc = UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, vcpu, preserve_ad); @@@@ -2121,8 +2126,8 @@@@ return -EINVAL; } - /* Fast path for identical mapping and presence. */ - if ( !l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT) ) + /* Fast path for sufficiently-similar mappings. */ + if ( !l4e_has_changed(ol4e, nl4e, ~FASTPATH_FLAG_WHITELIST) ) { adjust_guest_l4e(nl4e, d); rc = UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, vcpu, preserve_ad); --- xen/include/asm-x86/page.h.orig 2014-09-02 08:22:57.000000000 +0200 +++ xen/include/asm-x86/page.h 2016-07-26 16:39:51.000000000 +0200 @@@@ -332,6 +332,7 @@@@ #define _PAGE_AVAIL2 0x800U #define _PAGE_AVAIL 0xE00U #define _PAGE_PSE_PAT 0x1000U +#define _PAGE_AVAIL_HIGH (0x7ffU << 12) #define _PAGE_PAGED 0x2000U #define _PAGE_SHARED 0x4000U @