Commit dea622e1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'objtool-urgent-2026-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool fixes from Ingo Molnar:
 "Fix three more livepatching related build environment bugs, and a
  false positive warning with Clang jump tables"

* tag 'objtool-urgent-2026-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool: Fix Clang jump table detection
  livepatch/klp-build: Fix inconsistent kernel version
  objtool/klp: fix mkstemp() failure with long paths
  objtool/klp: fix data alignment in __clone_symbol()
parents d56d4a11 4e501921
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -285,15 +285,14 @@ set_module_name() {
# application from appending it with '+' due to a dirty git working tree.
set_kernelversion() {
	local file="$SRC/scripts/setlocalversion"
	local localversion
	local kernelrelease

	stash_file "$file"

	localversion="$(cd "$SRC" && make --no-print-directory kernelversion)"
	localversion="$(cd "$SRC" && KERNELVERSION="$localversion" ./scripts/setlocalversion)"
	[[ -z "$localversion" ]] && die "setlocalversion failed"
	kernelrelease="$(cd "$SRC" && make syncconfig &>/dev/null && make -s kernelrelease)"
	[[ -z "$kernelrelease" ]] && die "failed to get kernel version"

	sed -i "2i echo $localversion; exit 0" scripts/setlocalversion
	sed -i "2i echo $kernelrelease; exit 0" scripts/setlocalversion
}

get_patch_files() {
+2 −3
Original line number Diff line number Diff line
@@ -2184,12 +2184,11 @@ static void mark_func_jump_tables(struct objtool_file *file,
			last = insn;

		/*
		 * Store back-pointers for unconditional forward jumps such
		 * Store back-pointers for forward jumps such
		 * that find_jump_table() can back-track using those and
		 * avoid some potentially confusing code.
		 */
		if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->jump_dest &&
		    insn->offset > last->offset &&
		if (insn->jump_dest &&
		    insn->jump_dest->offset > insn->offset &&
		    !insn->jump_dest->first_jump_src) {

+3 −20
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <libgen.h>
#include <ctype.h>
#include <linux/align.h>
#include <linux/kernel.h>
@@ -1189,7 +1188,7 @@ struct elf *elf_open_read(const char *name, int flags)
struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name)
{
	struct section *null, *symtab, *strtab, *shstrtab;
	char *dir, *base, *tmp_name;
	char *tmp_name;
	struct symbol *sym;
	struct elf *elf;

@@ -1203,29 +1202,13 @@ struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name)

	INIT_LIST_HEAD(&elf->sections);

	dir = strdup(name);
	if (!dir) {
		ERROR_GLIBC("strdup");
		return NULL;
	}

	dir = dirname(dir);

	base = strdup(name);
	if (!base) {
		ERROR_GLIBC("strdup");
		return NULL;
	}

	base = basename(base);

	tmp_name = malloc(256);
	tmp_name = malloc(strlen(name) + 8);
	if (!tmp_name) {
		ERROR_GLIBC("malloc");
		return NULL;
	}

	snprintf(tmp_name, 256, "%s/%s.XXXXXX", dir, base);
	sprintf(tmp_name, "%s.XXXXXX", name);

	elf->fd = mkstemp(tmp_name);
	if (elf->fd == -1) {
+2 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <objtool/util.h>
#include <arch/special.h>

#include <linux/align.h>
#include <linux/objtool_types.h>
#include <linux/livepatch_external.h>
#include <linux/stringify.h>
@@ -560,7 +561,7 @@ static struct symbol *__clone_symbol(struct elf *elf, struct symbol *patched_sym
		}

		if (!is_sec_sym(patched_sym))
			offset = sec_size(out_sec);
			offset = ALIGN(sec_size(out_sec), out_sec->sh.sh_addralign);

		if (patched_sym->len || is_sec_sym(patched_sym)) {
			void *data = NULL;