Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86/pti fixes from Thomas Gleixner:
"Three fixes related to melted spectrum:

- Sync the cpu_entry_area page table to initial_page_table on 32 bit.

Otherwise suspend/resume fails because resume uses
initial_page_table and triggers a triple fault when accessing the
cpu entry area.

- Zero the SPEC_CTL MRS on XEN before suspend to address a
shortcoming in the hypervisor.

- Fix another switch table detection issue in objtool"

* 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table
objtool: Fix another switch table detection issue
x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend

+53 -26
+1
arch/x86/include/asm/pgtable_32.h
··· 32 32 static inline void pgtable_cache_init(void) { } 33 33 static inline void check_pgt_cache(void) { } 34 34 void paging_init(void); 35 + void sync_initial_page_table(void); 35 36 36 37 /* 37 38 * Define this if things work differently on an i386 and an i486:
+1
arch/x86/include/asm/pgtable_64.h
··· 28 28 #define swapper_pg_dir init_top_pgt 29 29 30 30 extern void paging_init(void); 31 + static inline void sync_initial_page_table(void) { } 31 32 32 33 #define pte_ERROR(e) \ 33 34 pr_err("%s:%d: bad pte %p(%016lx)\n", \
+5 -12
arch/x86/kernel/setup.c
··· 1204 1204 1205 1205 kasan_init(); 1206 1206 1207 - #ifdef CONFIG_X86_32 1208 - /* sync back kernel address range */ 1209 - clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, 1210 - swapper_pg_dir + KERNEL_PGD_BOUNDARY, 1211 - KERNEL_PGD_PTRS); 1212 - 1213 1207 /* 1214 - * sync back low identity map too. It is used for example 1215 - * in the 32-bit EFI stub. 1208 + * Sync back kernel address range. 1209 + * 1210 + * FIXME: Can the later sync in setup_cpu_entry_areas() replace 1211 + * this call? 1216 1212 */ 1217 - clone_pgd_range(initial_page_table, 1218 - swapper_pg_dir + KERNEL_PGD_BOUNDARY, 1219 - min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); 1220 - #endif 1213 + sync_initial_page_table(); 1221 1214 1222 1215 tboot_probe(); 1223 1216
+4 -13
arch/x86/kernel/setup_percpu.c
··· 287 287 /* Setup cpu initialized, callin, callout masks */ 288 288 setup_cpu_local_masks(); 289 289 290 - #ifdef CONFIG_X86_32 291 290 /* 292 291 * Sync back kernel address range again. We already did this in 293 292 * setup_arch(), but percpu data also needs to be available in 294 293 * the smpboot asm. We can't reliably pick up percpu mappings 295 294 * using vmalloc_fault(), because exception dispatch needs 296 295 * percpu data. 296 + * 297 + * FIXME: Can the later sync in setup_cpu_entry_areas() replace 298 + * this call? 297 299 */ 298 - clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, 299 - swapper_pg_dir + KERNEL_PGD_BOUNDARY, 300 - KERNEL_PGD_PTRS); 301 - 302 - /* 303 - * sync back low identity map too. It is used for example 304 - * in the 32-bit EFI stub. 305 - */ 306 - clone_pgd_range(initial_page_table, 307 - swapper_pg_dir + KERNEL_PGD_BOUNDARY, 308 - min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); 309 - #endif 300 + sync_initial_page_table(); 310 301 }
+6
arch/x86/mm/cpu_entry_area.c
··· 163 163 164 164 for_each_possible_cpu(cpu) 165 165 setup_cpu_entry_area(cpu); 166 + 167 + /* 168 + * This is the last essential update to swapper_pgdir which needs 169 + * to be synchronized to initial_page_table on 32bit. 170 + */ 171 + sync_initial_page_table(); 166 172 }
+15
arch/x86/mm/init_32.c
··· 453 453 } 454 454 #endif /* CONFIG_HIGHMEM */ 455 455 456 + void __init sync_initial_page_table(void) 457 + { 458 + clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, 459 + swapper_pg_dir + KERNEL_PGD_BOUNDARY, 460 + KERNEL_PGD_PTRS); 461 + 462 + /* 463 + * sync back low identity map too. It is used for example 464 + * in the 32-bit EFI stub. 465 + */ 466 + clone_pgd_range(initial_page_table, 467 + swapper_pg_dir + KERNEL_PGD_BOUNDARY, 468 + min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); 469 + } 470 + 456 471 void __init native_pagetable_init(void) 457 472 { 458 473 unsigned long pfn, va;
+16
arch/x86/xen/suspend.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/types.h> 3 3 #include <linux/tick.h> 4 + #include <linux/percpu-defs.h> 4 5 5 6 #include <xen/xen.h> 6 7 #include <xen/interface/xen.h> 7 8 #include <xen/grant_table.h> 8 9 #include <xen/events.h> 9 10 11 + #include <asm/cpufeatures.h> 12 + #include <asm/msr-index.h> 10 13 #include <asm/xen/hypercall.h> 11 14 #include <asm/xen/page.h> 12 15 #include <asm/fixmap.h> ··· 17 14 #include "xen-ops.h" 18 15 #include "mmu.h" 19 16 #include "pmu.h" 17 + 18 + static DEFINE_PER_CPU(u64, spec_ctrl); 20 19 21 20 void xen_arch_pre_suspend(void) 22 21 { ··· 40 35 41 36 static void xen_vcpu_notify_restore(void *data) 42 37 { 38 + if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) 39 + wrmsrl(MSR_IA32_SPEC_CTRL, this_cpu_read(spec_ctrl)); 40 + 43 41 /* Boot processor notified via generic timekeeping_resume() */ 44 42 if (smp_processor_id() == 0) 45 43 return; ··· 52 44 53 45 static void xen_vcpu_notify_suspend(void *data) 54 46 { 47 + u64 tmp; 48 + 55 49 tick_suspend_local(); 50 + 51 + if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) { 52 + rdmsrl(MSR_IA32_SPEC_CTRL, tmp); 53 + this_cpu_write(spec_ctrl, tmp); 54 + wrmsrl(MSR_IA32_SPEC_CTRL, 0); 55 + } 56 56 } 57 57 58 58 void xen_arch_resume(void)
+5 -1
tools/objtool/check.c
··· 925 925 if (find_symbol_containing(file->rodata, text_rela->addend)) 926 926 continue; 927 927 928 - return find_rela_by_dest(file->rodata, text_rela->addend); 928 + rodata_rela = find_rela_by_dest(file->rodata, text_rela->addend); 929 + if (!rodata_rela) 930 + continue; 931 + 932 + return rodata_rela; 929 933 } 930 934 931 935 return NULL;