Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
xen.10697
59a01223-x86-check-for-alloc-errors-in-modify_x...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 59a01223-x86-check-for-alloc-errors-in-modify_xen_mappings.patch of Package xen.10697
# Commit e466ec4f51d38a2c9d02bf9f3d5e43e47db2d66b # Date 2017-08-25 14:03:47 +0200 # Author Jan Beulich <jbeulich@suse.com> # Committer Jan Beulich <jbeulich@suse.com> x86: check for allocation errors in modify_xen_mappings() Reported-by: Julien Grall <julien.grall@arm.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5802,7 +5802,7 @@ int destroy_xen_mappings(unsigned long s { l3_pgentry_t *pl3e = virt_to_xen_l3e(v); - if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) ) + if ( !pl3e || !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) ) { v += 1UL << L3_PAGETABLE_SHIFT; v &= ~((1UL << L3_PAGETABLE_SHIFT) - 1); @@ -5823,6 +5823,8 @@ int destroy_xen_mappings(unsigned long s /* PAGE1GB: shatter the superpage and fall through. */ pl2e = alloc_xen_pagetable(); + if ( !pl2e ) + return -ENOMEM; for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ ) l2e_write(pl2e + i, l2e_from_pfn(l3e_get_pfn(*pl3e) + @@ -5843,7 +5845,11 @@ int destroy_xen_mappings(unsigned long s free_xen_pagetable(pl2e); } - pl2e = virt_to_xen_l2e(v); + /* + * The L3 entry has been verified to be present, and we've dealt with + * 1G pages as well, so the L2 table cannot require allocation. + */ + pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(v); if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ) { @@ -5865,6 +5871,8 @@ int destroy_xen_mappings(unsigned long s { /* PSE: shatter the superpage and try again. */ pl1e = alloc_xen_pagetable(); + if ( !pl1e ) + return -ENOMEM; for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ ) l1e_write(&pl1e[i], l1e_from_pfn(l2e_get_pfn(*pl2e) + i, @@ -5886,7 +5894,11 @@ int destroy_xen_mappings(unsigned long s } else { - /* Ordinary 4kB mapping. */ + /* + * Ordinary 4kB mapping: The L2 entry has been verified to be + * present, and we've dealt with 2M pages as well, so the L1 table + * cannot require allocation. + */ pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(v); l1e_write_atomic(pl1e, l1e_empty()); v += PAGE_SIZE;
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