Skip to content

Commit 2aff7c7

Browse files
committed
Merge tag 'objtool-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
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 ...
2 parents 22b8cc3 + 611d4c7 commit 2aff7c7

84 files changed

Lines changed: 641 additions & 684 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/livepatch/reliable-stacktrace.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ trampoline or return trampoline. For example, considering the x86_64
183183
.. code-block:: none
184184
185185
SYM_CODE_START(return_to_handler)
186-
UNWIND_HINT_EMPTY
186+
UNWIND_HINT_UNDEFINED
187187
subq $24, %rsp
188188
189189
/* Save the return values */

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15180,8 +15180,8 @@ OBJTOOL
1518015180
M: Josh Poimboeuf <jpoimboe@kernel.org>
1518115181
M: Peter Zijlstra <peterz@infradead.org>
1518215182
S: Supported
15183+
F: include/linux/objtool*.h
1518315184
F: tools/objtool/
15184-
F: include/linux/objtool.h
1518515185

1518615186
OCELOT ETHERNET SWITCH DRIVER
1518715187
M: Vladimir Oltean <vladimir.oltean@nxp.com>

arch/alpha/kernel/process.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* This file handles the architecture-dependent parts of process handling.
1010
*/
1111

12+
#include <linux/cpu.h>
1213
#include <linux/errno.h>
1314
#include <linux/module.h>
1415
#include <linux/sched.h>
@@ -59,9 +60,10 @@ void arch_cpu_idle(void)
5960
wtint(0);
6061
}
6162

62-
void arch_cpu_idle_dead(void)
63+
void __noreturn arch_cpu_idle_dead(void)
6364
{
6465
wtint(INT_MAX);
66+
BUG();
6567
}
6668
#endif /* ALPHA_WTINT */
6769

arch/arm/kernel/smp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ void __cpu_die(unsigned int cpu)
320320
* of the other hotplug-cpu capable cores, so presumably coming
321321
* out of idle fixes this.
322322
*/
323-
void arch_cpu_idle_dead(void)
323+
void __noreturn arch_cpu_idle_dead(void)
324324
{
325325
unsigned int cpu = smp_processor_id();
326326

@@ -382,6 +382,8 @@ void arch_cpu_idle_dead(void)
382382
: "r" (task_stack_page(current) + THREAD_SIZE - 8),
383383
"r" (current)
384384
: "r0");
385+
386+
unreachable();
385387
}
386388
#endif /* CONFIG_HOTPLUG_CPU */
387389

@@ -777,7 +779,7 @@ void smp_send_stop(void)
777779
* kdump fails. So split out the panic_smp_self_stop() and add
778780
* set_cpu_online(smp_processor_id(), false).
779781
*/
780-
void panic_smp_self_stop(void)
782+
void __noreturn panic_smp_self_stop(void)
781783
{
782784
pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n",
783785
smp_processor_id());

arch/arm64/include/asm/exception.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static inline unsigned long disr_to_esr(u64 disr)
3131
return esr;
3232
}
3333

34-
asmlinkage void handle_bad_stack(struct pt_regs *regs);
34+
asmlinkage void __noreturn handle_bad_stack(struct pt_regs *regs);
3535

3636
asmlinkage void el1t_64_sync_handler(struct pt_regs *regs);
3737
asmlinkage void el1t_64_irq_handler(struct pt_regs *regs);
@@ -80,5 +80,5 @@ void do_el1_fpac(struct pt_regs *regs, unsigned long esr);
8080
void do_serror(struct pt_regs *regs, unsigned long esr);
8181
void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags);
8282

83-
void panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far);
83+
void __noreturn panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far);
8484
#endif /* __ASM_EXCEPTION_H */

arch/arm64/include/asm/smp.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
100100
extern int __cpu_disable(void);
101101

102102
extern void __cpu_die(unsigned int cpu);
103-
extern void cpu_die(void);
104-
extern void cpu_die_early(void);
103+
extern void __noreturn cpu_die(void);
104+
extern void __noreturn cpu_die_early(void);
105105

106-
static inline void cpu_park_loop(void)
106+
static inline void __noreturn cpu_park_loop(void)
107107
{
108108
for (;;) {
109109
wfe();
@@ -123,7 +123,7 @@ static inline void update_cpu_boot_status(int val)
123123
* which calls for a kernel panic. Update the boot status and park the calling
124124
* CPU.
125125
*/
126-
static inline void cpu_panic_kernel(void)
126+
static inline void __noreturn cpu_panic_kernel(void)
127127
{
128128
update_cpu_boot_status(CPU_PANIC_KERNEL);
129129
cpu_park_loop();
@@ -143,7 +143,6 @@ bool cpus_are_stuck_in_kernel(void);
143143

144144
extern void crash_smp_send_stop(void);
145145
extern bool smp_crash_stop_failed(void);
146-
extern void panic_smp_self_stop(void);
147146

148147
#endif /* ifndef __ASSEMBLY__ */
149148

arch/arm64/kernel/entry-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ UNHANDLED(el0t, 32, error)
840840
#endif /* CONFIG_COMPAT */
841841

842842
#ifdef CONFIG_VMAP_STACK
843-
asmlinkage void noinstr handle_bad_stack(struct pt_regs *regs)
843+
asmlinkage void noinstr __noreturn handle_bad_stack(struct pt_regs *regs)
844844
{
845845
unsigned long esr = read_sysreg(esr_el1);
846846
unsigned long far = read_sysreg(far_el1);

arch/arm64/kernel/process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void (*pm_power_off)(void);
6969
EXPORT_SYMBOL_GPL(pm_power_off);
7070

7171
#ifdef CONFIG_HOTPLUG_CPU
72-
void arch_cpu_idle_dead(void)
72+
void __noreturn arch_cpu_idle_dead(void)
7373
{
7474
cpu_die();
7575
}

arch/arm64/kernel/smp.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void __cpu_die(unsigned int cpu)
361361
* Called from the idle thread for the CPU which has been shutdown.
362362
*
363363
*/
364-
void cpu_die(void)
364+
void __noreturn cpu_die(void)
365365
{
366366
unsigned int cpu = smp_processor_id();
367367
const struct cpu_operations *ops = get_cpu_ops(cpu);
@@ -398,7 +398,7 @@ static void __cpu_try_die(int cpu)
398398
* Kill the calling secondary CPU, early in bringup before it is turned
399399
* online.
400400
*/
401-
void cpu_die_early(void)
401+
void __noreturn cpu_die_early(void)
402402
{
403403
int cpu = smp_processor_id();
404404

@@ -816,7 +816,7 @@ void arch_irq_work_raise(void)
816816
}
817817
#endif
818818

819-
static void local_cpu_stop(void)
819+
static void __noreturn local_cpu_stop(void)
820820
{
821821
set_cpu_online(smp_processor_id(), false);
822822

@@ -830,7 +830,7 @@ static void local_cpu_stop(void)
830830
* that cpu_online_mask gets correctly updated and smp_send_stop() can skip
831831
* CPUs that have already stopped themselves.
832832
*/
833-
void panic_smp_self_stop(void)
833+
void __noreturn panic_smp_self_stop(void)
834834
{
835835
local_cpu_stop();
836836
}
@@ -839,7 +839,7 @@ void panic_smp_self_stop(void)
839839
static atomic_t waiting_for_crash_ipi = ATOMIC_INIT(0);
840840
#endif
841841

842-
static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
842+
static void __noreturn ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
843843
{
844844
#ifdef CONFIG_KEXEC_CORE
845845
crash_save_cpu(regs, cpu);
@@ -854,6 +854,8 @@ static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
854854

855855
/* just in case */
856856
cpu_park_loop();
857+
#else
858+
BUG();
857859
#endif
858860
}
859861

arch/arm64/kernel/traps.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ void bad_el0_sync(struct pt_regs *regs, int reason, unsigned long esr)
863863
DEFINE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack)
864864
__aligned(16);
865865

866-
void panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far)
866+
void __noreturn panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far)
867867
{
868868
unsigned long tsk_stk = (unsigned long)current->stack;
869869
unsigned long irq_stk = (unsigned long)this_cpu_read(irq_stack_ptr);
@@ -905,7 +905,6 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, unsigned long esr)
905905
nmi_panic(regs, "Asynchronous SError Interrupt");
906906

907907
cpu_park_loop();
908-
unreachable();
909908
}
910909

911910
bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned long esr)

0 commit comments

Comments
 (0)