This is an archive of the discontinued LLVM Phabricator instance.

[Msan] Generalize mapping facilities to add FreeBSD support
ClosedPublic

Authored by kutuzov.viktor.84 on Nov 24 2014, 10:50 AM.

Diff Detail

Event Timeline

kutuzov.viktor.84 retitled this revision from to [Msan] Generalize mapping facilities to add FreeBSD support.
kutuzov.viktor.84 updated this object.
kutuzov.viktor.84 edited the test plan for this revision. (Show Details)
kutuzov.viktor.84 added reviewers: kcc, samsonov.
kutuzov.viktor.84 added subscribers: Unknown Object (MLST), emaste.
lib/msan/msan_linux.cc
108–109

Ah, these calls should be rewritten to check returning values.

Updated.

  • Fixed the #if condition for the case of __mips64.
  • SHADOW_TO_ORIGIN() moved out from the platform-specific sections.
  • InitShadow replaced with __msan_init in the diagnostic message.
  • The calls to TakeMapRange() fixed to check returning values.
  • Minor spacing fixes.

Fixed parameter names for the case of FreeBSD.

lib/msan/msan.h
66

It shall be 0x210000000000. Otherwise, the patch works as expected on Linux and FreeBSD.

eugenis added inline comments.Nov 27 2014, 1:53 AM
lib/msan/msan.h
66

Are you saying you will change it to 0x210..? Please do.

73

Please take a look at https://code.google.com/p/memory-sanitizer/issues/detail?id=76
I wonder if it is applicable to FreeBSD as well.

lib/msan/msan_linux.cc
43

TakeMemoryRange

I don't like that it's asymmetrical, i.e. "check that memory is available and maybe protect it". Makes it hard to find a good name for the function.

Please either make it "check and either protect or reserve", or just do everything in InitShadow.

58

prot1 .. prot3 are always true, just remove them

Updated:

  • TakeMapRange() is split into two different functions;
  • The prot1 and prot2 parameters removed;
  • The kShadowSize value fixed;
  • A minor fix for the code-in-app-range check.

Please take a look at https://code.google.com/p/memory-sanitizer/issues/detail?id=76
I wonder if it is applicable to FreeBSD as well.

Umm, I suspect we can't really reserve 600000000000-7cffffffffff for Msan needs on FreeBSD. Ed, can you please confirm that?

eugenis accepted this revision.Nov 27 2014, 6:27 AM
eugenis edited edge metadata.

LGTM

lib/msan/msan.h
36

There are no "traces" in MSan.

This revision is now accepted and ready to land.Nov 27 2014, 6:27 AM
Diffusion closed this revision.Nov 28 2014, 3:43 AM
Diffusion updated this revision to Diff 16719.

Closed by commit rL222919 (authored by vkutuzov).