Skip to content

Commit dea622e

Browse files
committed
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()
2 parents d56d4a1 + 4e50192 commit dea622e

4 files changed

Lines changed: 11 additions & 29 deletions

File tree

scripts/livepatch/klp-build

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,14 @@ set_module_name() {
285285
# application from appending it with '+' due to a dirty git working tree.
286286
set_kernelversion() {
287287
local file="$SRC/scripts/setlocalversion"
288-
local localversion
288+
local kernelrelease
289289

290290
stash_file "$file"
291291

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

296-
sed -i "2i echo $localversion; exit 0" scripts/setlocalversion
295+
sed -i "2i echo $kernelrelease; exit 0" scripts/setlocalversion
297296
}
298297

299298
get_patch_files() {

tools/objtool/check.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,12 +2184,11 @@ static void mark_func_jump_tables(struct objtool_file *file,
21842184
last = insn;
21852185

21862186
/*
2187-
* Store back-pointers for unconditional forward jumps such
2187+
* Store back-pointers for forward jumps such
21882188
* that find_jump_table() can back-track using those and
21892189
* avoid some potentially confusing code.
21902190
*/
2191-
if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->jump_dest &&
2192-
insn->offset > last->offset &&
2191+
if (insn->jump_dest &&
21932192
insn->jump_dest->offset > insn->offset &&
21942193
!insn->jump_dest->first_jump_src) {
21952194

tools/objtool/elf.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <string.h>
1717
#include <unistd.h>
1818
#include <errno.h>
19-
#include <libgen.h>
2019
#include <ctype.h>
2120
#include <linux/align.h>
2221
#include <linux/kernel.h>
@@ -1189,7 +1188,7 @@ struct elf *elf_open_read(const char *name, int flags)
11891188
struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name)
11901189
{
11911190
struct section *null, *symtab, *strtab, *shstrtab;
1192-
char *dir, *base, *tmp_name;
1191+
char *tmp_name;
11931192
struct symbol *sym;
11941193
struct elf *elf;
11951194

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

12041203
INIT_LIST_HEAD(&elf->sections);
12051204

1206-
dir = strdup(name);
1207-
if (!dir) {
1208-
ERROR_GLIBC("strdup");
1209-
return NULL;
1210-
}
1211-
1212-
dir = dirname(dir);
1213-
1214-
base = strdup(name);
1215-
if (!base) {
1216-
ERROR_GLIBC("strdup");
1217-
return NULL;
1218-
}
1219-
1220-
base = basename(base);
1221-
1222-
tmp_name = malloc(256);
1205+
tmp_name = malloc(strlen(name) + 8);
12231206
if (!tmp_name) {
12241207
ERROR_GLIBC("malloc");
12251208
return NULL;
12261209
}
12271210

1228-
snprintf(tmp_name, 256, "%s/%s.XXXXXX", dir, base);
1211+
sprintf(tmp_name, "%s.XXXXXX", name);
12291212

12301213
elf->fd = mkstemp(tmp_name);
12311214
if (elf->fd == -1) {

tools/objtool/klp-diff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <objtool/util.h>
1515
#include <arch/special.h>
1616

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

562563
if (!is_sec_sym(patched_sym))
563-
offset = sec_size(out_sec);
564+
offset = ALIGN(sec_size(out_sec), out_sec->sh.sh_addralign);
564565

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

0 commit comments

Comments
 (0)