This is an archive of the discontinued LLVM Phabricator instance.

hwasan: lay groundwork for importing subset of sanitizer_common interceptors [NFC]
ClosedPublic

Authored by thurston on May 16 2023, 12:34 PM.

Details

Summary

This patch does the bare minimum to import sanitizer_common_interceptors, but
without actually enabling any interceptors or meaningfully defining the
COMMON_INTERCEPT macros.

This will allow selectively enabling sanitizer_common interceptors (if the
appropriate macros are defined), as suggested by Vitaly in D149701.

Diff Detail

Event Timeline

thurston created this revision.May 16 2023, 12:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 12:34 PM
Herald added a subscriber: Enna1. · View Herald Transcript
thurston requested review of this revision.May 16 2023, 12:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 12:34 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka added inline comments.May 16 2023, 12:58 PM
compiler-rt/lib/hwasan/hwasan_platform_interceptors.h
1

#include guards?

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
39 ↗(On Diff #522741)

why we need to change this, I would expect it's in the search path ?

vitalybuka accepted this revision.May 16 2023, 12:59 PM
This revision is now accepted and ready to land.May 16 2023, 12:59 PM
thurston updated this revision to Diff 522758.May 16 2023, 1:22 PM

Add #include guards

Revert unnnecessary path specification

thurston marked 2 inline comments as done.May 16 2023, 1:23 PM
thurston added inline comments.
compiler-rt/lib/hwasan/hwasan_platform_interceptors.h
1

Done

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
39 ↗(On Diff #522741)

You're correct, it's not necessary.

Somehow I had encountered a build error earlier on that needed this, but it seems fine now.

This revision was landed with ongoing or failed builds.May 16 2023, 2:28 PM
This revision was automatically updated to reflect the committed changes.
thurston marked 2 inline comments as done.
pcc added a subscriber: pcc.May 17 2023, 11:13 AM

I think this broke the sanitizer-aarch64-linux-bootstrap-hwasan buildbot (caused "stage2/hwasan check" to start failing).

First test failure: https://lab.llvm.org/buildbot/#/builders/236/builds/4069

I think this broke the sanitizer-aarch64-linux-bootstrap-hwasan buildbot (caused "stage2/hwasan check" to start failing).

First test failure: https://lab.llvm.org/buildbot/#/builders/236/builds/4069

Thanks Peter for the heads up! I've reverted it in https://reviews.llvm.org/rG70e0c8ffcb71486b17bdee305ba49e80b03d00f5

thurston reopened this revision.May 19 2023, 4:37 PM
This revision is now accepted and ready to land.May 19 2023, 4:37 PM
thurston updated this revision to Diff 523967.May 19 2023, 4:38 PM

The stage2/hwasan check failure has been fixed in https://reviews.llvm.org/D150909 - it was
due to a missing SANITIZER_INTERCEPTOR_ guard for wcslen in sanitizer_common; as a result, the wcslen interceptor had been erroneously included in hwasan.

This patch has been updated to:

  • clear the newly added SANITIZER_INTERCEPTOR_WCSLEN macro
  • subsume the minor fixes for unused variables and functions
thurston requested review of this revision.May 19 2023, 4:38 PM
vitalybuka accepted this revision.May 19 2023, 5:01 PM
This revision is now accepted and ready to land.May 19 2023, 5:01 PM
This revision was landed with ongoing or failed builds.May 23 2023, 11:21 AM
This revision was automatically updated to reflect the committed changes.