lkml.org 
[lkml]   [2022]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/ibt: Fix CC_HAS_IBT check for clang
On Fri, Mar 11, 2022 at 12:56:42PM -0700, Nathan Chancellor wrote:
> Commit 41c5ef31ad71 ("x86/ibt: Base IBT bits") added a check for a crash
> in clang. However, this check does not work for two reasons.
>
> The first reason is that '-pg' is missing from the check, which is
> required for '-mfentry' to do anything.
>
> The second reason is that cc-option only uses /dev/null as the input
> file, which does not show a problem:
>
> $ clang --version | head -1
> Ubuntu clang version 12.0.1-8build1
>
> $ clang -fcf-protection=branch -mfentry -pg -c -x c /dev/null -o /dev/null
>
> $ echo $?
> 0
>
> $ echo "void a(void) {}" | clang -fcf-protection=branch -mfentry -pg -c -x c - -o /dev/null
> ...
>
> $ echo $?
> 139
>
> Use this test instead so that the check works for older versions of
> clang.
>
> Fixes: 41c5ef31ad71 ("x86/ibt: Base IBT bits")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Urgh... not pretty, but that's what we gotta live with I suppose.

Thanks!

\
 
 \ /
  Last update: 2022-03-12 13:20    [W:0.034 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site