• Josh Poimboeuf's avatar
    objtool: Prevent infinite recursion in noreturn detection · 81bfafca
    Josh Poimboeuf authored
    Ingo reported an infinite loop in objtool with a certain randconfig [1].
    With the given config, two functions in crypto/ablkcipher.o contained
    sibling calls to each other, which threw the recursive call in
    dead_end_function() for a loop (literally!).
    
    Split the noreturn detection into two passes.  In the first pass, check
    for return instructions.  In the second pass, do the potentially
    recursive sibling call check.  In most cases, the first pass will be
    good enough.  In the rare case where a second pass is needed, recursion
    should hopefully no longer be possible.
    
    [1] https://lkml.kernel.org/r/20160308154909.GA20956@gmail.comReported-by: default avatarIngo Molnar <mingo@kernel.org>
    Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Chris J Arges <chris.j.arges@canonical.com>
    Cc: Jiri Slaby <jslaby@suse.cz>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Michal Marek <mmarek@suse.cz>
    Cc: Namhyung Kim <namhyung@gmail.com>
    Cc: Pedro Alves <palves@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: live-patching@vger.kernel.org
    Link: http://lkml.kernel.org/r/16afb602640ef43b7782087d6cca17bf6fc13603.1457502970.git.jpoimboe@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    81bfafca
builtin-check.c 25.4 KB