Skip to content

Commit 0afd0d9

Browse files
jpoimboeIngo Molnar
authored andcommitted
objtool: Fix "noreturn" detection for recursive sibling calls
Objtool has some crude logic for detecting static "noreturn" functions (aka "dead ends"). This is necessary for being able to correctly follow GCC code flow when such functions are called. It's remotely possible for two functions to call each other via sibling calls. If they don't have RET instructions, objtool's noreturn detection logic goes into a recursive loop: drivers/char/ipmi/ipmi_ssif.o: warning: objtool: return_hosed_msg()+0x0: infinite recursion (objtool bug!) drivers/char/ipmi/ipmi_ssif.o: warning: objtool: deliver_recv_msg()+0x0: infinite recursion (objtool bug!) Instead of reporting an error in this case, consider the functions to be non-dead-ends. Reported-and-tested-by: Randy Dunlap <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: David Laight <[email protected]> Cc: Greg KH <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: damian <[email protected]> Link: http://lkml.kernel.org/r/7cc156408c5781a1f62085d352ced1fe39fe2f91.1525923412.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <[email protected]>
1 parent 4fe875e commit 0afd0d9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tools/objtool/check.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,13 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func,
190190
continue;
191191

192192
if (recursion == 5) {
193-
WARN_FUNC("infinite recursion (objtool bug!)",
194-
dest->sec, dest->offset);
195-
return -1;
193+
/*
194+
* Infinite recursion: two functions
195+
* have sibling calls to each other.
196+
* This is a very rare case. It means
197+
* they aren't dead ends.
198+
*/
199+
return 0;
196200
}
197201

198202
return __dead_end_function(file, dest_func,

0 commit comments

Comments
 (0)