Commit 08b8ddac authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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()
parents 92fc1f16 2d3451ef
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ generic-y += device.h
generic-y += dma-mapping.h
generic-y += emergency-restart.h
generic-y += exec.h
generic-y += extable.h
generic-y += ftrace.h
generic-y += hw_irq.h
generic-y += irq_regs.h
+4 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/fs.h>
#include <asm/mman.h>
#include <asm/seccomp.h>
#include <asm/extable.h>

/* workaround for a warning with -Wmissing-prototypes */
void foo(void);
@@ -42,4 +43,7 @@ void foo(void)
	DEFINE(HOSTFS_ATTR_CTIME, ATTR_CTIME);
	DEFINE(HOSTFS_ATTR_ATIME_SET, ATTR_ATIME_SET);
	DEFINE(HOSTFS_ATTR_MTIME_SET, ATTR_MTIME_SET);

	DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr));
	DEFINE(EXTABLE_SIZE,   sizeof(struct exception_table_entry));
}
+4 −5
Original line number Diff line number Diff line
@@ -197,8 +197,8 @@ static inline int alternatives_text_reserved(void *start, void *end)
	"773:\n"

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

#define ALTINSTR_REPLACEMENT(newinstr)		/* replacement */	\
	".pushsection .altinstr_replacement, \"ax\"\n"			\
	ANNOTATE_DATA_SPECIAL						\
	ANNOTATE_DATA_SPECIAL "\n"					\
	"# ALT: replacement\n"						\
	"774:\n\t" newinstr "\n775:\n"					\
	".popsection\n"
@@ -339,7 +339,6 @@ void nop_func(void);
 * instruction. See apply_alternatives().
 */
.macro altinstr_entry orig alt ft_flags orig_len alt_len
	ANNOTATE_DATA_SPECIAL
	.long \orig - .
	.long \alt - .
	.4byte \ft_flags
@@ -363,7 +362,7 @@ void nop_func(void);
741:									\
	.skip -(((744f-743f)-(741b-740b)) > 0) * ((744f-743f)-(741b-740b)),0x90	;\
742:									\
	.pushsection .altinstructions,"a" ;				\
	.pushsection .altinstructions, "aM", @progbits, ALT_INSTR_SIZE ;\
	altinstr_entry 740b,743f,flag,742b-740b,744f-743f ;		\
	.popsection ;							\
	.pushsection .altinstr_replacement,"ax"	;			\
+14 −11
Original line number Diff line number Diff line
@@ -126,15 +126,18 @@ static __always_inline __pure void *rip_rel_ptr(void *p)

#ifdef __KERNEL__

#ifndef COMPILE_OFFSETS
#include <asm/asm-offsets.h>
#endif

# include <asm/extable_fixup_types.h>

/* Exception table entry */
#ifdef __ASSEMBLER__

# define _ASM_EXTABLE_TYPE(from, to, type)				\
	.pushsection "__ex_table","a" ;				\
	.pushsection "__ex_table", "aM", @progbits, EXTABLE_SIZE ;	\
	.balign 4 ;							\
	ANNOTATE_DATA_SPECIAL ;					\
	.long (from) - . ;						\
	.long (to) - . ;						\
	.long type ;							\
@@ -180,18 +183,18 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
	".purgem extable_type_reg\n"

# define _ASM_EXTABLE_TYPE(from, to, type)			\
	" .pushsection \"__ex_table\",\"a\"\n"			\
	" .pushsection __ex_table, \"aM\", @progbits, "		\
		       __stringify(EXTABLE_SIZE) "\n"		\
	" .balign 4\n"						\
	ANNOTATE_DATA_SPECIAL					\
	" .long (" #from ") - .\n"				\
	" .long (" #to ") - .\n"				\
	" .long " __stringify(type) " \n"			\
	" .popsection\n"

# define _ASM_EXTABLE_TYPE_REG(from, to, type, reg)				\
	" .pushsection \"__ex_table\",\"a\"\n"					\
	" .pushsection __ex_table, \"aM\", @progbits, "				\
		       __stringify(EXTABLE_SIZE) "\n"				\
	" .balign 4\n"								\
	ANNOTATE_DATA_SPECIAL							\
	" .long (" #from ") - .\n"						\
	" .long (" #to ") - .\n"						\
	DEFINE_EXTABLE_TYPE_REG							\
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ extern void __WARN_trap(struct bug_entry *bug, ...);

#define _BUG_FLAGS_ASM(format, file, line, flags, size, extra)		\
	".pushsection __bug_table,\"aw\"\n\t"				\
	ANNOTATE_DATA_SPECIAL						\
	ANNOTATE_DATA_SPECIAL "\n\t"					\
	"2:\n\t"							\
	__BUG_ENTRY(format, file, line, flags)				\
	"\t.org 2b + " size "\n"					\
Loading