]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
objtool: Properly disable uaccess validation
authorJosh Poimboeuf <jpoimboe@kernel.org>
Mon, 24 Mar 2025 21:55:58 +0000 (14:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:12:29 +0000 (11:12 +0200)
[ Upstream commit e1a9dda74dbffbc3fa2069ff418a1876dc99fb14 ]

If opts.uaccess isn't set, the uaccess validation is disabled, but only
partially: it doesn't read the uaccess_safe_builtin list but still tries
to do the validation.  Disable it completely to prevent false warnings.

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/0e95581c1d2107fb5f59418edf2b26bba38b0cbb.1742852846.git.jpoimboe@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/objtool/check.c

index a7dcf2d00ab65abe76913f9635f4dd14a07bd274..522ae26f581be521f7b2a56677ba00c837f94b1c 100644 (file)
@@ -3209,7 +3209,7 @@ static int handle_insn_ops(struct instruction *insn,
                if (update_cfi_state(insn, next_insn, &state->cfi, op))
                        return 1;
 
-               if (!insn->alt_group)
+               if (!opts.uaccess || !insn->alt_group)
                        continue;
 
                if (op->dest.type == OP_DEST_PUSHF) {
@@ -3676,6 +3676,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
                        return 0;
 
                case INSN_STAC:
+                       if (!opts.uaccess)
+                               break;
+
                        if (state.uaccess) {
                                WARN_INSN(insn, "recursive UACCESS enable");
                                return 1;
@@ -3685,6 +3688,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
                        break;
 
                case INSN_CLAC:
+                       if (!opts.uaccess)
+                               break;
+
                        if (!state.uaccess && func) {
                                WARN_INSN(insn, "redundant UACCESS disable");
                                return 1;
@@ -4160,7 +4166,8 @@ static int validate_symbol(struct objtool_file *file, struct section *sec,
        if (!insn || insn->ignore || insn->visited)
                return 0;
 
-       state->uaccess = sym->uaccess_safe;
+       if (opts.uaccess)
+               state->uaccess = sym->uaccess_safe;
 
        ret = validate_branch(file, insn_func(insn), insn, *state);
        if (ret)