Messages in this thread |  | | Date | Sat, 12 Mar 2022 13:20:00 +0100 | From | Peter Zijlstra <> | Subject | Re: [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!
|  |