History

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

Linus Torvalds committed 4 years ago

Commit b2da7df2 parents b70ed23 7e0815b21 files · +63 −29Browse files

Unified · Split

21 files
  1. MAINTAINERS +9 −0
  2. arch/x86/Kconfig +1 −1
  3. arch/x86/entry/entry_64.S +3 −0
  4. arch/x86/include/asm/intel-family.h +3 −0
  5. arch/x86/include/asm/microcode.h +2 −0
  6. arch/x86/include/asm/static_call.h +1 −0
  7. arch/x86/kernel/cpu/microcode/core.c +3 −3
  8. arch/x86/kernel/unwind_orc.c +4 −4
  9. arch/x86/lib/putuser.S +4 −0
  10. arch/x86/lib/retpoline.S +1 −1
  11. arch/x86/pci/xen.c +5 −1
  12. arch/x86/platform/pvh/head.S +1 −0
  13. arch/x86/power/cpu.c +9 −1
  14. arch/x86/xen/xen-head.S +1 −0
  15. include/asm-generic/bug.h +6 −5
  16. include/linux/cpu.h +1 −1
  17. lib/strncpy_from_user.c +1 −1
  18. lib/strnlen_user.c +1 −1
  19. scripts/Makefile.build +1 −1
  20. scripts/link-vmlinux.sh +1 −1
  21. tools/objtool/check.c +5 −8
MAINTAINERS+9−0
@@ -21443,6 +21443,15 @@ F: arch/x86/include/asm/uv/ · 21442 unmodified lines
2144321443 F: arch/x86/kernel/apic/x2apic_uv_x.c
2144421444 F: arch/x86/platform/uv/
2144521445
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+
2144621455 X86 VDSO
2144721456 M: Andy Lutomirski <luto@kernel.org>
2144821457 L: linux-kernel@vger.kernel.org
arch/x86/Kconfig+1−1
@@ -1866,7 +1866,7 @@ config X86_KERNEL_IBT · 1865 unmodified lines
18661866 code with them to make this happen.
18671867
18681868 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.
18701870
18711871 This requires LTO like objtool runs and will slow down the build. It
18721872 does significantly reduce the number of ENDBR instructions in the
arch/x86/entry/entry_64.S+3−0
@@ -337,6 +337,9 @@ SYM_CODE_END(ret_from_fork) · 336 unmodified lines
337337
338338 call \cfunc
339339
340+ /* For some configurations \cfunc ends up being a noreturn. */
341+ REACHABLE
342+
340343 jmp error_return
341344 .endm
342345
arch/x86/include/asm/intel-family.h+3−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 * _G - parts with extra graphics on
2727 * _X - regular server parts
2828 * _D - micro server parts
29+ * _N,_P - other mobile parts
2930 *
3031 * Historical OPTDIFFs:
3132 *
@@ -107,8 +108,10 @@ · 75 unmodified lines
107108
108109 #define INTEL_FAM6_ALDERLAKE 0x97 /* Golden Cove / Gracemont */
109110 #define INTEL_FAM6_ALDERLAKE_L 0x9A /* Golden Cove / Gracemont */
111+#define INTEL_FAM6_ALDERLAKE_N 0xBE
110112
111113 #define INTEL_FAM6_RAPTORLAKE 0xB7
114+#define INTEL_FAM6_RAPTORLAKE_P 0xBA
112115
113116 /* "Small Core" Processors (Atom) */
114117
arch/x86/include/asm/microcode.h+2−0
@@ -131,10 +131,12 @@ extern void __init load_ucode_bsp(void); · 130 unmodified lines
131131 extern void load_ucode_ap(void);
132132 void reload_early_microcode(void);
133133 extern bool initrd_gone;
134+void microcode_bsp_resume(void);
134135 #else
135136 static inline void __init load_ucode_bsp(void) { }
136137 static inline void load_ucode_ap(void) { }
137138 static inline void reload_early_microcode(void) { }
139+static inline void microcode_bsp_resume(void) { }
138140 #endif
139141
140142 #endif /* _ASM_X86_MICROCODE_H */
arch/x86/include/asm/static_call.h+1−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 ".align 4 \n" \
2727 ".globl " STATIC_CALL_TRAMP_STR(name) " \n" \
2828 STATIC_CALL_TRAMP_STR(name) ": \n" \
29+ ANNOTATE_NOENDBR \
2930 insns " \n" \
3031 ".byte 0x53, 0x43, 0x54 \n" \
3132 ".type " STATIC_CALL_TRAMP_STR(name) ", @function \n" \
arch/x86/kernel/cpu/microcode/core.c+3−3
@@ -758,9 +758,9 @@ static struct subsys_interface mc_cpu_interface = { · 757 unmodified lines
758758 };
759759
760760 /**
761− * mc_bp_resume - Update boot CPU microcode during resume.
761+ * microcode_bsp_resume - Update boot CPU microcode during resume.
762762 */
763−static void mc_bp_resume(void)
763+void microcode_bsp_resume(void)
764764 {
765765 int cpu = smp_processor_id();
766766 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
@@ -772,7 +772,7 @@ static void mc_bp_resume(void) · 5 unmodified lines
772772 }
773773
774774 static struct syscore_ops mc_syscore_ops = {
775− .resume = mc_bp_resume,
775+ .resume = microcode_bsp_resume,
776776 };
777777
778778 static int mc_cpu_starting(unsigned int cpu)
arch/x86/kernel/unwind_orc.c+4−4
@@ -339,11 +339,11 @@ static bool stack_access_ok(struct unwind_state *state, unsigned long _addr, · 338 unmodified lines
339339 struct stack_info *info = &state->stack_info;
340340 void *addr = (void *)_addr;
341341
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;
345344
346− return true;
345+ return !get_stack_info(addr, state->task, info, &state->stack_mask) &&
346+ on_stack(info, addr, len);
347347 }
348348
349349 static bool deref_stack_reg(struct unwind_state *state, unsigned long addr,
arch/x86/lib/putuser.S+4−0
@@ -48,6 +48,7 @@ SYM_FUNC_START(__put_user_1) · 47 unmodified lines
4848 cmp %_ASM_BX,%_ASM_CX
4949 jae .Lbad_put_user
5050 SYM_INNER_LABEL(__put_user_nocheck_1, SYM_L_GLOBAL)
51+ ENDBR
5152 ASM_STAC
5253 1: movb %al,(%_ASM_CX)
5354 xor %ecx,%ecx
@@ -62,6 +63,7 @@ SYM_FUNC_START(__put_user_2) · 8 unmodified lines
6263 cmp %_ASM_BX,%_ASM_CX
6364 jae .Lbad_put_user
6465 SYM_INNER_LABEL(__put_user_nocheck_2, SYM_L_GLOBAL)
66+ ENDBR
6567 ASM_STAC
6668 2: movw %ax,(%_ASM_CX)
6769 xor %ecx,%ecx
@@ -76,6 +78,7 @@ SYM_FUNC_START(__put_user_4) · 8 unmodified lines
7678 cmp %_ASM_BX,%_ASM_CX
7779 jae .Lbad_put_user
7880 SYM_INNER_LABEL(__put_user_nocheck_4, SYM_L_GLOBAL)
81+ ENDBR
7982 ASM_STAC
8083 3: movl %eax,(%_ASM_CX)
8184 xor %ecx,%ecx
@@ -90,6 +93,7 @@ SYM_FUNC_START(__put_user_8) · 8 unmodified lines
9093 cmp %_ASM_BX,%_ASM_CX
9194 jae .Lbad_put_user
9295 SYM_INNER_LABEL(__put_user_nocheck_8, SYM_L_GLOBAL)
96+ ENDBR
9397 ASM_STAC
9498 4: mov %_ASM_AX,(%_ASM_CX)
9599 #ifdef CONFIG_X86_32
arch/x86/lib/retpoline.S+1−1
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 .align RETPOLINE_THUNK_SIZE
3232 SYM_INNER_LABEL(__x86_indirect_thunk_\reg, SYM_L_GLOBAL)
3333 UNWIND_HINT_EMPTY
34+ ANNOTATE_NOENDBR
3435
3536 ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), \
3637 __stringify(RETPOLINE \reg), X86_FEATURE_RETPOLINE, \
@@ -55,7 +56,6 @@ SYM_INNER_LABEL(__x86_indirect_thunk_\reg, SYM_L_GLOBAL) · 18 unmodified lines
5556
5657 .align RETPOLINE_THUNK_SIZE
5758 SYM_CODE_START(__x86_indirect_thunk_array)
58− ANNOTATE_NOENDBR // apply_retpolines
5959
6060 #define GEN(reg) THUNK reg
6161 #include <asm/GEN-for-each-reg.h>
arch/x86/pci/xen.c+5−1
@@ -467,7 +467,6 @@ static __init void xen_setup_pci_msi(void) · 466 unmodified lines
467467 else
468468 xen_msi_ops.setup_msi_irqs = xen_setup_msi_irqs;
469469 xen_msi_ops.teardown_msi_irqs = xen_pv_teardown_msi_irqs;
470− pci_msi_ignore_mask = 1;
471470 } else if (xen_hvm_domain()) {
472471 xen_msi_ops.setup_msi_irqs = xen_hvm_setup_msi_irqs;
473472 xen_msi_ops.teardown_msi_irqs = xen_teardown_msi_irqs;
@@ -481,6 +480,11 @@ static __init void xen_setup_pci_msi(void) · 7 unmodified lines
481480 * in allocating the native domain and never use it.
482481 */
483482 x86_init.irqs.create_pci_msi_domain = xen_create_pci_msi_domain;
483+ /*
484+ * With XEN PIRQ/Eventchannels in use PCI/MSI[-X] masking is solely
485+ * controlled by the hypervisor.
486+ */
487+ pci_msi_ignore_mask = 1;
484488 }
485489
486490 #else /* CONFIG_PCI_MSI */
arch/x86/platform/pvh/head.S+1−0
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #define PVH_DS_SEL (PVH_GDT_ENTRY_DS * 8)
5151
5252 SYM_CODE_START_LOCAL(pvh_start_xen)
53+ UNWIND_HINT_EMPTY
5354 cld
5455
5556 lgdt (_pa(gdt))
arch/x86/power/cpu.c+9−1
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <asm/cpu.h>
2626 #include <asm/mmu_context.h>
2727 #include <asm/cpu_device_id.h>
28+#include <asm/microcode.h>
2829
2930 #ifdef CONFIG_X86_32
3031 __visible unsigned long saved_context_ebx;
@@ -262,11 +263,18 @@ static void notrace __restore_processor_state(struct saved_context *ctxt) · 231 unmodified lines
262263 x86_platform.restore_sched_clock_state();
263264 mtrr_bp_restore();
264265 perf_restore_debug_store();
265− msr_restore_context(ctxt);
266266
267267 c = &cpu_data(smp_processor_id());
268268 if (cpu_has(c, X86_FEATURE_MSR_IA32_FEAT_CTL))
269269 init_ia32_feat_ctl(c);
270+
271+ microcode_bsp_resume();
272+
273+ /*
274+ * This needs to happen after the microcode has been updated upon resume
275+ * because some of the MSRs are "emulated" in microcode.
276+ */
277+ msr_restore_context(ctxt);
270278 }
271279
272280 /* Needed by apm.c */
arch/x86/xen/xen-head.S+1−0
@@ -45,6 +45,7 @@ SYM_CODE_END(hypercall_page) · 44 unmodified lines
4545 __INIT
4646 SYM_CODE_START(startup_xen)
4747 UNWIND_HINT_EMPTY
48+ ANNOTATE_NOENDBR
4849 cld
4950
5051 /* Clear .bss */
include/asm-generic/bug.h+6−5
@@ -21,6 +21,12 @@ · 20 unmodified lines
2121 #include <linux/panic.h>
2222 #include <linux/printk.h>
2323
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+
2430 #ifdef CONFIG_BUG
2531
2632 #ifdef CONFIG_GENERIC_BUG
@@ -110,11 +116,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...); · 83 unmodified lines
110116 #endif
111117
112118 /* used internally by panic.c */
113−struct warn_args;
114−struct pt_regs;
115−
116−void __warn(const char *file, int line, void *caller, unsigned taint,
117− struct pt_regs *regs, struct warn_args *args);
118119
119120 #ifndef WARN_ON
120121 #define WARN_ON(condition) ({ \
include/linux/cpu.h+1−1
@@ -167,7 +167,7 @@ static inline int suspend_disable_secondary_cpus(void) { return 0; } · 166 unmodified lines
167167 static inline void suspend_enable_secondary_cpus(void) { }
168168 #endif /* !CONFIG_PM_SLEEP_SMP */
169169
170−void cpu_startup_entry(enum cpuhp_state state);
170+void __noreturn cpu_startup_entry(enum cpuhp_state state);
171171
172172 void cpu_idle_poll_ctrl(bool enable);
173173
lib/strncpy_from_user.c+1−1
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 * hit it), 'max' is the address space maximum (and we return
2626 * -EFAULT if we hit it).
2727 */
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,
2929 unsigned long count, unsigned long max)
3030 {
3131 const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
lib/strnlen_user.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 * if it fits in a aligned 'long'. The caller needs to check
2121 * the return value against "> max".
2222 */
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)
2424 {
2525 const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
2626 unsigned long align, res = 0;
scripts/Makefile.build+1−1
@@ -231,7 +231,7 @@ objtool_args = \ · 230 unmodified lines
231231 $(if $(part-of-module), --module) \
232232 $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt) \
233233 $(if $(CONFIG_FRAME_POINTER),, --no-fp) \
234− $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\
234+ $(if $(CONFIG_GCOV_KERNEL), --no-unreachable) \
235235 $(if $(CONFIG_RETPOLINE), --retpoline) \
236236 $(if $(CONFIG_X86_SMAP), --uaccess) \
237237 $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \
scripts/link-vmlinux.sh+1−1
@@ -140,7 +140,7 @@ objtool_link() · 139 unmodified lines
140140 if ! is_enabled CONFIG_FRAME_POINTER; then
141141 objtoolopt="${objtoolopt} --no-fp"
142142 fi
143− if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then
143+ if is_enabled CONFIG_GCOV_KERNEL; then
144144 objtoolopt="${objtoolopt} --no-unreachable"
145145 fi
146146 if is_enabled CONFIG_RETPOLINE; then
tools/objtool/check.c+5−8
@@ -184,6 +184,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, · 183 unmodified lines
184184 "do_group_exit",
185185 "stop_this_cpu",
186186 "__invalid_creds",
187+ "cpu_startup_entry",
187188 };
188189
189190 if (!func)
@@ -3217,9 +3218,8 @@ validate_ibt_reloc(struct objtool_file *file, struct reloc *reloc) · 3027 unmodified lines
32173218 static void warn_noendbr(const char *msg, struct section *sec, unsigned long offset,
32183219 struct instruction *dest)
32193220 {
3220− WARN_FUNC("%srelocation to !ENDBR: %s+0x%lx", sec, offset, msg,
3221− dest->func ? dest->func->name : dest->sec->name,
3222− dest->func ? dest->offset - dest->func->offset : dest->offset);
3221+ WARN_FUNC("%srelocation to !ENDBR: %s", sec, offset, msg,
3222+ offstr(dest->sec, dest->offset));
32233223 }
32243224
32253225 static void validate_ibt_dest(struct objtool_file *file, struct instruction *insn,
@@ -3823,11 +3823,8 @@ static int validate_ibt(struct objtool_file *file) · 597 unmodified lines
38233823 struct instruction *dest;
38243824
38253825 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);
38313828 }
38323829 }
38333830

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t