Skip to content

Commit 0b10177

Browse files
jpoimboeIngo Molnar
authored andcommitted
objtool: Always fail on fatal errors
Objtool writes several object annotations which are used to enable critical kernel runtime functionalities like static calls and retpoline/rethunk patching. In the rare case where it fails to read or write an object, the annotations don't get written, causing runtime code patching to fail and code to become corrupted. Due to the catastrophic nature of such warnings, convert them to errors which fail the build regardless of CONFIG_OBJTOOL_WERROR. Reported-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/7d35684ca61eac56eb2424f300ca43c5d257b170.1743481539.git.jpoimboe@kernel.org Closes: https://lore.kernel.org/SJ1PR11MB61295789E25C2F5197EFF2F6B9A72@SJ1PR11MB6129.namprd11.prod.outlook.com
1 parent c561007 commit 0b10177

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

tools/objtool/check.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4753,22 +4753,15 @@ int check(struct objtool_file *file)
47534753
if (!ret && !warnings)
47544754
return 0;
47554755

4756+
if (opts.werror && warnings)
4757+
ret = 1;
4758+
47564759
if (opts.verbose) {
47574760
if (opts.werror && warnings)
47584761
WARN("%d warning(s) upgraded to errors", warnings);
47594762
print_args();
47604763
disas_warned_funcs(file);
47614764
}
47624765

4763-
/*
4764-
* CONFIG_OBJTOOL_WERROR upgrades all warnings (and errors) to actual
4765-
* errors.
4766-
*
4767-
* Note that even fatal errors don't yet actually return an error
4768-
* without CONFIG_OBJTOOL_WERROR. That will be fixed soon-ish.
4769-
*/
4770-
if (opts.werror)
4771-
return 1;
4772-
4773-
return 0;
4766+
return ret;
47744767
}

0 commit comments

Comments
 (0)