Skip to content

Commit

Permalink
objtool: Fail the kernel build on fatal errors
Browse files Browse the repository at this point in the history
When objtool encounters a fatal error, it usually means the binary is
corrupt or otherwise broken in some way.  Up until now, such errors were
just treated as warnings which didn't fail the kernel build.

However, objtool is now stable enough that if a fatal error is
discovered, it most likely means something is seriously wrong and it
should fail the kernel build.

Note that this doesn't apply to "normal" objtool warnings; only fatal
ones.

Suggested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Julien Thierry <jthierry@redhat.com>
Link: https://lkml.kernel.org/r/f18c3743de0fef673d49dd35760f26bdef7f6fc3.1581359535.git.jpoimboe@redhat.com
  • Loading branch information
Josh Poimboeuf authored and Borislav Petkov committed Feb 11, 2020
1 parent bb6d3fb commit 644592d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tools/objtool/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -2491,8 +2491,14 @@ int check(const char *_objname, bool orc)
out:
cleanup(&file);

/* ignore warnings for now until we get all the code cleaned up */
if (ret || warnings)
return 0;
if (ret < 0) {
/*
* Fatal error. The binary is corrupt or otherwise broken in
* some way, or objtool itself is broken. Fail the kernel
* build.
*/
return ret;
}

return 0;
}

0 comments on commit 644592d

Please sign in to comment.