Merge tag 'objtool-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Apr 2023 21:02:54 +0000 (14:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Apr 2023 21:02:54 +0000 (14:02 -0700)
Pull objtool updates from Ingo Molnar:

 - Mark arch_cpu_idle_dead() __noreturn, make all architectures &
   drivers that did this inconsistently follow this new, common
   convention, and fix all the fallout that objtool can now detect
   statically

 - Fix/improve the ORC unwinder becoming unreliable due to
   UNWIND_HINT_EMPTY ambiguity, split it into UNWIND_HINT_END_OF_STACK
   and UNWIND_HINT_UNDEFINED to resolve it

 - Fix noinstr violations in the KCSAN code and the lkdtm/stackleak code

 - Generate ORC data for __pfx code

 - Add more __noreturn annotations to various kernel startup/shutdown
   and panic functions

 - Misc improvements & fixes

* tag 'objtool-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (52 commits)
  x86/hyperv: Mark hv_ghcb_terminate() as noreturn
  scsi: message: fusion: Mark mpt_halt_firmware() __noreturn
  x86/cpu: Mark {hlt,resume}_play_dead() __noreturn
  btrfs: Mark btrfs_assertfail() __noreturn
  objtool: Include weak functions in global_noreturns check
  cpu: Mark nmi_panic_self_stop() __noreturn
  cpu: Mark panic_smp_self_stop() __noreturn
  arm64/cpu: Mark cpu_park_loop() and friends __noreturn
  x86/head: Mark *_start_kernel() __noreturn
  init: Mark start_kernel() __noreturn
  init: Mark [arch_call_]rest_init() __noreturn
  objtool: Generate ORC data for __pfx code
  x86/linkage: Fix padding for typed functions
  objtool: Separate prefix code from stack validation code
  objtool: Remove superfluous dead_end_function() check
  objtool: Add symbol iteration helpers
  objtool: Add WARN_INSN()
  scripts/objdump-func: Support multiple functions
  context_tracking: Fix KCSAN noinstr violation
  objtool: Add stackleak instrumentation to uaccess safe list
  ...

19 files changed:
1  2 
MAINTAINERS
arch/arm64/kernel/process.c
arch/mips/kernel/smp-cps.c
arch/mips/loongson64/smp.c
arch/powerpc/kernel/smp.c
arch/riscv/kernel/cpu-hotplug.c
arch/x86/entry/entry_64.S
arch/x86/hyperv/ivm.c
arch/x86/include/asm/mshyperv.h
arch/x86/include/asm/smp.h
arch/x86/kernel/ftrace_64.S
arch/x86/kernel/head_64.S
arch/x86/kernel/process.c
arch/x86/kernel/smpboot.c
arch/x86/xen/xen-head.S
drivers/message/fusion/mptbase.h
include/linux/context_tracking.h
init/main.c
tools/objtool/check.c

diff --cc MAINTAINERS
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -228,8 -212,7 +228,8 @@@ int hv_unmap_ioapic_interrupt(int ioapi
  void hv_ghcb_msr_write(u64 msr, u64 value);
  void hv_ghcb_msr_read(u64 msr, u64 *value);
  bool hv_ghcb_negotiate_protocol(void);
- void hv_ghcb_terminate(unsigned int set, unsigned int reason);
+ void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason);
 +void hv_vtom_init(void);
  #else
  static inline void hv_ghcb_msr_write(u64 msr, u64 value) {}
  static inline void hv_ghcb_msr_read(u64 msr, u64 *value) {}
Simple merge
Simple merge
@@@ -230,27 -238,9 +230,27 @@@ SYM_INNER_LABEL(secondary_startup_64_no
        ANNOTATE_RETPOLINE_SAFE
        jmp     *%rax
  1:
-       UNWIND_HINT_EMPTY
+       UNWIND_HINT_END_OF_STACK
        ANNOTATE_NOENDBR // above
  
 +#ifdef CONFIG_SMP
 +      movl    smpboot_control(%rip), %ecx
 +
 +      /* Get the per cpu offset for the given CPU# which is in ECX */
 +      movq    __per_cpu_offset(,%rcx,8), %rdx
 +#else
 +      xorl    %edx, %edx /* zero-extended to clear all of RDX */
 +#endif /* CONFIG_SMP */
 +
 +      /*
 +       * Setup a boot time stack - Any secondary CPU will have lost its stack
 +       * by now because the cr3-switch above unmaps the real-mode stack.
 +       *
 +       * RDX contains the per-cpu offset
 +       */
 +      movq    pcpu_hot + X86_current_task(%rdx), %rax
 +      movq    TASK_threadsp(%rax), %rsp
 +
        /*
         * We must switch to a new descriptor in kernel space for the GDT
         * because soon the kernel won't have access anymore to the userspace
@@@ -383,12 -371,8 +383,12 @@@ SYM_CODE_END(secondary_startup_64
   */
  SYM_CODE_START(start_cpu0)
        ANNOTATE_NOENDBR
-       UNWIND_HINT_EMPTY
+       UNWIND_HINT_END_OF_STACK
 -      movq    initial_stack(%rip), %rsp
 +
 +      /* Find the idle task stack */
 +      movq    PER_CPU_VAR(pcpu_hot) + X86_current_task, %rcx
 +      movq    TASK_threadsp(%rcx), %rsp
 +
        jmp     .Ljump_to_C_code
  SYM_CODE_END(start_cpu0)
  #endif
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -96,9 -96,8 +96,9 @@@ static inline void user_exit_irqoff(voi
  static inline int exception_enter(void) { return 0; }
  static inline void exception_exit(enum ctx_state prev_ctx) { }
  static inline int ct_state(void) { return -1; }
 +static inline int __ct_state(void) { return -1; }
  static __always_inline bool context_tracking_guest_enter(void) { return false; }
- static inline void context_tracking_guest_exit(void) { }
+ static __always_inline void context_tracking_guest_exit(void) { }
  #define CT_WARN_ON(cond) do { } while (0)
  #endif /* !CONFIG_CONTEXT_TRACKING_USER */
  
diff --cc init/main.c
Simple merge
Simple merge