public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: x86@kernel.org, Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] x86/ibt: Fix CC_HAS_IBT check for clang
Date: Sat, 12 Mar 2022 13:20:00 +0100	[thread overview]
Message-ID: <20220312122000.GB28057@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220311195642.2033108-1-nathan@kernel.org>

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!

  reply	other threads:[~2022-03-12 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 19:56 [PATCH] x86/ibt: Fix CC_HAS_IBT check for clang Nathan Chancellor
2022-03-12 12:20 ` Peter Zijlstra [this message]
2022-03-12 12:37 ` [tip: x86/core] " tip-bot2 for Nathan Chancellor

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=20220312122000.GB28057@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=x86@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