[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240927194924.839606244@infradead.org>
Date: Fri, 27 Sep 2024 21:49:01 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
peterz@...radead.org,
alyssa.milburn@...el.com,
scott.d.constable@...el.com,
joao@...rdrivepizza.com,
andrew.cooper3@...rix.com,
jpoimboe@...nel.org,
jose.marchesi@...cle.com,
hjl.tools@...il.com,
ndesaulniers@...gle.com,
samitolvanen@...gle.com,
nathan@...nel.org,
ojeda@...nel.org,
kees@...nel.org,
alexei.starovoitov@...il.com
Subject: [PATCH 05/14] objtool: Rename the skylake hack to --direct-call
In order to use the .call_sites and .tail_call_sites sections beyond the
call-depth-tracking skylake thing, give it a more generic name.
Specifically it will be used to 'relink' all direct calls to avoid ENDBR.
A compiler could only hope to do this using an LTO pass, and even then the
dynamic linker would need to get involved.
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
scripts/Makefile.lib | 2 +-
tools/objtool/builtin-check.c | 8 ++------
tools/objtool/check.c | 18 +++++++++---------
tools/objtool/include/objtool/builtin.h | 2 +-
4 files changed, 13 insertions(+), 17 deletions(-)
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -267,7 +267,7 @@ objtool := $(objtree)/tools/objtool/objt
objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label
objtool-args-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr
-objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --hacks=skylake
+objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --direct-call
objtool-args-$(CONFIG_X86_KERNEL_IBT) += --ibt
objtool-args-$(CONFIG_FINEIBT) += --cfi
objtool-args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) += --mcount
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -57,17 +57,13 @@ static int parse_hacks(const struct opti
found = true;
}
- if (!str || strstr(str, "skylake")) {
- opts.hack_skylake = true;
- found = true;
- }
-
return found ? 0 : -1;
}
static const struct option check_options[] = {
OPT_GROUP("Actions:"),
- OPT_CALLBACK_OPTARG('h', "hacks", NULL, NULL, "jump_label,noinstr,skylake", "patch toolchain bugs/limitations", parse_hacks),
+ OPT_CALLBACK_OPTARG('h', "hacks", NULL, NULL, "jump_label,noinstr", "patch toolchain bugs/limitations", parse_hacks),
+ OPT_BOOLEAN(0, "direct-call", &opts.direct_call, "annotate direct calls"),
OPT_BOOLEAN('i', "ibt", &opts.ibt, "validate and annotate IBT"),
OPT_BOOLEAN('m', "mcount", &opts.mcount, "annotate mcount/fentry calls for ftrace"),
OPT_BOOLEAN('n', "noinstr", &opts.noinstr, "validate noinstr rules"),
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4838,16 +4838,16 @@ int check(struct objtool_file *file)
if (ret < 0)
goto out;
warnings += ret;
+ }
- if (opts.hack_skylake) {
- ret = create_direct_call_sections(file);
- if (ret < 0)
- goto out;
- ret = create_direct_tail_call_sections(file);
- if (ret < 0)
- goto out;
- warnings += ret;
- }
+ if (opts.direct_call) {
+ ret = create_direct_call_sections(file);
+ if (ret < 0)
+ goto out;
+ ret = create_direct_tail_call_sections(file);
+ if (ret < 0)
+ goto out;
+ warnings += ret;
}
if (opts.mcount) {
--- a/tools/objtool/include/objtool/builtin.h
+++ b/tools/objtool/include/objtool/builtin.h
@@ -12,7 +12,7 @@ struct opts {
bool dump_orc;
bool hack_jump_label;
bool hack_noinstr;
- bool hack_skylake;
+ bool direct_call;
bool ibt;
bool mcount;
bool noinstr;
Powered by blists - more mailing lists