提交 41425ebe 编写于 作者: S Sami Tolvanen 提交者: Kees Cook

objtool: Split noinstr validation from --vmlinux

This change adds a --noinstr flag to objtool to allow us to specify
that we're processing vmlinux.o without also enabling noinstr
validation. This is needed to avoid false positives with LTO when we
run objtool on vmlinux.o without CONFIG_DEBUG_ENTRY.
Signed-off-by: NSami Tolvanen <samitolvanen@google.com>
上级 6dafca97
...@@ -106,7 +106,7 @@ objtool_link() ...@@ -106,7 +106,7 @@ objtool_link()
local objtoolopt; local objtoolopt;
if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then
objtoolopt="check --vmlinux" objtoolopt="check --vmlinux --noinstr"
if [ -z "${CONFIG_FRAME_POINTER}" ]; then if [ -z "${CONFIG_FRAME_POINTER}" ]; then
objtoolopt="${objtoolopt} --no-fp" objtoolopt="${objtoolopt} --no-fp"
fi fi
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "builtin.h" #include "builtin.h"
#include "objtool.h" #include "objtool.h"
bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount; bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount, noinstr;
static const char * const check_usage[] = { static const char * const check_usage[] = {
"objtool check [<options>] file.o", "objtool check [<options>] file.o",
...@@ -34,6 +34,7 @@ const struct option check_options[] = { ...@@ -34,6 +34,7 @@ const struct option check_options[] = {
OPT_BOOLEAN('a', "uaccess", &uaccess, "enable uaccess checking"), OPT_BOOLEAN('a', "uaccess", &uaccess, "enable uaccess checking"),
OPT_BOOLEAN('s', "stats", &stats, "print statistics"), OPT_BOOLEAN('s', "stats", &stats, "print statistics"),
OPT_BOOLEAN('d', "duplicate", &validate_dup, "duplicate validation for vmlinux.o"), OPT_BOOLEAN('d', "duplicate", &validate_dup, "duplicate validation for vmlinux.o"),
OPT_BOOLEAN('n', "noinstr", &noinstr, "noinstr validation for vmlinux.o"),
OPT_BOOLEAN('l', "vmlinux", &vmlinux, "vmlinux.o validation"), OPT_BOOLEAN('l', "vmlinux", &vmlinux, "vmlinux.o validation"),
OPT_BOOLEAN('M', "mcount", &mcount, "generate __mcount_loc"), OPT_BOOLEAN('M', "mcount", &mcount, "generate __mcount_loc"),
OPT_END(), OPT_END(),
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
extern const struct option check_options[]; extern const struct option check_options[];
extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount; extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount, noinstr;
extern int cmd_check(int argc, const char **argv); extern int cmd_check(int argc, const char **argv);
extern int cmd_orc(int argc, const char **argv); extern int cmd_orc(int argc, const char **argv);
......
...@@ -244,7 +244,7 @@ static void init_insn_state(struct insn_state *state, struct section *sec) ...@@ -244,7 +244,7 @@ static void init_insn_state(struct insn_state *state, struct section *sec)
* not correctly determine insn->call_dest->sec (external symbols do * not correctly determine insn->call_dest->sec (external symbols do
* not have a section). * not have a section).
*/ */
if (vmlinux && sec) if (vmlinux && noinstr && sec)
state->noinstr = sec->noinstr; state->noinstr = sec->noinstr;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册