Re: IBT related objtool warnings

From: Peter Zijlstra
Date: Thu Apr 07 2022 - 11:52:30 EST


On Wed, Apr 06, 2022 at 10:43:33PM +0000, Edgecombe, Rick P wrote:
> Hi,
>
> After commit:
> ed53a0d97192 x86/alternative: Use .ibt_endbr_seal to seal indirect calls
>
> I am getting objtool "unreachable instruction" warnings.
>
> On one system with gcc 8.4.0:
> vmlinux.o: warning: objtool: start_secondary()+0x10e: unreachable
> instruction
>
> On another with gcc 11.2.1:
> vmlinux.o: warning: objtool: pvh_start_xen()+0x0: unreachable
> instruction
>
> Let me know if any tests on my end would help.

This seems to make it go on gcc-11.2 tip/x86/urgent..

---

arch/x86/entry/entry_64.S | 3 +++
arch/x86/platform/pvh/head.S | 1 +
2 files changed, 4 insertions(+)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 4faac48ebec5..73d958522b6a 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -337,6 +337,9 @@ SYM_CODE_END(ret_from_fork)

call \cfunc

+ /* For some configurations \cfunc ends up being a noreturn. */
+ REACHABLE
+
jmp error_return
.endm

diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S
index 72c1e42d121d..7fe564eaf228 100644
--- a/arch/x86/platform/pvh/head.S
+++ b/arch/x86/platform/pvh/head.S
@@ -50,6 +50,7 @@
#define PVH_DS_SEL (PVH_GDT_ENTRY_DS * 8)

SYM_CODE_START_LOCAL(pvh_start_xen)
+ UNWIND_HINT_EMPTY
cld

lgdt (_pa(gdt))