This is an archive of the discontinued LLVM Phabricator instance.

sanitizer_common: don't write into .rodata
ClosedPublic

Authored by dvyukov on May 10 2021, 4:30 AM.

Details

Summary

setlocale interceptor imitates a write into result,
which may be located in .rodata section.
This is the only interceptor that tries to do this and
I think the intention was to initialize the range for msan.
So do that instead. Writing into .rodata shouldn't happen
(without crashing later on the actual write) and this
traps on my local tsan experiments.

Diff Detail

Event Timeline

dvyukov requested review of this revision.May 10 2021, 4:30 AM
dvyukov created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 10 2021, 4:30 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.May 11 2021, 7:08 PM

Can you make compiler-rt/test/sanitizer_common/TestCases/setlocale.cpp to fail without patch?

This revision is now accepted and ready to land.May 11 2021, 7:08 PM
This revision was landed with ongoing or failed builds.May 11 2021, 10:54 PM
This revision was automatically updated to reflect the committed changes.

Can you make compiler-rt/test/sanitizer_common/TestCases/setlocale.cpp to fail without patch?

It's not possible now. Currently tsan handles it and that's why we did not notice it earlier (it would crash on our internal codebase otherwise).
I noticed it only while making some significant changes to tsan runtime.