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-2023-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
"Misc fixes:

- Fix an UV boot crash

- Skip spurious ENDBR generation on _THIS_IP_

- Fix ENDBR use in putuser() asm methods

- Fix corner case boot crashes on 5-level paging

- and fix a false positive WARNING on LTO kernels"

* tag 'x86-urgent-2023-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/purgatory: Remove LTO flags
x86/boot/compressed: Reserve more memory for page tables
x86/ibt: Avoid duplicate ENDBR in __put_user_nocheck*()
x86/ibt: Suppress spurious ENDBR
x86/platform/uv: Use alternate source for socket to node data

+62 -25
+8
arch/x86/boot/compressed/ident_map_64.c
··· 59 59 return NULL; 60 60 } 61 61 62 + /* Consumed more tables than expected? */ 63 + if (pages->pgt_buf_offset == BOOT_PGT_SIZE_WARN) { 64 + debug_putstr("pgt_buf running low in " __FILE__ "\n"); 65 + debug_putstr("Need to raise BOOT_PGT_SIZE?\n"); 66 + debug_putaddr(pages->pgt_buf_offset); 67 + debug_putaddr(pages->pgt_buf_size); 68 + } 69 + 62 70 entry = pages->pgt_buf + pages->pgt_buf_offset; 63 71 pages->pgt_buf_offset += PAGE_SIZE; 64 72
+32 -15
arch/x86/include/asm/boot.h
··· 40 40 #ifdef CONFIG_X86_64 41 41 # define BOOT_STACK_SIZE 0x4000 42 42 43 - # define BOOT_INIT_PGT_SIZE (6*4096) 44 - # ifdef CONFIG_RANDOMIZE_BASE 45 43 /* 46 - * Assuming all cross the 512GB boundary: 47 - * 1 page for level4 48 - * (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel 49 - * 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP). 50 - * Total is 19 pages. 44 + * Used by decompressor's startup_32() to allocate page tables for identity 45 + * mapping of the 4G of RAM in 4-level paging mode: 46 + * - 1 level4 table; 47 + * - 1 level3 table; 48 + * - 4 level2 table that maps everything with 2M pages; 49 + * 50 + * The additional level5 table needed for 5-level paging is allocated from 51 + * trampoline_32bit memory. 51 52 */ 52 - # ifdef CONFIG_X86_VERBOSE_BOOTUP 53 - # define BOOT_PGT_SIZE (19*4096) 54 - # else /* !CONFIG_X86_VERBOSE_BOOTUP */ 55 - # define BOOT_PGT_SIZE (17*4096) 56 - # endif 57 - # else /* !CONFIG_RANDOMIZE_BASE */ 58 - # define BOOT_PGT_SIZE BOOT_INIT_PGT_SIZE 59 - # endif 53 + # define BOOT_INIT_PGT_SIZE (6*4096) 54 + 55 + /* 56 + * Total number of page tables kernel_add_identity_map() can allocate, 57 + * including page tables consumed by startup_32(). 58 + * 59 + * Worst-case scenario: 60 + * - 5-level paging needs 1 level5 table; 61 + * - KASLR needs to map kernel, boot_params, cmdline and randomized kernel, 62 + * assuming all of them cross 256T boundary: 63 + * + 4*2 level4 table; 64 + * + 4*2 level3 table; 65 + * + 4*2 level2 table; 66 + * - X86_VERBOSE_BOOTUP needs to map the first 2M (video RAM): 67 + * + 1 level4 table; 68 + * + 1 level3 table; 69 + * + 1 level2 table; 70 + * Total: 28 tables 71 + * 72 + * Add 4 spare table in case decompressor touches anything beyond what is 73 + * accounted above. Warn if it happens. 74 + */ 75 + # define BOOT_PGT_SIZE_WARN (28*4096) 76 + # define BOOT_PGT_SIZE (32*4096) 60 77 61 78 #else /* !CONFIG_X86_64 */ 62 79 # define BOOT_STACK_SIZE 0x1000
+8
arch/x86/include/asm/linkage.h
··· 8 8 #undef notrace 9 9 #define notrace __attribute__((no_instrument_function)) 10 10 11 + #ifdef CONFIG_64BIT 12 + /* 13 + * The generic version tends to create spurious ENDBR instructions under 14 + * certain conditions. 15 + */ 16 + #define _THIS_IP_ ({ unsigned long __here; asm ("lea 0(%%rip), %0" : "=r" (__here)); __here; }) 17 + #endif 18 + 11 19 #ifdef CONFIG_X86_32 12 20 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) 13 21 #endif /* CONFIG_X86_32 */
+5 -6
arch/x86/kernel/apic/x2apic_uv_x.c
··· 1533 1533 { 1534 1534 struct uv_gam_range_entry *gre = uv_gre_table; 1535 1535 int nums, numn, nump; 1536 - int cpu, i, lnid; 1536 + int i, lnid, apicid; 1537 1537 int minsock = _min_socket; 1538 1538 int maxsock = _max_socket; 1539 1539 int minpnode = _min_pnode; ··· 1584 1584 1585 1585 /* Set socket -> node values: */ 1586 1586 lnid = NUMA_NO_NODE; 1587 - for_each_possible_cpu(cpu) { 1588 - int nid = cpu_to_node(cpu); 1589 - int apicid, sockid; 1587 + for (apicid = 0; apicid < ARRAY_SIZE(__apicid_to_node); apicid++) { 1588 + int nid = __apicid_to_node[apicid]; 1589 + int sockid; 1590 1590 1591 - if (lnid == nid) 1591 + if ((nid == NUMA_NO_NODE) || (lnid == nid)) 1592 1592 continue; 1593 1593 lnid = nid; 1594 1594 1595 - apicid = per_cpu(x86_cpu_to_apicid, cpu); 1596 1595 sockid = apicid >> uv_cpuid.socketid_shift; 1597 1596 1598 1597 if (_socket_to_node[sockid - minsock] == SOCK_EMPTY)
-4
arch/x86/lib/putuser.S
··· 56 56 EXPORT_SYMBOL(__put_user_1) 57 57 58 58 SYM_FUNC_START(__put_user_nocheck_1) 59 - ENDBR 60 59 ASM_STAC 61 60 2: movb %al,(%_ASM_CX) 62 61 xor %ecx,%ecx ··· 75 76 EXPORT_SYMBOL(__put_user_2) 76 77 77 78 SYM_FUNC_START(__put_user_nocheck_2) 78 - ENDBR 79 79 ASM_STAC 80 80 4: movw %ax,(%_ASM_CX) 81 81 xor %ecx,%ecx ··· 94 96 EXPORT_SYMBOL(__put_user_4) 95 97 96 98 SYM_FUNC_START(__put_user_nocheck_4) 97 - ENDBR 98 99 ASM_STAC 99 100 6: movl %eax,(%_ASM_CX) 100 101 xor %ecx,%ecx ··· 116 119 EXPORT_SYMBOL(__put_user_8) 117 120 118 121 SYM_FUNC_START(__put_user_nocheck_8) 119 - ENDBR 120 122 ASM_STAC 121 123 9: mov %_ASM_AX,(%_ASM_CX) 122 124 #ifdef CONFIG_X86_32
+4
arch/x86/purgatory/Makefile
··· 19 19 # optimization flags. 20 20 KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS)) 21 21 22 + # When LTO is enabled, llvm emits many text sections, which is not supported 23 + # by kexec. Remove -flto=* flags. 24 + KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS)) 25 + 22 26 # When linking purgatory.ro with -r unresolved symbols are not checked, 23 27 # also link a purgatory.chk binary without -r to check for unresolved symbols. 24 28 PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
+5
include/linux/instruction_pointer.h
··· 2 2 #ifndef _LINUX_INSTRUCTION_POINTER_H 3 3 #define _LINUX_INSTRUCTION_POINTER_H 4 4 5 + #include <asm/linkage.h> 6 + 5 7 #define _RET_IP_ (unsigned long)__builtin_return_address(0) 8 + 9 + #ifndef _THIS_IP_ 6 10 #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 11 + #endif 7 12 8 13 #endif /* _LINUX_INSTRUCTION_POINTER_H */