All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Miroslav Benes <mbenes@suse.cz>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: objtool/core] objtool: Extricate sls from stack validation
Date: Fri, 22 Apr 2022 10:35:03 -0000	[thread overview]
Message-ID: <165062370345.4207.10679159280235685523.tip-bot2@tip-bot2> (raw)
In-Reply-To: <2545c86ffa5f27497f0d0c542540ad4a4be3c5a5.1650300597.git.jpoimboe@redhat.com>

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     c2bdd61c98d915ad2cc1f8cd4661fcda1f1e4c16
Gitweb:        https://git.kernel.org/tip/c2bdd61c98d915ad2cc1f8cd4661fcda1f1e4c16
Author:        Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate:    Mon, 18 Apr 2022 09:50:35 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 22 Apr 2022 12:32:03 +02:00

objtool: Extricate sls from stack validation

Extricate sls functionality from validate_branch() so they can be
executed (or ported) independently from each other.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Link: https://lkml.kernel.org/r/2545c86ffa5f27497f0d0c542540ad4a4be3c5a5.1650300597.git.jpoimboe@redhat.com
---
 tools/objtool/check.c | 56 ++++++++++++++++++++++++++++++++----------
 1 file changed, 43 insertions(+), 13 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 85c2888..27126ff 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3271,11 +3271,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
 		switch (insn->type) {
 
 		case INSN_RETURN:
-			if (opts.sls && !insn->retpoline_safe &&
-			    next_insn && next_insn->type != INSN_TRAP) {
-				WARN_FUNC("missing int3 after ret",
-					  insn->sec, insn->offset);
-			}
 			return validate_return(func, insn, &state);
 
 		case INSN_CALL:
@@ -3319,13 +3314,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
 			break;
 
 		case INSN_JUMP_DYNAMIC:
-			if (opts.sls && !insn->retpoline_safe &&
-			    next_insn && next_insn->type != INSN_TRAP) {
-				WARN_FUNC("missing int3 after indirect jump",
-					  insn->sec, insn->offset);
-			}
-
-			/* fallthrough */
 		case INSN_JUMP_DYNAMIC_CONDITIONAL:
 			if (is_sibling_call(insn)) {
 				ret = validate_sibling_call(file, insn, &state);
@@ -3845,6 +3833,41 @@ static int validate_ibt(struct objtool_file *file)
 	return warnings;
 }
 
+static int validate_sls(struct objtool_file *file)
+{
+	struct instruction *insn, *next_insn;
+	int warnings = 0;
+
+	for_each_insn(file, insn) {
+		next_insn = next_insn_same_sec(file, insn);
+
+		if (insn->retpoline_safe)
+			continue;
+
+		switch (insn->type) {
+		case INSN_RETURN:
+			if (!next_insn || next_insn->type != INSN_TRAP) {
+				WARN_FUNC("missing int3 after ret",
+					  insn->sec, insn->offset);
+				warnings++;
+			}
+
+			break;
+		case INSN_JUMP_DYNAMIC:
+			if (!next_insn || next_insn->type != INSN_TRAP) {
+				WARN_FUNC("missing int3 after indirect jump",
+					  insn->sec, insn->offset);
+				warnings++;
+			}
+			break;
+		default:
+			break;
+		}
+	}
+
+	return warnings;
+}
+
 static int validate_reachable_instructions(struct objtool_file *file)
 {
 	struct instruction *insn;
@@ -3913,7 +3936,7 @@ int check(struct objtool_file *file)
 		warnings += ret;
 	}
 
-	if (opts.stackval || opts.orc || opts.uaccess || opts.sls) {
+	if (opts.stackval || opts.orc || opts.uaccess) {
 		ret = validate_functions(file);
 		if (ret < 0)
 			goto out;
@@ -3939,6 +3962,13 @@ int check(struct objtool_file *file)
 		warnings += ret;
 	}
 
+	if (opts.sls) {
+		ret = validate_sls(file);
+		if (ret < 0)
+			goto out;
+		warnings += ret;
+	}
+
 	ret = create_static_call_sections(file);
 	if (ret < 0)
 		goto out;

  reply	other threads:[~2022-04-22 10:36 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 16:50 [PATCH v2 00/25] objtool: Interface overhaul Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 01/25] objtool: Enable unreachable warnings for CLANG LTO Josh Poimboeuf
2022-04-19 20:08   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 02/25] libsubcmd: Fix OPTION_GROUP sorting Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 03/25] x86/static_call: Add ANNOTATE_NOENDBR to static call trampoline Josh Poimboeuf
2022-04-19 20:08   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 04/25] x86/retpoline: Add ANNOTATE_ENDBR for retpolines Josh Poimboeuf
2022-04-19 20:08   ` [tip: x86/urgent] x86/retpoline: Add ANNOTATE_NOENDBR " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 05/25] x86/uaccess: Add ENDBR to __put_user_nocheck*() Josh Poimboeuf
2022-04-19 20:08   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 06/25] x86/xen: Add ANNOTATE_ENDBR to startup_xen() Josh Poimboeuf
2022-04-19 11:42   ` Andrew Cooper
2022-04-19 11:57     ` Peter Zijlstra
2022-04-19 12:06       ` Juergen Gross
2022-04-19 12:12       ` Andrew Cooper
2022-04-19 13:10         ` Peter Zijlstra
2022-04-19 14:25           ` Andrew Cooper
2022-04-19 20:08   ` [tip: x86/urgent] x86/xen: Add ANNOTATE_NOENDBR " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 07/25] objtool: Reorganize cmdline options Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 08/25] objtool: Ditch subcommands Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 09/25] objtool: Don't print parentheses in function addresses Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 10/25] objtool: Print data address for "!ENDBR" data warnings Josh Poimboeuf
2022-04-19 20:08   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 11/25] objtool: Use offstr() to print address of missing ENDBR Josh Poimboeuf
2022-04-19 20:08   ` [tip: x86/urgent] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 12/25] objtool: Add option to print section addresses Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 13/25] scripts: Create objdump-func helper script Josh Poimboeuf
2022-04-19 11:15   ` Peter Zijlstra
2022-04-19 16:09     ` Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 14/25] objtool: Make stack validation optional Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 15/25] objtool: Rework ibt and extricate from stack validation Josh Poimboeuf
2022-04-20 17:25   ` Miroslav Benes
2022-04-22 10:50     ` Peter Zijlstra
2022-04-22 15:17       ` Josh Poimboeuf
2022-04-25  6:27       ` Miroslav Benes
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 16/25] objtool: Extricate sls " Josh Poimboeuf
2022-04-22 10:35   ` tip-bot2 for Josh Poimboeuf [this message]
2022-04-18 16:50 ` [PATCH v2 17/25] objtool: Add CONFIG_OBJTOOL Josh Poimboeuf
2022-04-19 11:22   ` Peter Zijlstra
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 18/25] objtool: Make stack validation frame-pointer-specific Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 19/25] objtool: Make static call annotation optional Josh Poimboeuf
2022-04-22 10:35   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 20/25] objtool: Make jump label hack optional Josh Poimboeuf
2022-04-22 10:34   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 21/25] objtool: Make noinstr hacks optional Josh Poimboeuf
2022-04-22 10:34   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 22/25] objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION" Josh Poimboeuf
2022-04-22 10:34   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 23/25] objtool: Add HAVE_NOINSTR_VALIDATION Josh Poimboeuf
2022-04-22 10:34   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 24/25] objtool: Remove --lto and --vmlinux in favor of --link Josh Poimboeuf
2022-04-20 17:25   ` Miroslav Benes
2022-04-22 10:34   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-18 16:50 ` [PATCH v2 25/25] objtool: Update documentation Josh Poimboeuf
2022-04-22 10:34   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2022-04-19 11:51 ` [PATCH v2 00/25] objtool: Interface overhaul Peter Zijlstra
2022-04-19 15:36   ` Josh Poimboeuf
2022-04-19 16:43     ` Peter Zijlstra
2022-04-20 17:27 ` Miroslav Benes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165062370345.4207.10679159280235685523.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.