This is an archive of the discontinued LLVM Phabricator instance.

[msan] Don't unpoison phdrs on dlopen(NULL, 0)
ClosedPublic

Authored by rnk on Nov 18 2015, 4:32 PM.

Details

Summary

dlopen(NULL, ...) is intended to give you back a handle to the
executable for use with dlsym. Casting it to link_map and using it with
ForEachMappedRegion results in a crash.

We also shouldn't unpoison the globals of a DSO that is already in
memory. This ensures that we don't do it for the executable, but in
general, MSan may have false positives if the DSO is already loaded.

Diff Detail

Event Timeline

rnk updated this revision to Diff 40577.Nov 18 2015, 4:32 PM
rnk retitled this revision from to [msan] Don't unpoison phdrs on dlopen(NULL, 0).
rnk updated this object.
rnk added a reviewer: eugenis.
rnk added a subscriber: llvm-commits.
eugenis accepted this revision.Nov 18 2015, 4:49 PM
eugenis edited edge metadata.

Did you mean "false negatives if the DSO is already loaded." ?
LGTM

This revision is now accepted and ready to land.Nov 18 2015, 4:49 PM
rnk added a comment.Nov 18 2015, 4:56 PM

Ah, yeah, false negatives. Thanks!

rnk added a comment.Nov 18 2015, 4:56 PM

By the way, this fixes all the JIT crashes on the msan LLVM bot.

This revision was automatically updated to reflect the committed changes.
In D14795#292323, @rnk wrote:

By the way, this fixes all the JIT crashes on the msan LLVM bot.

This is great. Thanks for working on this.