[compiler-rt] r238109 - [msan] Mprotect all inaccessible memory regions.

H.J. Lu hjl.tools at gmail.com
Tue May 26 08:21:52 PDT 2015


On Sat, May 23, 2015 at 7:47 PM, Evgeniy Stepanov
<eugeni.stepanov at gmail.com> wrote:
> Author: eugenis
> Date: Sat May 23 21:47:59 2015
> New Revision: 238109
>
> URL: http://llvm.org/viewvc/llvm-project?rev=238109&view=rev
> Log:
> [msan] Mprotect all inaccessible memory regions.
>
> Fix 2 bugs in memory mapping setup:
> - the invalid region at offset 0 was not protected because mmap at
>   address 0 fails with EPERM on most Linux systems. We did not
>   notice this because the check condition was flipped: the code was
>   checking that mprotect has failed. And the test that was supposed
>   to catch this was weakened by the mitigations in the mmap
>   interceptor.
> - when running without origins, the origin shadow range was left
>   unprotected.
>
> The new test ensures that mmap w/o MAP_FIXED always returns valid
> application addresses.
>
> Added:
>     compiler-rt/trunk/test/msan/mmap.cc
> Modified:
>     compiler-rt/trunk/lib/msan/msan.cc
>     compiler-rt/trunk/lib/msan/msan.h
>     compiler-rt/trunk/lib/msan/msan_linux.cc
>

On Fedora 20/x86-64, I got

Exit Code: 134

Command Output (stdout):
--
0xffffffffffffffff
successful mappings: 0

--
Command Output (stderr):
--
mmap.cc.tmp: /export/gnu/import/git/llvm/projects/compiler-rt/test/msan/mmap.cc:41:
int main(): Assertion `success_count > 5' failed.
/export/build/gnu/llvm-clang-bootstrap-cmake/stage1/build-x86_64-linux/projects/compiler-rt/test/msan/Output/mmap.cc.script:
line 2: 32283 Aborted
/export/build/gnu/llvm-clang-bootstrap-cmake/stage1/build-x86_64-linux/projects/compiler-rt/test/msan/Output/mmap.cc.tmp


-- 
H.J.



More information about the llvm-commits mailing list