[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202306201454.0A2E875F@keescook>
Date: Tue, 20 Jun 2023 14:55:10 -0700
From: Kees Cook <keescook@...omium.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: x86@...nel.org, alyssa.milburn@...ux.intel.com,
linux-kernel@...r.kernel.org, samitolvanen@...gle.com,
jpoimboe@...nel.org, joao@...rdrivepizza.com,
tim.c.chen@...ux.intel.com
Subject: Re: [PATCH 2/2] x86/fineibt: Poison ENDBR at +0
On Thu, Jun 15, 2023 at 09:35:48PM +0200, Peter Zijlstra wrote:
> Alyssa noticed that when building the kernel with CFI_CLANG+IBT and
> booting on IBT enabled hardware obtain FineIBT, the indirect functions
> look like:
>
> __cfi_foo:
> endbr64
> subl $hash, %r10d
> jz 1f
> ud2
> nop
> 1:
> foo:
> endbr64
>
> This is because clang currently does not supress ENDBR emission for
> functions it provides a __cfi prologue symbol for.
Should this be considered a bug in Clang?
>
> Having this second ENDBR however makes it possible to elide the CFI
> check. Therefore, we should poison this second ENDBR (if present) when
> switching to FineIBT mode.
>
> Fixes: 931ab63664f0 ("x86/ibt: Implement FineIBT")
> Reported-by: "Milburn, Alyssa" <alyssa.milburn@...el.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Looks like a good work-around.
Acked-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists