[PATCH] [Msan] Generalize mapping facilities to add FreeBSD support

Evgeniy Stepanov eugenis at google.com
Thu Nov 27 01:53:46 PST 2014


================
Comment at: lib/msan/msan.h:66
@@ +65,3 @@
+const uptr kShadowBeg   = 0x100000000000;
+const uptr kShadowSize  = 0x110000000000;
+const uptr kOriginsBeg  = 0x380000000000;
----------------
kutuzov.viktor.84 wrote:
> It shall be 0x210000000000. Otherwise, the patch works as expected on Linux and FreeBSD.
Are you saying you will change it to 0x210..? Please do.


================
Comment at: lib/msan/msan.h:73
@@ +72,3 @@
+    (((uptr)(mem) & ~0xc00000000000ULL) ^ 0x200000000000ULL)
+# define MEM_TO_SHADOW(mem) (LINEARIZE_MEM((mem)) + 0x100000000000ULL)
+#elif SANITIZER_LINUX && SANITIZER_WORDSIZE == 64
----------------
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.


================
Comment at: lib/msan/msan_linux.cc:43
@@ +42,3 @@
+
+static bool TakeMapRange(uptr beg, uptr size, bool protect) {
+  if (size > 0) {
----------------
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.



================
Comment at: lib/msan/msan_linux.cc:58
@@ +57,3 @@
+
+bool InitShadow(bool prot1, bool prot2, bool prot3,
+                bool map_shadow, bool init_origins) {
----------------
prot1 .. prot3 are always true, just remove them

http://reviews.llvm.org/D6387






More information about the llvm-commits mailing list