[PATCH] D151308: -fsanitize=function: fix alignment fault on Arm targets.

Peter Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 02:58:12 PDT 2023


peter.smith added a comment.

In D151308#4369828 <https://reviews.llvm.org/D151308#4369828>, @MaskRay wrote:

> In D151308#4367704 <https://reviews.llvm.org/D151308#4367704>, @peter.smith wrote:
>
>> This looks good to me. Will be worth waiting for a day to give the US time zone time to leave any comments.
>
> Thanks!
>
>> I note that this is also broken in -fsanitize=kcfi [*] (https://reviews.llvm.org/D135411) although fixing that is a separate patch. Would you be able to raise a github issue to cover that?
>
> `-fsanitize=kcfi` only supports aarch64 and x86-64 now. riscv64 is on the plan.
>
>   % fclang -fsanitize=kcfi --traget=armv7-linux-gnueabi -c a.c
>   clang: error: unsupported option '--traget=armv7-linux-gnueabi'

IIUC initially kcfi was x86_64 and AArch64 only. In D135411 <https://reviews.llvm.org/D135411> "generic" support was added for all targets, quoting from the description.

  The KCFI sanitizer emits "kcfi" operand bundles to indirect
  call instructions, which the LLVM back-end lowers into an
  architecture-specific type check with a known machine instruction
  sequence. Currently, KCFI operand bundle lowering is supported only
  on 64-bit X86 and AArch64 architectures.
  
  As a lightweight forward-edge CFI implementation that doesn't
  require LTO is also useful for non-Linux low-level targets on
  other machine architectures, add a generic KCFI operand bundle
  lowering pass that's only used when back-end lowering support is not
  available and allows -fsanitize=kcfi to be enabled in Clang on all
  architectures.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151308/new/

https://reviews.llvm.org/D151308



More information about the cfe-commits mailing list