]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mm: ensure L2 is always freed if empty
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 25 Nov 2024 11:03:23 +0000 (12:03 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Nov 2024 11:03:23 +0000 (12:03 +0100)
The current logic in modify_xen_mappings() allows for fully empty L2 tables to
not be freed and unhooked from the parent L3 if the last L2 slot is not
populated.

Ensure that even when an L2 slot is empty the logic to check whether the whole
L2 can be removed is not skipped.

Fixes: 4376c05c3113 ('x86-64: use 1GB pages in 1:1 mapping if available')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 41c80496084aa3601230e01c3bc579a0a6d8359a
master date: 2024-11-14 16:13:10 +0100

xen/arch/x86/mm.c

index 07631067ae004dbe16c50b656f3fd32894cc5ed5..d65cf9fa714dfe0851deccef9dbe1b87a02df288 100644 (file)
@@ -5728,7 +5728,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
             v += 1UL << L2_PAGETABLE_SHIFT;
             v &= ~((1UL << L2_PAGETABLE_SHIFT) - 1);
-            continue;
+            goto check_l3;
         }
 
         if ( l2e_get_flags(*pl2e) & _PAGE_PSE )