mirror of
https://github.com/torvalds/linux.git
synced 2026-09-28 20:12:01 +02:00
Fix misc objtool bugs:
- Fix potential klp-build allocation leak in
cleanup functionality handling kzalloc() failure
(Yafang Shao)
- Fix KLP checksum false positives triggering with
GCC, caused by quirks in string literal symbol
generation (Josh Poimboeuf)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmqmWJIRHG1pbmdvQGtl
cm5lbC5vcmcACgkQEnMQ0APhK1hGRA//fpBKxCoMv13E2ZLyzwWgz8nGkApXCmyg
+cmmWM8uhNHfH9dA5d7Ipp6ziQcsob0cJ9QM48VM+PdJ1b46Dh41WPb7z9IA+kjG
smV9wnH4dnfXqtFEUbGpzVc9GVv5tP5ZATqZe05rwlbgk8jQpbsr2EhoyAHShg7J
Nqw0CmqFhnP3lKGjhU31UkwusFtI0F/m/tTlwT6n/EumpAPgcdiLo7d4I7Mx9d1g
R0xwNy5OJGUci9bxYU97T6p5aRc4Kkq3XwNHyZcpJNoVjsXphYxSc2Rf/V4QPCTJ
p8weOOBevYk/fScbq7v1LbflUTUvyjh25CQDwz0VUrSxXHrsAKCAiS60D3Fhate+
lLtNnRDxCYDlNW50+sB0ch8WhhHpEqKBpnAdkdI4SUIQbAruvSO2s3Ygrs/JIirw
CoXTzN5yFvSxGw/7DrTDhtrqwGRlCKYvAridbd12tEXGlkOaDB1KZnsazlhqdv1j
1DjnP7SJu+mzDoBJXwz2Fw3TRWzwqx5w9leAFPjm/AaWWqFo/HvspJEKhh4RfhS9
Ulb7wO4ftV6R0hdUS6Q48vSZdGr2Mu3U3cLku051kpdXNCZ4z+2liz9vhZgTx9JP
8X6wMn7kUmg7jc3PR3p0i4Hgar6VYlddJ0BKrSzz5lghi2sA6HDhaB6I9gl7iafj
/fJd8EjglqQ=
=g7d3
-----END PGP SIGNATURE-----
Merge tag 'objtool-urgent-2026-09-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fixes from Ingo Molnar:
- Fix potential klp-build allocation leak in cleanup
functionality handling kzalloc() failure (Yafang Shao)
- Fix KLP checksum false positives triggering with GCC, caused
by quirks in string literal symbol generation (Josh Poimboeuf)
* tag 'objtool-urgent-2026-09-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
objtool/klp: Fix checksums for constant pool references
klp-build: Fix wrong index in funcs cleanup error path
This commit is contained in:
commit
feb66eea6b
|
|
@ -51,7 +51,7 @@ static int __init livepatch_mod_init(void)
|
|||
if (!funcs) {
|
||||
ret = -ENOMEM;
|
||||
for (int j = 0; j < i; j++)
|
||||
kfree(objs[i].funcs);
|
||||
kfree(objs[j].funcs);
|
||||
goto err_free_objs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,19 @@ static int checksum_debug_init(struct objtool_file *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect a reference to anonymous constant pool data which the compiler places
|
||||
* in .rodata.cst<num> and which either has an .LC<num> symbol associated with
|
||||
* it or (with Clang) no symbol at all. These are typically initializers for
|
||||
* local function stack data, so they're considered part of the function rather
|
||||
* than data per se.
|
||||
*/
|
||||
static bool is_anonymous_const_data(struct symbol *sym)
|
||||
{
|
||||
return strstarts(sym->sec->name, ".rodata.cst") &&
|
||||
(is_sec_sym(sym) || strstarts(sym->name, ".LC"));
|
||||
}
|
||||
|
||||
static void checksum_update_insn(struct objtool_file *file, struct symbol *func,
|
||||
struct instruction *insn)
|
||||
{
|
||||
|
|
@ -129,6 +142,14 @@ static void checksum_update_insn(struct objtool_file *file, struct symbol *func,
|
|||
goto alts;
|
||||
}
|
||||
|
||||
if (is_anonymous_const_data(sym)) {
|
||||
void *cst;
|
||||
|
||||
cst = sym->sec->data->d_buf + sym->offset + offset;
|
||||
__checksum_update_insn(func, insn, cst, sym->sec->sh.sh_entsize);
|
||||
goto alts;
|
||||
}
|
||||
|
||||
if (is_sec_sym(sym)) {
|
||||
sym = find_symbol_containing(reloc->sym->sec, offset);
|
||||
if (!sym)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user