scottconstable wrote:

> > @phoebewang and @lvwr I also noticed that there is this code in LLVM:
> > https://github.com/llvm/llvm-project/blob/9ba6672b9f0e82a1f6d4100dc832c84447ea545c/llvm/lib/Transforms/Utils/ModuleUtils.cpp#L202-L214
> > 
> > . As far as I can tell, this code is not triggered when I build the Linux 
> > kernel with `-fsanitize=kcfi`.
> > When is this code triggered? And do you think it is necessary to 
> > additionally implement the arity-enhancement to this code?
> 
> I'm not familar with KCFI. I find it's added by @samitolvanen in 
> [e1c36bd](https://github.com/llvm/llvm-project/commit/e1c36bde0551977d4b2efae032af6dfc4b2b3936).
>  I think you should triger it with attached test case.

It looks to me like this code might be triggered in some LTO configurations, 
and/or when linking code compiled from multiple source languages with the 
expectation that the KCFI type IDs will be compatible. Is my understanding 
correct?

The comment in the code says "Matches CodeGenModule::CreateKCFITypeId in 
Clang," which I interpret to mean that this code should produce identical KCFI 
type IDs for identical function types, which might be tricky if the target 
binary is compiled from different languages. I added some code to 
`llvm::setKCFIType` that I hope will produce consistent output, but admittedly 
I'm not sure that my treatment of `clang::Type` and `llvm::Type` is consistent.

https://github.com/llvm/llvm-project/pull/117121
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to