This is an archive of the discontinued LLVM Phabricator instance.

Unbreak ASan runtime in the simulators.
ClosedPublic

Authored by delcypher on Apr 20 2020, 5:32 PM.

Details

Summary

861b69faee5df8d4e13ef316c7474a10e4069e81 (rdar://problem/58789439) while
fixing symbolization for TSan completely broke ASan's runtime for the
simulators.

The problem with the previous patch is that the memory passed to
putenv() was poisoned and when passed to putenv() it tripped
an interceptor for strchr() which saw the memory was poisoned and
raised an ASan issue.

The memory was poisoned because AtosSymbolizerProcess objects
are created using ASan's internal allocator. Memory from this
allocator gets poisoned with kAsanInternalHeapMagic.

To workaround this, this patch makes the memory for the environment
variable entry a global variable that isn't poisoned.

This pass also adds a DCHECK(getenv(K_ATOS_ENV_VAR)) because the
following DCHECK would crash because internal_strcmp() doesn't
work on nullptr.

rdar://problem/62067724

Diff Detail

Event Timeline

delcypher created this revision.Apr 20 2020, 5:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2020, 5:33 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
kubamracek accepted this revision.Apr 20 2020, 6:05 PM
This revision is now accepted and ready to land.Apr 20 2020, 6:05 PM
yln accepted this revision.Apr 20 2020, 6:19 PM
This revision was automatically updated to reflect the committed changes.