Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
xen.8005
57976073-x86-remove-unsafe-bits-from-mod_lN_ent...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 57976073-x86-remove-unsafe-bits-from-mod_lN_entry-fastpath.patch of Package xen.8005
References: bsc#988675 CVE-2016-6258 XSA-182 # Commit e1bff4c2ea3b32464510ac00c320bba28a8dbcca # Date 2016-07-26 14:06:59 +0100 # Author Andrew Cooper <andrew.cooper3@citrix.com> # Committer Andrew Cooper <andrew.cooper3@citrix.com> 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 Reported-by: Jérémie Boutoille <jboutoille@ext.quarkslab.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Tim Deegan <tim@xen.org> --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1711,6 +1711,14 @@ static inline int update_intpte(intpte_t _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, @@ -1751,9 +1759,8 @@ static int mod_l1_entry(l1_pgentry_t *pl return -EINVAL; } - /* Fast path for identical mapping, r/w, presence, and cachability. */ - if ( !l1e_has_changed(ol1e, nl1e, - PAGE_CACHE_ATTRS | _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, @@ -1835,11 +1842,8 @@ static int mod_l2_entry(l2_pgentry_t *pl 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) ) @@ -1904,8 +1908,8 @@ static int mod_l3_entry(l3_pgentry_t *pl 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); @@ -1968,8 +1972,8 @@ static int mod_l4_entry(l4_pgentry_t *pl 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); --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -308,6 +308,7 @@ void efi_update_l4_pgtable(unsigned int #define _PAGE_AVAIL2 _AC(0x800,U) #define _PAGE_AVAIL _AC(0xE00,U) #define _PAGE_PSE_PAT _AC(0x1000,U) +#define _PAGE_AVAIL_HIGH (_AC(0x7ff, U) << 12) /* non-architectural flags */ #define _PAGE_PAGED 0x2000U #define _PAGE_SHARED 0x4000U
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor