On Wed, Feb 15, 2023 at 1:44 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > On Tue, Feb 14, 2023 at 03:59:57PM -0800, Alexei Starovoitov wrote: > > How is 'kcfi' 32-bit hash computed? > > Some kind of hash of type id-s? > > Yes. Specifically I think a hash of the C++ name mangled function > signature. (which is giving pain with eg. Rust because then the C++ > mangling isn't specific enough or somesuch, I'm sure Sami can easily > find it if you want to know more) The Rust pain is mostly about type system differences when it comes to integer types, but we're working on fixing that. > > Also what to do with the situation when kernel is compiled with GCC > > while bpf progs are with clang? and the other way around ? > > gcc-bpf can compile all of selftests/bpf, but not yet run them. > > As of yet GCC doesn't support kCFI, so mixing is not possible at > present. kCFI fundamentally changes the C ABI in incompatible ways. When it comes to the BPF programs themselves, it shouldn't matter which compiler you use to compile them as the BPF back-end doesn't emit CFI instrumentation. I'm also fairly sure that the function type in the BPF C program doesn't necessarily have to exactly match the function pointer type used to call the JIT compiled version of that function in the kernel, and the latter one is what actually matters. Sami