<div dir="ltr">+pcc<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 21, 2014 at 8:59 PM, Frederico Araujo <span dir="ltr"><<a href="mailto:araujof@gmail.com" target="_blank">araujof@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I created an example program to learn how to use the clang dataflow sanitizer and noticed that when the program is compiled with the -fsanitize=dataflow option, the application and its shared libraries are mapped differently to memory. My question is why the program section is relocated to higher addresses and shared objects appear to be relocated below the heap?</div>
</div></blockquote><div><br></div><div>This happens because -fsanitize=dataflow implies -pie which changes the mapping the way you describe. </div><div>tsan (--fsanitize=tread) and msan (-fsanitize=memory) behave the same way. </div>
<div>This is intentional, such mapping makes the implementation more efficient. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div> For instance, see below the two memory maps for the same program compiled without/with the dataflow sanitizer option.</div>
<div><br></div><div>Is this necessary for the memory shadowing mechanism used by the sanitizer? I'd really appreciate if someone could explain the design decision behind these remappings. </div><div>Ultimately, I'd like to know if it's possible to keep the program mapped to its original low addresses without hurting the dataflow sanitizer assumptions.<br>
</div></div></blockquote><div><br></div><div>for msan not using -pie would be a significant performance hit, and dfsan is rather similar to msan. <br></div><div>pcc, please correct me if I am wrong. </div><div>for tsan this will be less of an issue, but still undesirable. </div>
<div><br></div><div>Why does this bother you? </div><div><br></div><div>--kcc </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>
</div><div><br></div><div><div># Without sanitizer</div><div>00400000-00401000 r-xp 00000000 08:01 2491706 /home/frederico/dev/tests/llvm/labelprop/loop</div><div>00600000-00601000 r--p 00000000 08:01 2491706 /home/frederico/dev/tests/llvm/labelprop/loop</div>
<div>00601000-00602000 rw-p 00001000 08:01 2491706 /home/frederico/dev/tests/llvm/labelprop/loop</div><div>01169000-0118a000 rw-p 00000000 00:00 0 [heap]</div><div>
7ffb4531d000-7ffb454d9000 r-xp 00000000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div><div>7ffb454d9000-7ffb456d8000 ---p 001bc000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div>
<div>7ffb456d8000-7ffb456dc000 r--p 001bb000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div><div>7ffb456dc000-7ffb456de000 rw-p 001bf000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div>
<div>7ffb456de000-7ffb456e3000 rw-p 00000000 00:00 0 </div><div>7ffb456e3000-7ffb45706000 r-xp 00000000 08:01 1338667 /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a></div>
<div>7ffb458e9000-7ffb458ec000 rw-p 00000000 00:00 0 </div>
<div>7ffb45902000-7ffb45905000 rw-p 00000000 00:00 0 </div><div>7ffb45905000-7ffb45906000 r--p 00022000 08:01 1338667 /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a></div>
<div>7ffb45906000-7ffb45907000 rw-p 00023000 08:01 1338667 /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a></div>
<div>7ffb45907000-7ffb45908000 rw-p 00000000 00:00 0 </div><div>7fff6d64d000-7fff6d66e000 rw-p 00000000 00:00 0 [stack]</div><div>7fff6d7fe000-7fff6d800000 r-xp 00000000 00:00 0 [vdso]</div>
<div>ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]</div><div><br></div><div># With sanitizer</div><div>00010000-200200000000 rw-p 00000000 00:00 0 </div><div>200200000000-700000008000 ---p 00000000 00:00 0 </div>
<div>7f8068983000-7f8068b3f000 r-xp 00000000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div><div>7f8068b3f000-7f8068d3e000 ---p 001bc000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div>
<div>7f8068d3e000-7f8068d42000 r--p 001bb000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div><div>7f8068d42000-7f8068d44000 rw-p 001bf000 08:01 1338668 /lib/x86_64-linux-gnu/<a href="http://libc-2.19.so" target="_blank">libc-2.19.so</a></div>
<div>7f8068d44000-7f8068d49000 rw-p 00000000 00:00 0 </div><div>7f8068d49000-7f8068d5f000 r-xp 00000000 08:01 1314808 /lib/x86_64-linux-gnu/libgcc_s.so.1</div><div>7f8068d5f000-7f8068f5e000 ---p 00016000 08:01 1314808 /lib/x86_64-linux-gnu/libgcc_s.so.1</div>
<div>7f8068f5e000-7f8068f5f000 rw-p 00015000 08:01 1314808 /lib/x86_64-linux-gnu/libgcc_s.so.1</div><div>7f8068f5f000-7f8068f62000 r-xp 00000000 08:01 1338681 /lib/x86_64-linux-gnu/<a href="http://libdl-2.19.so" target="_blank">libdl-2.19.so</a></div>
<div>7f8068f62000-7f8069161000 ---p 00003000 08:01 1338681 /lib/x86_64-linux-gnu/<a href="http://libdl-2.19.so" target="_blank">libdl-2.19.so</a></div><div>7f8069161000-7f8069162000 r--p 00002000 08:01 1338681 /lib/x86_64-linux-gnu/<a href="http://libdl-2.19.so" target="_blank">libdl-2.19.so</a></div>
<div>7f8069162000-7f8069163000 rw-p 00003000 08:01 1338681 /lib/x86_64-linux-gnu/<a href="http://libdl-2.19.so" target="_blank">libdl-2.19.so</a></div><div>7f8069163000-7f8069268000 r-xp 00000000 08:01 1338671 /lib/x86_64-linux-gnu/<a href="http://libm-2.19.so" target="_blank">libm-2.19.so</a></div>
<div>7f8069268000-7f8069467000 ---p 00105000 08:01 1338671 /lib/x86_64-linux-gnu/<a href="http://libm-2.19.so" target="_blank">libm-2.19.so</a></div><div>7f8069467000-7f8069468000 r--p 00104000 08:01 1338671 /lib/x86_64-linux-gnu/<a href="http://libm-2.19.so" target="_blank">libm-2.19.so</a></div>
<div>7f8069468000-7f8069469000 rw-p 00105000 08:01 1338671 /lib/x86_64-linux-gnu/<a href="http://libm-2.19.so" target="_blank">libm-2.19.so</a></div><div>7f8069469000-7f8069470000 r-xp 00000000 08:01 1338685 /lib/x86_64-linux-gnu/<a href="http://librt-2.19.so" target="_blank">librt-2.19.so</a></div>
<div>7f8069470000-7f806966f000 ---p 00007000 08:01 1338685 /lib/x86_64-linux-gnu/<a href="http://librt-2.19.so" target="_blank">librt-2.19.so</a></div><div>7f806966f000-7f8069670000 r--p 00006000 08:01 1338685 /lib/x86_64-linux-gnu/<a href="http://librt-2.19.so" target="_blank">librt-2.19.so</a></div>
<div>7f8069670000-7f8069671000 rw-p 00007000 08:01 1338685 /lib/x86_64-linux-gnu/<a href="http://librt-2.19.so" target="_blank">librt-2.19.so</a></div><div>7f8069671000-7f806968a000 r-xp 00000000 08:01 1338684 /lib/x86_64-linux-gnu/<a href="http://libpthread-2.19.so" target="_blank">libpthread-2.19.so</a></div>
<div>7f806968a000-7f8069889000 ---p 00019000 08:01 1338684 /lib/x86_64-linux-gnu/<a href="http://libpthread-2.19.so" target="_blank">libpthread-2.19.so</a></div><div>7f8069889000-7f806988a000 r--p 00018000 08:01 1338684 /lib/x86_64-linux-gnu/<a href="http://libpthread-2.19.so" target="_blank">libpthread-2.19.so</a></div>
<div>7f806988a000-7f806988b000 rw-p 00019000 08:01 1338684 /lib/x86_64-linux-gnu/<a href="http://libpthread-2.19.so" target="_blank">libpthread-2.19.so</a></div><div>7f806988b000-7f806988f000 rw-p 00000000 00:00 0 </div>
<div>7f806988f000-7f80698b2000 r-xp 00000000 08:01 1338667 /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a></div><div>7f8069a93000-7f8069a98000 rw-p 00000000 00:00 0 </div>
<div>7f8069aab000-7f8069ab1000 rw-p 00000000 00:00 0 </div>
<div>7f8069ab1000-7f8069ab2000 r--p 00022000 08:01 1338667 /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a></div><div>7f8069ab2000-7f8069ab3000 rw-p 00023000 08:01 1338667 /lib/x86_64-linux-gnu/<a href="http://ld-2.19.so" target="_blank">ld-2.19.so</a></div>
<div>7f8069ab3000-7f8069ab4000 rw-p 00000000 00:00 0 </div><div>7f8069ab4000-7f8069ad4000 r-xp 00000000 08:01 2491855 /home/frederico/dev/tests/llvm/labelprop/loop2</div><div>7f8069cd3000-7f8069cd4000 r--p 0001f000 08:01 2491855 /home/frederico/dev/tests/llvm/labelprop/loop2</div>
<div>7f8069cd4000-7f8069cd5000 rw-p 00020000 08:01 2491855 /home/frederico/dev/tests/llvm/labelprop/loop2</div><div>7f8069cd5000-7f806a86a000 rw-p 00000000 00:00 0 </div><div>7f806aeec000-7f806af0d000 rw-p 00000000 00:00 0 [heap]</div>
<div>7fff2b930000-7fff2b951000 rw-p 00000000 00:00 0 [stack]</div><div>7fff2b9fe000-7fff2ba00000 r-xp 00000000 00:00 0 [vdso]</div><div>ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]</div>
</div><div><br></div><div>Thanks,</div><div>Fred</div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>