2022-05-27 18:51:18

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 1/7] x86/entry: Anchor annotation

x86_64-allmodconfig gives:

vmlinux.o: warning: objtool: entry_SYSCALL_compat+0x0: ANNOTATE_NOENDBR on ENDBR

This is due to:

ANNOTATE_NOENDBR
SYM_CODE_END(entry_SYSENTER_compat)
SYM_CODE_START(entry_SYSCALL_compat)
UNWIND_HINT_EMPTY
ENDBR

And the hint then landing on the first instruction of the next symbol,
which happens to be ENDBR. Stick in an int3 to anchor the annotation
in the previous symbol.

Fixes: 3e3f06950434 ("x86/ibt: Annotate text references")
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
arch/x86/entry/entry_64_compat.S | 1 +
1 file changed, 1 insertion(+)

--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -124,6 +124,7 @@ SYM_INNER_LABEL(entry_SYSENTER_compat_af
jmp .Lsysenter_flags_fixed
SYM_INNER_LABEL(__end_entry_SYSENTER_compat, SYM_L_GLOBAL)
ANNOTATE_NOENDBR // is_sysenter_singlestep
+ int3
SYM_CODE_END(entry_SYSENTER_compat)

/*




2022-05-28 19:04:45

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [PATCH 1/7] x86/entry: Anchor annotation

On Thu, May 26, 2022 at 12:52:53PM +0200, Peter Zijlstra wrote:
> x86_64-allmodconfig gives:
>
> vmlinux.o: warning: objtool: entry_SYSCALL_compat+0x0: ANNOTATE_NOENDBR on ENDBR
>
> This is due to:
>
> ANNOTATE_NOENDBR
> SYM_CODE_END(entry_SYSENTER_compat)
> SYM_CODE_START(entry_SYSCALL_compat)
> UNWIND_HINT_EMPTY
> ENDBR
>
> And the hint then landing on the first instruction of the next symbol,
> which happens to be ENDBR. Stick in an int3 to anchor the annotation
> in the previous symbol.
>
> Fixes: 3e3f06950434 ("x86/ibt: Annotate text references")
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
> arch/x86/entry/entry_64_compat.S | 1 +
> 1 file changed, 1 insertion(+)
>
> --- a/arch/x86/entry/entry_64_compat.S
> +++ b/arch/x86/entry/entry_64_compat.S
> @@ -124,6 +124,7 @@ SYM_INNER_LABEL(entry_SYSENTER_compat_af
> jmp .Lsysenter_flags_fixed
> SYM_INNER_LABEL(__end_entry_SYSENTER_compat, SYM_L_GLOBAL)
> ANNOTATE_NOENDBR // is_sysenter_singlestep
> + int3
> SYM_CODE_END(entry_SYSENTER_compat)

Hm, I get the feeling this warning is pretty much useless anyway. Can
we just get rid of the warning instead?

--
Josh