All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, jpoimboe@redhat.com,
	ndesaulniers@google.com, hpa@zytor.com, tglx@linutronix.de,
	mingo@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip:core/urgent] objtool: Change dead_end_function() to return boolean
Date: Thu, 18 Jul 2019 12:17:45 -0700	[thread overview]
Message-ID: <tip-8e25c9f8b482ea8d8b6fb4f6f5c09bcc5ee18663@git.kernel.org> (raw)
In-Reply-To: <9e6679610768fb6e6c51dca23f7d4d0c03b0c910.1563413318.git.jpoimboe@redhat.com>

Commit-ID:  8e25c9f8b482ea8d8b6fb4f6f5c09bcc5ee18663
Gitweb:     https://git.kernel.org/tip/8e25c9f8b482ea8d8b6fb4f6f5c09bcc5ee18663
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Wed, 17 Jul 2019 20:36:50 -0500
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 18 Jul 2019 21:01:08 +0200

objtool: Change dead_end_function() to return boolean

dead_end_function() can no longer return an error.  Simplify its
interface by making it return boolean.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/9e6679610768fb6e6c51dca23f7d4d0c03b0c910.1563413318.git.jpoimboe@redhat.com

---
 tools/objtool/check.c | 36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index dece3253ff6a..d9d1c9b54947 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -105,14 +105,9 @@ static struct instruction *next_insn_same_func(struct objtool_file *file,
  *
  * For local functions, we have to detect them manually by simply looking for
  * the lack of a return instruction.
- *
- * Returns:
- *  -1: error
- *   0: no dead end
- *   1: dead end
  */
-static int __dead_end_function(struct objtool_file *file, struct symbol *func,
-			       int recursion)
+static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
+				int recursion)
 {
 	int i;
 	struct instruction *insn;
@@ -139,29 +134,29 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func,
 	};
 
 	if (func->bind == STB_WEAK)
-		return 0;
+		return false;
 
 	if (func->bind == STB_GLOBAL)
 		for (i = 0; i < ARRAY_SIZE(global_noreturns); i++)
 			if (!strcmp(func->name, global_noreturns[i]))
-				return 1;
+				return true;
 
 	if (!func->len)
-		return 0;
+		return false;
 
 	insn = find_insn(file, func->sec, func->offset);
 	if (!insn->func)
-		return 0;
+		return false;
 
 	func_for_each_insn_all(file, func, insn) {
 		empty = false;
 
 		if (insn->type == INSN_RETURN)
-			return 0;
+			return false;
 	}
 
 	if (empty)
-		return 0;
+		return false;
 
 	/*
 	 * A function can have a sibling call instead of a return.  In that
@@ -174,7 +169,7 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func,
 
 			if (!dest)
 				/* sibling call to another file */
-				return 0;
+				return false;
 
 			if (dest->func && dest->func->pfunc != insn->func->pfunc) {
 
@@ -186,7 +181,7 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func,
 					 * This is a very rare case.  It means
 					 * they aren't dead ends.
 					 */
-					return 0;
+					return false;
 				}
 
 				return __dead_end_function(file, dest->func,
@@ -196,13 +191,13 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func,
 
 		if (insn->type == INSN_JUMP_DYNAMIC && list_empty(&insn->alts))
 			/* sibling call */
-			return 0;
+			return false;
 	}
 
-	return 1;
+	return true;
 }
 
-static int dead_end_function(struct objtool_file *file, struct symbol *func)
+static bool dead_end_function(struct objtool_file *file, struct symbol *func)
 {
 	return __dead_end_function(file, func, 0);
 }
@@ -2080,11 +2075,8 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
 				if (is_fentry_call(insn))
 					break;
 
-				ret = dead_end_function(file, insn->call_dest);
-				if (ret == 1)
+				if (dead_end_function(file, insn->call_dest))
 					return 0;
-				if (ret == -1)
-					return 1;
 			}
 
 			if (!no_fp && func && !has_valid_stack_frame(&state)) {

  reply	other threads:[~2019-07-18 19:18 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18  1:36 [PATCH v2 00/22] x86, objtool: several fixes/improvements Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 01/22] x86/paravirt: Fix callee-saved function ELF sizes Josh Poimboeuf
2019-07-18 19:07   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 02/22] x86/kvm: Fix fastop function ELF metadata Josh Poimboeuf
2019-07-18 19:08   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 03/22] x86/kvm: Replace vmx_vmenter()'s call to kvm_spurious_fault() with UD2 Josh Poimboeuf
2019-07-18  8:17   ` Paolo Bonzini
2019-07-18 19:08   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 04/22] x86/kvm: Don't call kvm_spurious_fault() from .fixup Josh Poimboeuf
2019-07-18  8:22   ` Paolo Bonzini
2019-07-18 13:16     ` Sean Christopherson
2019-07-18 13:18       ` Paolo Bonzini
2019-07-18 14:12         ` Josh Poimboeuf
2019-07-18 14:13           ` Paolo Bonzini
2019-07-18 14:03       ` Josh Poimboeuf
2019-07-18 19:09   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 05/22] x86/entry: Fix thunk function ELF sizes Josh Poimboeuf
2019-07-18 19:10   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 06/22] x86/head/64: Annotate start_cpu0() as non-callable Josh Poimboeuf
2019-07-18 19:11   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 07/22] x86/uaccess: Remove ELF function annotation from copy_user_handle_tail() Josh Poimboeuf
2019-07-18 19:11   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 08/22] x86/uaccess: Don't leak AC flag into fentry from mcsafe_handle_tail() Josh Poimboeuf
2019-07-18 19:12   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 09/22] x86/uaccess: Remove redundant CLACs in getuser/putuser error paths Josh Poimboeuf
2019-07-18 19:13   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 10/22] bpf: Disable GCC -fgcse optimization for ___bpf_prog_run() Josh Poimboeuf
2019-07-18 19:14   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2020-04-29 21:51     ` BPF vs objtool again Josh Poimboeuf
2020-04-29 22:01       ` Arvind Sankar
2020-04-29 23:41       ` Alexei Starovoitov
2020-04-30  0:13         ` Josh Poimboeuf
2020-04-30  2:10           ` Alexei Starovoitov
2020-04-30  3:53             ` Josh Poimboeuf
2020-04-30  4:24               ` Alexei Starovoitov
2020-04-30  4:43                 ` Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 11/22] objtool: Add mcsafe_handle_tail() to the uaccess safe list Josh Poimboeuf
2019-07-18 19:14   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 12/22] objtool: Track original function across branches Josh Poimboeuf
2019-07-18 19:15   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 13/22] objtool: Refactor function alias logic Josh Poimboeuf
2019-07-18 19:16   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 14/22] objtool: Warn on zero-length functions Josh Poimboeuf
2019-07-18 19:17   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 15/22] objtool: Change dead_end_function() to return boolean Josh Poimboeuf
2019-07-18 19:17   ` tip-bot for Josh Poimboeuf [this message]
2019-07-18  1:36 ` [PATCH v2 16/22] objtool: Do frame pointer check before dead end check Josh Poimboeuf
2019-07-18 19:18   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 17/22] objtool: Refactor sibling call detection logic Josh Poimboeuf
2019-07-18 19:19   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 18/22] objtool: Refactor jump table code Josh Poimboeuf
2019-07-18 19:20   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 19/22] objtool: Support repeated uses of the same C jump table Josh Poimboeuf
2019-07-18 19:20   ` [tip:core/urgent] " tip-bot for Jann Horn
2019-07-18  1:36 ` [PATCH v2 20/22] objtool: Fix seg fault on bad switch table entry Josh Poimboeuf
2019-07-18 19:21   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 21/22] objtool: convert insn type to enum Josh Poimboeuf
2019-07-18 19:22   ` [tip:core/urgent] objtool: Convert " tip-bot for Josh Poimboeuf
2019-07-18  1:36 ` [PATCH v2 22/22] objtool: Support conditional retpolines Josh Poimboeuf
2019-07-18 19:23   ` [tip:core/urgent] " tip-bot for Josh Poimboeuf

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=tip-8e25c9f8b482ea8d8b6fb4f6f5c09bcc5ee18663@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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.