This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Allow new/delete replacement by making interceptors weak
ClosedPublic

Authored by hctim on Apr 9 2021, 11:37 AM.

Details

Summary

ASan declares these functions as strongly-defined, which results in
'duplicate symbol' errors when trying to replace them in user code when
linking the runtimes statically.

Diff Detail

Event Timeline

hctim requested review of this revision.Apr 9 2021, 11:37 AM
hctim created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 9 2021, 11:37 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Add it to CXX_OPERATOR_ATTRIBUTE, on non-mac non-windows?

hctim updated this revision to Diff 336549.Apr 9 2021, 1:01 PM

Add it to CXX_OPERATOR_ATTRIBUTE, on non-mac non-windows?

Done.

hctim updated this revision to Diff 336550.Apr 9 2021, 1:02 PM

wrong diffbase messed up phabricator rendering

eugenis accepted this revision.Apr 9 2021, 1:03 PM

LGTM

This revision is now accepted and ready to land.Apr 9 2021, 1:03 PM
morehouse added inline comments.
compiler-rt/test/asan/TestCases/replaceable_new_delete.cpp
1 ↗(On Diff #336563)
hctim marked an inline comment as done.Apr 12 2021, 10:06 AM
hctim added inline comments.
compiler-rt/test/asan/TestCases/replaceable_new_delete.cpp
1 ↗(On Diff #336563)

Thanks, submitted 15689f3af018c420403bb0fd0df0aa5f79796b94 to disable this test on windows. I think the issue can be permanently solved using some of the SANITIZER_INTERFACE_WEAK_DEF(ReturnType, Name, ...) macros in compiler-rt, but I don't have a Windows machine to test on.

The test disablement on Windows is fine, it just means that Windows isn't getting the new replaceable behaviour.