This is an archive of the discontinued LLVM Phabricator instance.

Add a `Symbolizer::GetEnvP()` method that allows symbolizer implementations to customise the environment of the symbolizer binary.
ClosedPublic

Authored by delcypher on Mar 23 2020, 9:05 PM.

Details

Summary

This change introduces the Symbolizer::GetEnvP() method that returns a
pointer to environment array used for spawning the symbolizer process.
The motivation is to allow implementations to customise the environment
if required. The default implementation just returns
__sanitizer::GetEnviron() which (provided it's implemented) should
preserve the existing behaviours of the various implementations.

This change has been plumbed through the internal_spawn(...) and
StartSubprocess(...) process spawning implementations.

For the StartSubprocess() implementation we need to call execve()
rather than execv() to pass the environment. However, it appears that
internal_execve(...) exists in sanitizer_common so this patch uses that
which seems like a nice clean up.

Support in the Windows implementation of
SymbolizerProcess:StartSymbolizerSubprocess() has not been added
because the Windows sanitizer runtime doesn't implement GetEnviron().

rdar://problem/58789439

Diff Detail

Event Timeline

delcypher created this revision.Mar 23 2020, 9:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2020, 9:05 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Mar 24 2020, 1:40 AM
This revision is now accepted and ready to land.Mar 24 2020, 1:40 AM
delcypher edited the summary of this revision. (Show Details)Mar 24 2020, 11:00 AM

Make GetEnvP() protected rather private so sub-class implementation can call the parent function.

@vitalybuka Thanks for the review. I just discovered that GetEnvP() needs to be protected rather than private so it can be called by subclass implementations so I've updated this patch to do that. If you're happy with this could you approve again?

vitalybuka accepted this revision.Mar 24 2020, 12:59 PM
This revision was automatically updated to reflect the committed changes.