This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][hwasan] Support for new Intel LAM API
ClosedPublic

Authored by glider on Jul 13 2022, 7:44 AM.

Details

Summary

New version of Intel LAM patches
(https://lore.kernel.org/linux-mm/20220712231328.5294-1-kirill.shutemov@linux.intel.com/)
uses a different interface based on arch_prctl():

  • arch_prctl(ARCH_GET_UNTAG_MASK, &mask) returns the current mask for untagging the pointers. We use it to detect kernel LAM support.
  • arch_prctl(ARCH_ENABLE_TAGGED_ADDR, nr_bits) enables pointer tagging for the current process.

Because __NR_arch_prctl is defined in different headers, and no other
platforms need it at the moment, we only declare internal_arch_prctl()
on x86_64.

Diff Detail

Event Timeline

glider created this revision.Jul 13 2022, 7:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 7:44 AM
glider requested review of this revision.Jul 13 2022, 7:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 7:44 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jul 13 2022, 9:10 AM
vitalybuka added inline comments.
compiler-rt/lib/hwasan/hwasan_linux.cpp
123–124

Maybe we want do CHECK that UNTAG_MASK matches out expectations?
something (hwsan_mask & ~arch_prctl_mask) == 0

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
766

do we need to guard this with if def?

This revision is now accepted and ready to land.Jul 13 2022, 9:10 AM
This revision was landed with ongoing or failed builds.Jul 13 2022, 7:11 PM
This revision was automatically updated to reflect the committed changes.