[clang] [llvm] [X86] Enhance kCFI type IDs with a 3-bit arity indicator. (PR #117121)
João Moreira via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 09:57:16 PST 2024
lvwr wrote:
> > Although the default calling convention uses 6 registers, others like RegCall uses more. Do you want to check calling convention as well?
>
> AFAIK the use case for KCFI is very narrow: the x86-64 Linux kernel. And I don't believe that the kernel uses (or even allows?) any calling convention other than the default. The kernel documentation also says that the eBPF calling convention "maps directly to ABIs used by the kernel on 64-bit architectures." But I admit I am not an expert on the Linux ABI nor am I an expert on the full scope of KCFI use cases.
>
> Maybe @lvwr can weigh in?
My understanding is that the kernel respects the default calling convention for most things (if not all) and then build on top of it, like by defining indirect call and FineIBT must-use registers (r11 and r10). There are also specifics for syscalls, like using RAX to pass the syscall number.
With the above said, I'm unsure if there is any orthogonal-craziness-custom-thing going on for the handwritten assembly code, but I would assume not given it is desirable to keep standards all around (maybe double check that with PeterZ for assurance?).
Finally, for breadth, the ABI defines code mode kernel for handling symbols and relocations. But I think this is not concerning here.
https://github.com/llvm/llvm-project/pull/117121
More information about the cfe-commits
mailing list