[PATCH] D90426: hwasan: Support for outlined checks in the Linux kernel.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 13:58:09 PDT 2020


pcc created this revision.
pcc added reviewers: eugenis, hctim.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: LLVM.
pcc requested review of this revision.

Add support for match-all tags and GOT-free runtime calls, which
are both required for the kernel to be able to support outlined
checks. This requires extending the access info to let the backend
know when to enable these features. To make the code easier to maintain
introduce an enum with the bit field positions for the access info.

Allow outlined checks to be enabled with -mllvm
-hwasan-inline-all-checks=0. Kernels that contain runtime support for
outlined checks may pass this flag. Kernels lacking runtime support
will continue to link because they do not pass the flag. Old versions
of LLVM will ignore the flag and continue to use inline checks.

With a separate kernel patch [1] I measured the code size of defconfig
+ tag-based KASAN, as well as boot time (i.e. time to init launch)
on a DragonBoard 845c with an Android arm64 GKI kernel. The results
are below:

  code size    boot time

before    92824064      6.18s
after     38822400      6.65s

[1] https://linux-review.googlesource.com/id/I1a30036c70ab3c3ee78d75ed9b87ef7cdc3fdb76

Depends on D90425 <https://reviews.llvm.org/D90425>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90426

Files:
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/test/CodeGen/AArch64/hwasan-check-memaccess.ll
  llvm/test/Instrumentation/HWAddressSanitizer/kernel.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90426.301747.patch
Type: text/x-patch
Size: 14117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201029/789a553e/attachment-0001.bin>


More information about the llvm-commits mailing list