From: Peter Zijlstra <peterz@infradead.org>
To: jpoimboe@redhat.com
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org
Subject: [PATCH 9/9] objtool: Collect all annotations in objtool.h
Date: Fri, 22 Nov 2024 13:10:25 +0100 [thread overview]
Message-ID: <20241122121556.560621502@infradead.org> (raw)
In-Reply-To: <20241122121016.372005127@infradead.org>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/include/asm/alternative.h | 12 ------------
arch/x86/include/asm/nospec-branch.h | 9 ---------
include/linux/objtool.h | 30 +++++++++++++++++++++++-------
3 files changed, 23 insertions(+), 28 deletions(-)
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -56,12 +56,6 @@
#endif
/*
- * objtool annotation to ignore the alternatives and only consider the original
- * instruction(s).
- */
-#define ANNOTATE_IGNORE_ALTERNATIVE ASM_ANNOTATE(ANNOTYPE_IGNORE_ALTS)
-
-/*
* The patching flags are part of the upper bits of the @ft_flags parameter when
* specifying them. The split is currently like this:
*
@@ -308,12 +302,6 @@ void nop_func(void);
#endif
/*
- * objtool annotation to ignore the alternatives and only consider the original
- * instruction(s).
- */
-#define ANNOTATE_IGNORE_ALTERNATIVE ANNOTATE type=ANNOTYPE_IGNORE_ALTS
-
-/*
* Issue one struct alt_instr descriptor entry (need to put it into
* the section .altinstructions, see below). This entry contains
* enough information for the alternatives patching code to patch an
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -180,13 +180,6 @@
#ifdef __ASSEMBLY__
/*
- * This should be used immediately before an indirect jump/call. It tells
- * objtool the subsequent indirect jump/call is vouched safe for retpoline
- * builds.
- */
-#define ANNOTATE_RETPOLINE_SAFE ANNOTATE type=ANNOTYPE_RETPOLINE_SAFE
-
-/*
* (ab)use RETPOLINE_SAFE on RET to annotate away 'bare' RET instructions
* vs RETBleed validation.
*/
@@ -345,8 +338,6 @@
#else /* __ASSEMBLY__ */
-#define ANNOTATE_RETPOLINE_SAFE ASM_ANNOTATE(ANNOTYPE_RETPOLINE_SAFE)
-
typedef u8 retpoline_thunk_t[RETPOLINE_THUNK_SIZE];
extern retpoline_thunk_t __x86_indirect_thunk_array[];
extern retpoline_thunk_t __x86_indirect_call_thunk_array[];
--- a/include/linux/objtool.h
+++ b/include/linux/objtool.h
@@ -61,8 +61,6 @@
"911:\n\t" \
__ASM_ANNOTATE(911b, x)
-#define ANNOTATE_NOENDBR ASM_ANNOTATE(ANNOTYPE_NOENDBR)
-
#else /* __ASSEMBLY__ */
/*
@@ -140,8 +138,6 @@
.popsection
.endm
-#define ANNOTATE_NOENDBR ANNOTATE type=ANNOTYPE_NOENDBR
-
/*
* This macro indicates that the following intra-function call is valid.
* Any non-annotated intra-function call will cause objtool to issue a warning.
@@ -158,7 +154,6 @@
#define STACK_FRAME_NON_STANDARD(func)
#define STACK_FRAME_NON_STANDARD_FP(func)
#define ASM_ANNOTATE(x)
-#define ANNOTATE_NOENDBR
#define ASM_REACHABLE
#else
#define ANNOTATE_INTRA_FUNCTION_CALL
@@ -166,8 +161,6 @@
.endm
.macro STACK_FRAME_NON_STANDARD func:req
.endm
-.macro ANNOTATE_NOENDBR
-.endm
.macro REACHABLE
.endm
.macro ANNOTATE type:req
@@ -176,4 +169,27 @@
#endif /* CONFIG_OBJTOOL */
+#ifndef __ASSEMBLY__
+/*
+ * Annotate away the various 'relocation to !ENDBR` complaints; knowing that
+ * these relocations will never be used for indirect calls.
+ */
+#define ANNOTATE_NOENDBR ASM_ANNOTATE(ANNOTYPE_NOENDBR)
+/*
+ * This should be used immediately before an indirect jump/call. It tells
+ * objtool the subsequent indirect jump/call is vouched safe for retpoline
+ * builds.
+ */
+#define ANNOTATE_RETPOLINE_SAFE ASM_ANNOTATE(ANNOTYPE_RETPOLINE_SAFE)
+/*
+ * objtool annotation to ignore the alternatives and only consider the original
+ * instruction(s).
+ */
+#define ANNOTATE_IGNORE_ALTERNATIVE ASM_ANNOTATE(ANNOTYPE_IGNORE_ALTS)
+#else
+#define ANNOTATE_NOENDBR ANNOTATE type=ANNOTYPE_NOENDBR
+#define ANNOTATE_RETPOLINE_SAFE ANNOTATE type=ANNOTYPE_RETPOLINE_SAFE
+#define ANNOTATE_IGNORE_ALTERNATIVE ANNOTATE type=ANNOTYPE_IGNORE_ALTS
+#endif
+
#endif /* _LINUX_OBJTOOL_H */
next prev parent reply other threads:[~2024-11-22 12:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 12:10 [PATCH 0/9] objtool: Rewrite annotations Peter Zijlstra
2024-11-22 12:10 ` [PATCH 1/9] objtool: Generic annotation infrastructure Peter Zijlstra
2024-11-24 3:16 ` Nathan Chancellor
2024-11-25 9:28 ` Peter Zijlstra
2024-11-22 12:10 ` [PATCH 2/9] objtool: Convert ANNOTATE_NOENDBR to ANNOTATE Peter Zijlstra
2024-11-22 12:10 ` [PATCH 3/9] objtool: Convert ANNOTATE_RETPOLINE_SAFE " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 4/9] objtool: Convert instrumentation_{begin,end}() " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 5/9] objtool: Convert VALIDATE_UNRET_BEGIN " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 6/9] objtool: Convert ANNOTATE_IGNORE_ALTERNATIVE " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 7/9] objtool: Convert ANNOTATE_INTRA_FUNCTION_CALLS " Peter Zijlstra
2024-11-22 17:22 ` Josh Poimboeuf
2024-11-22 12:10 ` [PATCH 8/9] objtool: Collapse annotate sequences Peter Zijlstra
2024-11-22 17:57 ` Josh Poimboeuf
2024-11-23 13:09 ` Peter Zijlstra
2024-11-22 12:10 ` Peter Zijlstra [this message]
2024-11-22 17:54 ` [PATCH 9/9] objtool: Collect all annotations in objtool.h Josh Poimboeuf
2024-11-23 13:19 ` Peter Zijlstra
2024-11-25 13:06 ` Peter Zijlstra
2024-11-25 13:40 ` Peter Zijlstra
2024-11-25 14:36 ` Peter Zijlstra
2024-11-22 17:40 ` [PATCH 0/9] objtool: Rewrite annotations Josh Poimboeuf
2024-11-23 13:21 ` Peter Zijlstra
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=20241122121556.560621502@infradead.org \
--to=peterz@infradead.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®