Re: [RFC PATCH v2 00/21] KCFI support

From: Peter Zijlstra
Date: Tue May 17 2022 - 04:58:26 EST


On Fri, May 13, 2022 at 01:21:38PM -0700, Sami Tolvanen wrote:
> KCFI is a proposed forward-edge control-flow integrity scheme for
> Clang, which is more suitable for kernel use than the existing CFI
> scheme used by CONFIG_CFI_CLANG. KCFI doesn't require LTO, doesn't
> alter function references to point to a jump table, and won't break
> function address equality. The latest LLVM patch is here:
>
> https://reviews.llvm.org/D119296
>
> This RFC series replaces the current arm64 CFI implementation with
> KCFI and adds support for x86_64.

You have some weird behaviour vs weak functions (I so hate those)...

100: 0000000000000980 9 FUNC LOCAL DEFAULT 2 __cfi_free_initmem
233: 0000000000000989 35 FUNC WEAK DEFAULT 2 free_initmem

With the result that on the final link:

179: 00000000000009b0 9 FUNC LOCAL DEFAULT 1 __cfi_free_initmem
8689: 00000000000007f0 9 FUNC LOCAL DEFAULT 65 __cfi_free_initmem
173283: 00000000000007f9 198 FUNC GLOBAL DEFAULT 65 free_initmem

This is getting me objtool issues (I'll fix them) but perhaps it's
something you can do something about as well.