summaryrefslogtreecommitdiffstats
path: root/tools/objtool/check.h
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2017-06-28 17:11:07 +0200
committerIngo Molnar <mingo@kernel.org>2017-06-30 10:19:19 +0200
commitbaa41469a7b992c1e3db2a39854219cc7442e48f (patch)
tree1a8e43a0d5e27db457c1cc6f8a4510b258b46bee /tools/objtool/check.h
parentobjtool, x86: Add several functions and files to the objtool whitelist (diff)
downloadlinux-baa41469a7b992c1e3db2a39854219cc7442e48f.tar.xz
linux-baa41469a7b992c1e3db2a39854219cc7442e48f.zip
objtool: Implement stack validation 2.0
This is a major rewrite of objtool. Instead of only tracking frame pointer changes, it now tracks all stack-related operations, including all register saves/restores. In addition to making stack validation more robust, this also paves the way for undwarf generation. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: live-patching@vger.kernel.org Link: http://lkml.kernel.org/r/678bd94c0566c6129bcc376cddb259c4c5633004.1498659915.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/objtool/check.h')
-rw-r--r--tools/objtool/check.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/objtool/check.h b/tools/objtool/check.h
index c0d2fde6b4ea..da85f5b00ec6 100644
--- a/tools/objtool/check.h
+++ b/tools/objtool/check.h
@@ -20,22 +20,34 @@
#include <stdbool.h>
#include "elf.h"
+#include "cfi.h"
#include "arch.h"
#include <linux/hashtable.h>
+struct insn_state {
+ struct cfi_reg cfa;
+ struct cfi_reg regs[CFI_NUM_REGS];
+ int stack_size;
+ bool bp_scratch;
+ bool drap;
+ int drap_reg;
+};
+
struct instruction {
struct list_head list;
struct hlist_node hash;
struct section *sec;
unsigned long offset;
- unsigned int len, state;
+ unsigned int len;
unsigned char type;
unsigned long immediate;
- bool alt_group, visited, dead_end;
+ bool alt_group, visited, dead_end, ignore;
struct symbol *call_dest;
struct instruction *jump_dest;
struct list_head alts;
struct symbol *func;
+ struct stack_op stack_op;
+ struct insn_state state;
};
struct objtool_file {
@@ -48,4 +60,7 @@ struct objtool_file {
int check(const char *objname, bool nofp);
+#define for_each_insn(file, insn) \
+ list_for_each_entry(insn, &file->insn_list, list)
+
#endif /* _CHECK_H */