Skip to content

Commit 08b8dda

Browse files
committed
Merge tag 'objtool-urgent-2025-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fixes from Ingo Molnar: "Address various objtool scalability bugs/inefficiencies exposed by allmodconfig builds, plus improve the quality of alternatives instructions generated code and disassembly" * tag 'objtool-urgent-2025-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Simplify .annotate_insn code generation output some more objtool: Add more robust signal error handling, detect and warn about stack overflows objtool: Remove newlines and tabs from annotation macros objtool: Consolidate annotation macros x86/asm: Remove ANNOTATE_DATA_SPECIAL usage x86/alternative: Remove ANNOTATE_DATA_SPECIAL usage objtool: Fix stack overflow in validate_branch()
2 parents 92fc1f1 + 2d3451e commit 08b8dda

26 files changed

Lines changed: 214 additions & 72 deletions

File tree

arch/um/include/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ generic-y += device.h
55
generic-y += dma-mapping.h
66
generic-y += emergency-restart.h
77
generic-y += exec.h
8-
generic-y += extable.h
98
generic-y += ftrace.h
109
generic-y += hw_irq.h
1110
generic-y += irq_regs.h

arch/um/kernel/asm-offsets.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/fs.h>
1010
#include <asm/mman.h>
1111
#include <asm/seccomp.h>
12+
#include <asm/extable.h>
1213

1314
/* workaround for a warning with -Wmissing-prototypes */
1415
void foo(void);
@@ -42,4 +43,7 @@ void foo(void)
4243
DEFINE(HOSTFS_ATTR_CTIME, ATTR_CTIME);
4344
DEFINE(HOSTFS_ATTR_ATIME_SET, ATTR_ATIME_SET);
4445
DEFINE(HOSTFS_ATTR_MTIME_SET, ATTR_MTIME_SET);
46+
47+
DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr));
48+
DEFINE(EXTABLE_SIZE, sizeof(struct exception_table_entry));
4549
}

arch/x86/include/asm/alternative.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ static inline int alternatives_text_reserved(void *start, void *end)
197197
"773:\n"
198198

199199
#define ALTINSTR_ENTRY(ft_flags) \
200-
".pushsection .altinstructions,\"a\"\n" \
201-
ANNOTATE_DATA_SPECIAL \
200+
".pushsection .altinstructions, \"aM\", @progbits, " \
201+
__stringify(ALT_INSTR_SIZE) "\n" \
202202
" .long 771b - .\n" /* label */ \
203203
" .long 774f - .\n" /* new instruction */ \
204204
" .4byte " __stringify(ft_flags) "\n" /* feature + flags */ \
@@ -208,7 +208,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
208208

209209
#define ALTINSTR_REPLACEMENT(newinstr) /* replacement */ \
210210
".pushsection .altinstr_replacement, \"ax\"\n" \
211-
ANNOTATE_DATA_SPECIAL \
211+
ANNOTATE_DATA_SPECIAL "\n" \
212212
"# ALT: replacement\n" \
213213
"774:\n\t" newinstr "\n775:\n" \
214214
".popsection\n"
@@ -339,7 +339,6 @@ void nop_func(void);
339339
* instruction. See apply_alternatives().
340340
*/
341341
.macro altinstr_entry orig alt ft_flags orig_len alt_len
342-
ANNOTATE_DATA_SPECIAL
343342
.long \orig - .
344343
.long \alt - .
345344
.4byte \ft_flags
@@ -363,7 +362,7 @@ void nop_func(void);
363362
741: \
364363
.skip -(((744f-743f)-(741b-740b)) > 0) * ((744f-743f)-(741b-740b)),0x90 ;\
365364
742: \
366-
.pushsection .altinstructions,"a" ; \
365+
.pushsection .altinstructions, "aM", @progbits, ALT_INSTR_SIZE ;\
367366
altinstr_entry 740b,743f,flag,742b-740b,744f-743f ; \
368367
.popsection ; \
369368
.pushsection .altinstr_replacement,"ax" ; \

arch/x86/include/asm/asm.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,21 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
126126

127127
#ifdef __KERNEL__
128128

129+
#ifndef COMPILE_OFFSETS
130+
#include <asm/asm-offsets.h>
131+
#endif
132+
129133
# include <asm/extable_fixup_types.h>
130134

131135
/* Exception table entry */
132136
#ifdef __ASSEMBLER__
133137

134-
# define _ASM_EXTABLE_TYPE(from, to, type) \
135-
.pushsection "__ex_table","a" ; \
136-
.balign 4 ; \
137-
ANNOTATE_DATA_SPECIAL ; \
138-
.long (from) - . ; \
139-
.long (to) - . ; \
140-
.long type ; \
138+
# define _ASM_EXTABLE_TYPE(from, to, type) \
139+
.pushsection "__ex_table", "aM", @progbits, EXTABLE_SIZE ; \
140+
.balign 4 ; \
141+
.long (from) - . ; \
142+
.long (to) - . ; \
143+
.long type ; \
141144
.popsection
142145

143146
# ifdef CONFIG_KPROBES
@@ -180,18 +183,18 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
180183
".purgem extable_type_reg\n"
181184

182185
# define _ASM_EXTABLE_TYPE(from, to, type) \
183-
" .pushsection \"__ex_table\",\"a\"\n" \
186+
" .pushsection __ex_table, \"aM\", @progbits, " \
187+
__stringify(EXTABLE_SIZE) "\n" \
184188
" .balign 4\n" \
185-
ANNOTATE_DATA_SPECIAL \
186189
" .long (" #from ") - .\n" \
187190
" .long (" #to ") - .\n" \
188191
" .long " __stringify(type) " \n" \
189192
" .popsection\n"
190193

191194
# define _ASM_EXTABLE_TYPE_REG(from, to, type, reg) \
192-
" .pushsection \"__ex_table\",\"a\"\n" \
195+
" .pushsection __ex_table, \"aM\", @progbits, " \
196+
__stringify(EXTABLE_SIZE) "\n" \
193197
" .balign 4\n" \
194-
ANNOTATE_DATA_SPECIAL \
195198
" .long (" #from ") - .\n" \
196199
" .long (" #to ") - .\n" \
197200
DEFINE_EXTABLE_TYPE_REG \

arch/x86/include/asm/bug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern void __WARN_trap(struct bug_entry *bug, ...);
7070

7171
#define _BUG_FLAGS_ASM(format, file, line, flags, size, extra) \
7272
".pushsection __bug_table,\"aw\"\n\t" \
73-
ANNOTATE_DATA_SPECIAL \
73+
ANNOTATE_DATA_SPECIAL "\n\t" \
7474
"2:\n\t" \
7575
__BUG_ENTRY(format, file, line, flags) \
7676
"\t.org 2b + " size "\n" \

arch/x86/include/asm/cpufeature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static __always_inline bool _static_cpu_has(u16 bit)
101101
asm goto(ALTERNATIVE_TERNARY("jmp 6f", %c[feature], "", "jmp %l[t_no]")
102102
".pushsection .altinstr_aux,\"ax\"\n"
103103
"6:\n"
104-
ANNOTATE_DATA_SPECIAL
104+
ANNOTATE_DATA_SPECIAL "\n"
105105
" testb %[bitnum], %a[cap_byte]\n"
106106
" jnz %l[t_yes]\n"
107107
" jmp %l[t_no]\n"

arch/x86/include/asm/irq_stack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101

102102
#define ASM_CALL_ARG0 \
103103
"1: call %c[__func] \n" \
104-
ANNOTATE_REACHABLE(1b)
104+
ANNOTATE_REACHABLE(1b) " \n"
105105

106106
#define ASM_CALL_ARG1 \
107107
"movq %[arg1], %%rdi \n" \

arch/x86/include/asm/jump_label.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define JUMP_TABLE_ENTRY(key, label) \
1616
".pushsection __jump_table, \"aw\" \n\t" \
1717
_ASM_ALIGN "\n\t" \
18-
ANNOTATE_DATA_SPECIAL \
18+
ANNOTATE_DATA_SPECIAL "\n" \
1919
".long 1b - . \n\t" \
2020
".long " label " - . \n\t" \
2121
_ASM_PTR " " key " - . \n\t" \

arch/x86/include/asm/nospec-branch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static inline void call_depth_return_thunk(void) {}
466466
*/
467467
# define CALL_NOSPEC \
468468
ALTERNATIVE_2( \
469-
ANNOTATE_RETPOLINE_SAFE \
469+
ANNOTATE_RETPOLINE_SAFE "\n" \
470470
"call *%[thunk_target]\n", \
471471
" jmp 904f;\n" \
472472
" .align 16\n" \
@@ -482,7 +482,7 @@ static inline void call_depth_return_thunk(void) {}
482482
"904: call 901b;\n", \
483483
X86_FEATURE_RETPOLINE, \
484484
"lfence;\n" \
485-
ANNOTATE_RETPOLINE_SAFE \
485+
ANNOTATE_RETPOLINE_SAFE "\n" \
486486
"call *%[thunk_target]\n", \
487487
X86_FEATURE_RETPOLINE_LFENCE)
488488

arch/x86/include/asm/paravirt_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ extern struct paravirt_patch_template pv_ops;
249249
* don't need to bother with CFI prefixes.
250250
*/
251251
#define PARAVIRT_CALL \
252-
ANNOTATE_RETPOLINE_SAFE \
252+
ANNOTATE_RETPOLINE_SAFE "\n\t" \
253253
"call *%[paravirt_opptr];"
254254

255255
/*

0 commit comments

Comments
 (0)