This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers] intercept hexdump on FreeBSD
ClosedPublic

Authored by devnexen on Sep 25 2021, 3:17 AM.

Diff Detail

Event Timeline

devnexen created this revision.Sep 25 2021, 3:17 AM
devnexen requested review of this revision.Sep 25 2021, 3:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2021, 3:17 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Sep 28 2021, 12:00 PM
vitalybuka added a subscriber: eugenis.

LGTM but I am not sure what is the rule for stuff we intercept vs expect instrumentation from the user
WDYT? @eugenis

This revision is now accepted and ready to land.Sep 28 2021, 12:00 PM
This revision was landed with ongoing or failed builds.Jan 20 2023, 10:01 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 10:01 AM
Herald added a subscriber: Enna1. · View Herald Transcript
MaskRay added subscribers: dim, MaskRay.EditedJan 23 2023, 8:16 AM

hexdump looks like to come from libmba, not a critical component (libc is usually difficult to instrument, but other libraries are not). I think the user should compile libmba with instrumentation instead of adding interceptors to sanitizers (which adds complexity). @dim @emaste
(HWAddressSanitizer is deployed on Android. Its C library bionic is instrumented so that very few interceptors are needed.)

dim added a comment.Jan 23 2023, 8:22 AM

hexdump looks like to come from libmba, not a critical component (libc is usually difficult to instrument, but other libraries are not). I think the user should compile libmba with instrumentation instead of adding interceptors to sanitizers (which adds complexity). @dim @emaste

It is actually in libutil (see https://www.freebsd.org/cgi/man.cgi?query=hexdump&sektion=3), but it might be somewhat tricky for end users to instrument this system library.

(HWAddressSanitizer is deployed on Android. Its C library bionic is instrumented so that very few interceptors are needed.)

Does that result in overhead if sanitization is *not* asked for?

hexdump looks like to come from libmba, not a critical component (libc is usually difficult to instrument, but other libraries are not). I think the user should compile libmba with instrumentation instead of adding interceptors to sanitizers (which adds complexity). @dim @emaste

It is actually in libutil (see https://www.freebsd.org/cgi/man.cgi?query=hexdump&sektion=3), but it might be somewhat tricky for end users to instrument this system library.

OK, it's fine then. We just need to kind in mind that if there are too many functions, adding interceptors does not scale.

(HWAddressSanitizer is deployed on Android. Its C library bionic is instrumented so that very few interceptors are needed.)

Does that result in overhead if sanitization is *not* asked for?

The idea is to use a sanitizer-instrumented .a/.so (like multilib) only when requested by -fsanitize=....