[GIT PULL] objtool fix

From: Ingo Molnar
Date: Thu Jan 12 2023 - 08:57:34 EST


Linus,

Please pull the latest core/urgent git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-urgent-2023-01-12

# HEAD: cad90e5381d840cf2296aaac9b3eff71a30b7c5b objtool: Tolerate STT_NOTYPE symbols at end of section

- Fix objtool to be more permissive with hand-written assembly
that uses non-function symbols in executable sections.

Thanks,

Ingo

------------------>
Nicholas Piggin (1):
objtool: Tolerate STT_NOTYPE symbols at end of section


tools/objtool/check.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 4350be739f4f..4b7c8b33069e 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -427,6 +427,15 @@ static int decode_instructions(struct objtool_file *file)
if (func->type != STT_NOTYPE && func->type != STT_FUNC)
continue;

+ if (func->offset == sec->sh.sh_size) {
+ /* Heuristic: likely an "end" symbol */
+ if (func->type == STT_NOTYPE)
+ continue;
+ WARN("%s(): STT_FUNC at end of section",
+ func->name);
+ return -1;
+ }
+
if (func->return_thunk || func->alias != func)
continue;