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

Merge tag 'x86_urgent_for_v5.18_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

- A fix to disable PCI/MSI[-X] masking for XEN_HVM guests as that is
solely controlled by the hypervisor

- A build fix to make the function prototype (__warn()) as visible as
the definition itself

- A bunch of objtool annotation fixes which have accumulated over time

- An ORC unwinder fix to handle bad input gracefully

- Well, we thought the microcode gets loaded in time in order to
restore the microcode-emulated MSRs but we thought wrong. So there's
a fix for that to have the ordering done properly

- Add new Intel model numbers

- A spelling fix

* tag 'x86_urgent_for_v5.18_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests
bug: Have __warn() prototype defined unconditionally
x86/Kconfig: fix the spelling of 'becoming' in X86_KERNEL_IBT config
objtool: Use offstr() to print address of missing ENDBR
objtool: Print data address for "!ENDBR" data warnings
x86/xen: Add ANNOTATE_NOENDBR to startup_xen()
x86/uaccess: Add ENDBR to __put_user_nocheck*()
x86/retpoline: Add ANNOTATE_NOENDBR for retpolines
x86/static_call: Add ANNOTATE_NOENDBR to static call trampoline
objtool: Enable unreachable warnings for CLANG LTO
x86,objtool: Explicitly mark idtentry_body()s tail REACHABLE
x86,objtool: Mark cpu_startup_entry() __noreturn
x86,xen,objtool: Add UNWIND hint
lib/strn*,objtool: Enforce user_access_begin() rules
MAINTAINERS: Add x86 unwinding entry
x86/unwind/orc: Recheck address range after stack info was updated
x86/cpu: Load microcode during restore_processor_state()
x86/cpu: Add new Alderlake and Raptorlake CPU model numbers

+63 -29
+9
MAINTAINERS
··· 21443 21443 F: arch/x86/kernel/apic/x2apic_uv_x.c 21444 21444 F: arch/x86/platform/uv/ 21445 21445 21446 + X86 STACK UNWINDING 21447 + M: Josh Poimboeuf <jpoimboe@redhat.com> 21448 + M: Peter Zijlstra <peterz@infradead.org> 21449 + S: Supported 21450 + F: arch/x86/include/asm/unwind*.h 21451 + F: arch/x86/kernel/dumpstack.c 21452 + F: arch/x86/kernel/stacktrace.c 21453 + F: arch/x86/kernel/unwind_*.c 21454 + 21446 21455 X86 VDSO 21447 21456 M: Andy Lutomirski <luto@kernel.org> 21448 21457 L: linux-kernel@vger.kernel.org
+1 -1
arch/x86/Kconfig
··· 1866 1866 code with them to make this happen. 1867 1867 1868 1868 In addition to building the kernel with IBT, seal all functions that 1869 - are not indirect call targets, avoiding them ever becomming one. 1869 + are not indirect call targets, avoiding them ever becoming one. 1870 1870 1871 1871 This requires LTO like objtool runs and will slow down the build. It 1872 1872 does significantly reduce the number of ENDBR instructions in the
+3
arch/x86/entry/entry_64.S
··· 337 337 338 338 call \cfunc 339 339 340 + /* For some configurations \cfunc ends up being a noreturn. */ 341 + REACHABLE 342 + 340 343 jmp error_return 341 344 .endm 342 345
+3
arch/x86/include/asm/intel-family.h
··· 26 26 * _G - parts with extra graphics on 27 27 * _X - regular server parts 28 28 * _D - micro server parts 29 + * _N,_P - other mobile parts 29 30 * 30 31 * Historical OPTDIFFs: 31 32 * ··· 108 107 109 108 #define INTEL_FAM6_ALDERLAKE 0x97 /* Golden Cove / Gracemont */ 110 109 #define INTEL_FAM6_ALDERLAKE_L 0x9A /* Golden Cove / Gracemont */ 110 + #define INTEL_FAM6_ALDERLAKE_N 0xBE 111 111 112 112 #define INTEL_FAM6_RAPTORLAKE 0xB7 113 + #define INTEL_FAM6_RAPTORLAKE_P 0xBA 113 114 114 115 /* "Small Core" Processors (Atom) */ 115 116
+2
arch/x86/include/asm/microcode.h
··· 131 131 extern void load_ucode_ap(void); 132 132 void reload_early_microcode(void); 133 133 extern bool initrd_gone; 134 + void microcode_bsp_resume(void); 134 135 #else 135 136 static inline void __init load_ucode_bsp(void) { } 136 137 static inline void load_ucode_ap(void) { } 137 138 static inline void reload_early_microcode(void) { } 139 + static inline void microcode_bsp_resume(void) { } 138 140 #endif 139 141 140 142 #endif /* _ASM_X86_MICROCODE_H */
+1
arch/x86/include/asm/static_call.h
··· 26 26 ".align 4 \n" \ 27 27 ".globl " STATIC_CALL_TRAMP_STR(name) " \n" \ 28 28 STATIC_CALL_TRAMP_STR(name) ": \n" \ 29 + ANNOTATE_NOENDBR \ 29 30 insns " \n" \ 30 31 ".byte 0x53, 0x43, 0x54 \n" \ 31 32 ".type " STATIC_CALL_TRAMP_STR(name) ", @function \n" \
+3 -3
arch/x86/kernel/cpu/microcode/core.c
··· 758 758 }; 759 759 760 760 /** 761 - * mc_bp_resume - Update boot CPU microcode during resume. 761 + * microcode_bsp_resume - Update boot CPU microcode during resume. 762 762 */ 763 - static void mc_bp_resume(void) 763 + void microcode_bsp_resume(void) 764 764 { 765 765 int cpu = smp_processor_id(); 766 766 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ··· 772 772 } 773 773 774 774 static struct syscore_ops mc_syscore_ops = { 775 - .resume = mc_bp_resume, 775 + .resume = microcode_bsp_resume, 776 776 }; 777 777 778 778 static int mc_cpu_starting(unsigned int cpu)
+4 -4
arch/x86/kernel/unwind_orc.c
··· 339 339 struct stack_info *info = &state->stack_info; 340 340 void *addr = (void *)_addr; 341 341 342 - if (!on_stack(info, addr, len) && 343 - (get_stack_info(addr, state->task, info, &state->stack_mask))) 344 - return false; 342 + if (on_stack(info, addr, len)) 343 + return true; 345 344 346 - return true; 345 + return !get_stack_info(addr, state->task, info, &state->stack_mask) && 346 + on_stack(info, addr, len); 347 347 } 348 348 349 349 static bool deref_stack_reg(struct unwind_state *state, unsigned long addr,
+4
arch/x86/lib/putuser.S
··· 48 48 cmp %_ASM_BX,%_ASM_CX 49 49 jae .Lbad_put_user 50 50 SYM_INNER_LABEL(__put_user_nocheck_1, SYM_L_GLOBAL) 51 + ENDBR 51 52 ASM_STAC 52 53 1: movb %al,(%_ASM_CX) 53 54 xor %ecx,%ecx ··· 63 62 cmp %_ASM_BX,%_ASM_CX 64 63 jae .Lbad_put_user 65 64 SYM_INNER_LABEL(__put_user_nocheck_2, SYM_L_GLOBAL) 65 + ENDBR 66 66 ASM_STAC 67 67 2: movw %ax,(%_ASM_CX) 68 68 xor %ecx,%ecx ··· 78 76 cmp %_ASM_BX,%_ASM_CX 79 77 jae .Lbad_put_user 80 78 SYM_INNER_LABEL(__put_user_nocheck_4, SYM_L_GLOBAL) 79 + ENDBR 81 80 ASM_STAC 82 81 3: movl %eax,(%_ASM_CX) 83 82 xor %ecx,%ecx ··· 93 90 cmp %_ASM_BX,%_ASM_CX 94 91 jae .Lbad_put_user 95 92 SYM_INNER_LABEL(__put_user_nocheck_8, SYM_L_GLOBAL) 93 + ENDBR 96 94 ASM_STAC 97 95 4: mov %_ASM_AX,(%_ASM_CX) 98 96 #ifdef CONFIG_X86_32
+1 -1
arch/x86/lib/retpoline.S
··· 31 31 .align RETPOLINE_THUNK_SIZE 32 32 SYM_INNER_LABEL(__x86_indirect_thunk_\reg, SYM_L_GLOBAL) 33 33 UNWIND_HINT_EMPTY 34 + ANNOTATE_NOENDBR 34 35 35 36 ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), \ 36 37 __stringify(RETPOLINE \reg), X86_FEATURE_RETPOLINE, \ ··· 56 55 57 56 .align RETPOLINE_THUNK_SIZE 58 57 SYM_CODE_START(__x86_indirect_thunk_array) 59 - ANNOTATE_NOENDBR // apply_retpolines 60 58 61 59 #define GEN(reg) THUNK reg 62 60 #include <asm/GEN-for-each-reg.h>
+5 -1
arch/x86/pci/xen.c
··· 467 467 else 468 468 xen_msi_ops.setup_msi_irqs = xen_setup_msi_irqs; 469 469 xen_msi_ops.teardown_msi_irqs = xen_pv_teardown_msi_irqs; 470 - pci_msi_ignore_mask = 1; 471 470 } else if (xen_hvm_domain()) { 472 471 xen_msi_ops.setup_msi_irqs = xen_hvm_setup_msi_irqs; 473 472 xen_msi_ops.teardown_msi_irqs = xen_teardown_msi_irqs; ··· 480 481 * in allocating the native domain and never use it. 481 482 */ 482 483 x86_init.irqs.create_pci_msi_domain = xen_create_pci_msi_domain; 484 + /* 485 + * With XEN PIRQ/Eventchannels in use PCI/MSI[-X] masking is solely 486 + * controlled by the hypervisor. 487 + */ 488 + pci_msi_ignore_mask = 1; 483 489 } 484 490 485 491 #else /* CONFIG_PCI_MSI */
+1
arch/x86/platform/pvh/head.S
··· 50 50 #define PVH_DS_SEL (PVH_GDT_ENTRY_DS * 8) 51 51 52 52 SYM_CODE_START_LOCAL(pvh_start_xen) 53 + UNWIND_HINT_EMPTY 53 54 cld 54 55 55 56 lgdt (_pa(gdt))
+9 -1
arch/x86/power/cpu.c
··· 25 25 #include <asm/cpu.h> 26 26 #include <asm/mmu_context.h> 27 27 #include <asm/cpu_device_id.h> 28 + #include <asm/microcode.h> 28 29 29 30 #ifdef CONFIG_X86_32 30 31 __visible unsigned long saved_context_ebx; ··· 263 262 x86_platform.restore_sched_clock_state(); 264 263 mtrr_bp_restore(); 265 264 perf_restore_debug_store(); 266 - msr_restore_context(ctxt); 267 265 268 266 c = &cpu_data(smp_processor_id()); 269 267 if (cpu_has(c, X86_FEATURE_MSR_IA32_FEAT_CTL)) 270 268 init_ia32_feat_ctl(c); 269 + 270 + microcode_bsp_resume(); 271 + 272 + /* 273 + * This needs to happen after the microcode has been updated upon resume 274 + * because some of the MSRs are "emulated" in microcode. 275 + */ 276 + msr_restore_context(ctxt); 271 277 } 272 278 273 279 /* Needed by apm.c */
+1
arch/x86/xen/xen-head.S
··· 45 45 __INIT 46 46 SYM_CODE_START(startup_xen) 47 47 UNWIND_HINT_EMPTY 48 + ANNOTATE_NOENDBR 48 49 cld 49 50 50 51 /* Clear .bss */
+6 -5
include/asm-generic/bug.h
··· 21 21 #include <linux/panic.h> 22 22 #include <linux/printk.h> 23 23 24 + struct warn_args; 25 + struct pt_regs; 26 + 27 + void __warn(const char *file, int line, void *caller, unsigned taint, 28 + struct pt_regs *regs, struct warn_args *args); 29 + 24 30 #ifdef CONFIG_BUG 25 31 26 32 #ifdef CONFIG_GENERIC_BUG ··· 116 110 #endif 117 111 118 112 /* used internally by panic.c */ 119 - struct warn_args; 120 - struct pt_regs; 121 - 122 - void __warn(const char *file, int line, void *caller, unsigned taint, 123 - struct pt_regs *regs, struct warn_args *args); 124 113 125 114 #ifndef WARN_ON 126 115 #define WARN_ON(condition) ({ \
+1 -1
include/linux/cpu.h
··· 167 167 static inline void suspend_enable_secondary_cpus(void) { } 168 168 #endif /* !CONFIG_PM_SLEEP_SMP */ 169 169 170 - void cpu_startup_entry(enum cpuhp_state state); 170 + void __noreturn cpu_startup_entry(enum cpuhp_state state); 171 171 172 172 void cpu_idle_poll_ctrl(bool enable); 173 173
+1 -1
lib/strncpy_from_user.c
··· 25 25 * hit it), 'max' is the address space maximum (and we return 26 26 * -EFAULT if we hit it). 27 27 */ 28 - static inline long do_strncpy_from_user(char *dst, const char __user *src, 28 + static __always_inline long do_strncpy_from_user(char *dst, const char __user *src, 29 29 unsigned long count, unsigned long max) 30 30 { 31 31 const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
+1 -1
lib/strnlen_user.c
··· 20 20 * if it fits in a aligned 'long'. The caller needs to check 21 21 * the return value against "> max". 22 22 */ 23 - static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max) 23 + static __always_inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max) 24 24 { 25 25 const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; 26 26 unsigned long align, res = 0;
+1 -1
scripts/Makefile.build
··· 231 231 $(if $(part-of-module), --module) \ 232 232 $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt) \ 233 233 $(if $(CONFIG_FRAME_POINTER),, --no-fp) \ 234 - $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\ 234 + $(if $(CONFIG_GCOV_KERNEL), --no-unreachable) \ 235 235 $(if $(CONFIG_RETPOLINE), --retpoline) \ 236 236 $(if $(CONFIG_X86_SMAP), --uaccess) \ 237 237 $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \
+5 -8
tools/objtool/check.c
··· 184 184 "do_group_exit", 185 185 "stop_this_cpu", 186 186 "__invalid_creds", 187 + "cpu_startup_entry", 187 188 }; 188 189 189 190 if (!func) ··· 3218 3217 static void warn_noendbr(const char *msg, struct section *sec, unsigned long offset, 3219 3218 struct instruction *dest) 3220 3219 { 3221 - WARN_FUNC("%srelocation to !ENDBR: %s+0x%lx", sec, offset, msg, 3222 - dest->func ? dest->func->name : dest->sec->name, 3223 - dest->func ? dest->offset - dest->func->offset : dest->offset); 3220 + WARN_FUNC("%srelocation to !ENDBR: %s", sec, offset, msg, 3221 + offstr(dest->sec, dest->offset)); 3224 3222 } 3225 3223 3226 3224 static void validate_ibt_dest(struct objtool_file *file, struct instruction *insn, ··· 3823 3823 struct instruction *dest; 3824 3824 3825 3825 dest = validate_ibt_reloc(file, reloc); 3826 - if (is_data && dest && !dest->noendbr) { 3827 - warn_noendbr("data ", reloc->sym->sec, 3828 - reloc->sym->offset + reloc->addend, 3829 - dest); 3830 - } 3826 + if (is_data && dest && !dest->noendbr) 3827 + warn_noendbr("data ", sec, reloc->offset, dest); 3831 3828 } 3832 3829 } 3833 3830