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 tag 'x86-urgent-2025-04-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull misc x86 fixes from Ingo Molnar:

- Fix 32-bit kernel boot crash if passed physical memory with more than
32 address bits

- Fix Xen PV crash

- Work around build bug in certain limited build environments

- Fix CTEST instruction decoding in insn_decoder_test

* tag 'x86-urgent-2025-04-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/insn: Fix CTEST instruction decoding
x86/boot: Work around broken busybox 'truncate' tool
x86/mm: Fix _pgd_alloc() for Xen PV mode
x86/e820: Discard high memory that can't be addressed by 32-bit systems

+30 -19
+1 -1
arch/x86/boot/Makefile
··· 59 59 $(obj)/bzImage: asflags-y := $(SVGA_MODE) 60 60 61 61 quiet_cmd_image = BUILD $@ 62 - cmd_image = cp $< $@; truncate -s %4K $@; cat $(obj)/vmlinux.bin >>$@ 62 + cmd_image = (dd if=$< bs=4k conv=sync status=none; cat $(filter-out $<,$(real-prereqs))) >$@ 63 63 64 64 $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin FORCE 65 65 $(call if_changed,image)
+11 -8
arch/x86/include/asm/pgalloc.h
··· 6 6 #include <linux/mm.h> /* for struct page */ 7 7 #include <linux/pagemap.h> 8 8 9 + #include <asm/cpufeature.h> 10 + 9 11 #define __HAVE_ARCH_PTE_ALLOC_ONE 10 12 #define __HAVE_ARCH_PGD_FREE 11 13 #include <asm-generic/pgalloc.h> ··· 31 29 static inline void paravirt_release_p4d(unsigned long pfn) {} 32 30 #endif 33 31 34 - #ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION 35 32 /* 36 - * Instead of one PGD, we acquire two PGDs. Being order-1, it is 37 - * both 8k in size and 8k-aligned. That lets us just flip bit 12 38 - * in a pointer to swap between the two 4k halves. 33 + * In case of Page Table Isolation active, we acquire two PGDs instead of one. 34 + * Being order-1, it is both 8k in size and 8k-aligned. That lets us just 35 + * flip bit 12 in a pointer to swap between the two 4k halves. 39 36 */ 40 - #define PGD_ALLOCATION_ORDER 1 41 - #else 42 - #define PGD_ALLOCATION_ORDER 0 43 - #endif 37 + static inline unsigned int pgd_allocation_order(void) 38 + { 39 + if (cpu_feature_enabled(X86_FEATURE_PTI)) 40 + return 1; 41 + return 0; 42 + } 44 43 45 44 /* 46 45 * Allocate and free page tables.
+8
arch/x86/kernel/e820.c
··· 1299 1299 memblock_add(entry->addr, entry->size); 1300 1300 } 1301 1301 1302 + /* 1303 + * 32-bit systems are limited to 4BG of memory even with HIGHMEM and 1304 + * to even less without it. 1305 + * Discard memory after max_pfn - the actual limit detected at runtime. 1306 + */ 1307 + if (IS_ENABLED(CONFIG_X86_32)) 1308 + memblock_remove(PFN_PHYS(max_pfn), -1); 1309 + 1302 1310 /* Throw away partial pages: */ 1303 1311 memblock_trim_memory(PAGE_SIZE); 1304 1312
+2 -2
arch/x86/kernel/machine_kexec_32.c
··· 42 42 43 43 static void machine_kexec_free_page_tables(struct kimage *image) 44 44 { 45 - free_pages((unsigned long)image->arch.pgd, PGD_ALLOCATION_ORDER); 45 + free_pages((unsigned long)image->arch.pgd, pgd_allocation_order()); 46 46 image->arch.pgd = NULL; 47 47 #ifdef CONFIG_X86_PAE 48 48 free_page((unsigned long)image->arch.pmd0); ··· 59 59 static int machine_kexec_alloc_page_tables(struct kimage *image) 60 60 { 61 61 image->arch.pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 62 - PGD_ALLOCATION_ORDER); 62 + pgd_allocation_order()); 63 63 #ifdef CONFIG_X86_PAE 64 64 image->arch.pmd0 = (pmd_t *)get_zeroed_page(GFP_KERNEL); 65 65 image->arch.pmd1 = (pmd_t *)get_zeroed_page(GFP_KERNEL);
+2 -2
arch/x86/lib/x86-opcode-map.txt
··· 996 996 83: Grp1 Ev,Ib (1A),(es) 997 997 # CTESTSCC instructions are: CTESTB, CTESTBE, CTESTF, CTESTL, CTESTLE, CTESTNB, CTESTNBE, CTESTNL, 998 998 # CTESTNLE, CTESTNO, CTESTNS, CTESTNZ, CTESTO, CTESTS, CTESTT, CTESTZ 999 - 84: CTESTSCC (ev) 1000 - 85: CTESTSCC (es) | CTESTSCC (66),(es) 999 + 84: CTESTSCC Eb,Gb (ev) 1000 + 85: CTESTSCC Ev,Gv (es) | CTESTSCC Ev,Gv (66),(es) 1001 1001 88: POPCNT Gv,Ev (es) | POPCNT Gv,Ev (66),(es) 1002 1002 8f: POP2 Bq,Rq (000),(11B),(ev) 1003 1003 a5: SHLD Ev,Gv,CL (es) | SHLD Ev,Gv,CL (66),(es)
+2 -2
arch/x86/mm/pgtable.c
··· 360 360 * We allocate one page for pgd. 361 361 */ 362 362 if (!SHARED_KERNEL_PMD) 363 - return __pgd_alloc(mm, PGD_ALLOCATION_ORDER); 363 + return __pgd_alloc(mm, pgd_allocation_order()); 364 364 365 365 /* 366 366 * Now PAE kernel is not running as a Xen domain. We can allocate ··· 380 380 381 381 static inline pgd_t *_pgd_alloc(struct mm_struct *mm) 382 382 { 383 - return __pgd_alloc(mm, PGD_ALLOCATION_ORDER); 383 + return __pgd_alloc(mm, pgd_allocation_order()); 384 384 } 385 385 386 386 static inline void _pgd_free(struct mm_struct *mm, pgd_t *pgd)
+2 -2
arch/x86/platform/efi/efi_64.c
··· 73 73 gfp_t gfp_mask; 74 74 75 75 gfp_mask = GFP_KERNEL | __GFP_ZERO; 76 - efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, PGD_ALLOCATION_ORDER); 76 + efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, pgd_allocation_order()); 77 77 if (!efi_pgd) 78 78 goto fail; 79 79 ··· 96 96 if (pgtable_l5_enabled()) 97 97 free_page((unsigned long)pgd_page_vaddr(*pgd)); 98 98 free_pgd: 99 - free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER); 99 + free_pages((unsigned long)efi_pgd, pgd_allocation_order()); 100 100 fail: 101 101 return -ENOMEM; 102 102 }
+2 -2
tools/arch/x86/lib/x86-opcode-map.txt
··· 996 996 83: Grp1 Ev,Ib (1A),(es) 997 997 # CTESTSCC instructions are: CTESTB, CTESTBE, CTESTF, CTESTL, CTESTLE, CTESTNB, CTESTNBE, CTESTNL, 998 998 # CTESTNLE, CTESTNO, CTESTNS, CTESTNZ, CTESTO, CTESTS, CTESTT, CTESTZ 999 - 84: CTESTSCC (ev) 1000 - 85: CTESTSCC (es) | CTESTSCC (66),(es) 999 + 84: CTESTSCC Eb,Gb (ev) 1000 + 85: CTESTSCC Ev,Gv (es) | CTESTSCC Ev,Gv (66),(es) 1001 1001 88: POPCNT Gv,Ev (es) | POPCNT Gv,Ev (66),(es) 1002 1002 8f: POP2 Bq,Rq (000),(11B),(ev) 1003 1003 a5: SHLD Ev,Gv,CL (es) | SHLD Ev,Gv,CL (66),(es)