From 9c888e2099119ff57fe47175bc2e1f6a13ba588b Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 13 Dec 2023 12:38:23 +0000 Subject: [PATCH] UBUNTU: SAUCE: objtool: make objtool RETPOLINE validation fatal when building with CONFIG_RETPOLINE=y BugLink: https://bugs.launchpad.net/bugs/2046440 Make objtool RETPOLINE validation fatal when building with CONFIG_RETPOLINE=y, currently it is a build.log warning only. This is a standalone patch, such that if regressions are identified (with any config or toolchain configuration) it can be reverted until relevant identified code is fixed up or otherwise ignored/silecned/marked as safe. Signed-off-by: Dimitri John Ledkov Link: https://lore.kernel.org/all/20231213134303.2302285-4-dimitri.ledkov@canonical.com/ Signed-off-by: Andrea Righi --- tools/objtool/check.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 788a20b4bd98..8edeb5f2028a 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3991,7 +3991,10 @@ static int validate_retpoline(struct objtool_file *file) warnings++; } - return warnings; + /* RETPOLINE is an optional security safety feature, make it + * fatal to ensure no new code is introduced that fails + * RETPOLINE */ + return -warnings; } static bool is_kasan_insn(struct instruction *insn)