gopalshankar / address-sanitizer

Automatically exported from code.google.com/p/address-sanitizer
0 stars 0 forks source link

FB10/LLVM/CLANG3.5: Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING. #303

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.
Create a file test.c:

#include <stdio.h>
#include <stdlib.h>
int main(void){
        char * _b=(char*)calloc(1,20);
        free(_b);
        return (0);
}

2. compile
clang -fsanitize=address -O0 -fno-omit-frame-pointer -g3 test.c -o test

3. run ./test

and this is what I get:
==5969==Shadow memory range interleaves with an existing memory mapping. ASan 
cannot proceed correctly. ABORTING.
==5969==Process memory map follows:
    0x000000400000-0x000000457000   /tmp/devel/lab/src/test
    0x000000656000-0x000000657000   /tmp/devel/lab/src/test
    0x000000657000-0x000001290000   
    0x000800656000-0x000800670000   /libexec/ld-elf.so.1
    0x000800670000-0x000800695000   
    0x000800695000-0x000800698000   
    0x00080069b000-0x00080069d000   
    0x00080086f000-0x000800871000   
    0x000800871000-0x00080087e000   /lib/libgcc_s.so.1
    0x00080087e000-0x000800a7d000   
    0x000800a7d000-0x000800a7e000   /lib/libgcc_s.so.1
    0x000800a7e000-0x000800be2000   /lib/libc.so.7
    0x000800be2000-0x000800de2000   
    0x000800de2000-0x000800dee000   /lib/libc.so.7
    0x000800dee000-0x000800e17000   
    0x000800e17000-0x000800e30000   /lib/libthr.so.3
    0x000800e30000-0x00080102f000   
    0x00080102f000-0x000801031000   /lib/libthr.so.3
    0x000801031000-0x00080103c000   
    0x00080103c000-0x000801041000   /usr/lib/librt.so.1
    0x000801041000-0x000801241000   
    0x000801241000-0x000801242000   /usr/lib/librt.so.1
    0x000801242000-0x000801267000   /lib/libm.so.5
    0x000801267000-0x000801467000   
    0x000801467000-0x000801468000   /lib/libm.so.5
    0x000801800000-0x000801c00000   
    0x7fffffbfe000-0x7fffffbff000   
    0x7ffffffdf000-0x7ffffffff000   
    0x7ffffffff000-0x800000000000   
==5969==End of process memory map.

What version of the product are you using? On what operating system?

I'm trying to compile llvm/clang 3.5 from source (svn), on FreeBSD 
10.0-RELEASE-p1 GENERIC amd64
autoconf-2.69
autoconf-wrapper-20131203
automake-1.14
automake-wrapper-20131203
cmake-2.8.12.1_4
cmake-modules-2.8.12.1_1
gmake-3.82_1
libtool-2.4.2_2
llvm33-3.3_8 
m4-1.4.17_1,1
perl5-5.16.3_9 
python27-2.7.6_4

Original issue reported on code.google.com by mr.code...@gmail.com on 30 Apr 2014 at 8:44

GoogleCodeExporter commented 9 years ago
forget to mention that to run this test I'm using this freshly compiled clang 
3.5

Original comment by mr.code...@gmail.com on 30 Apr 2014 at 8:47

GoogleCodeExporter commented 9 years ago
We do not support FreeBSD ourselves, let me contact the folks who did the 
FreeBSD port

Original comment by konstant...@gmail.com on 30 Apr 2014 at 8:50

GoogleCodeExporter commented 9 years ago
Unfortunately the compiler-rt is not included in the version of the llvm 
included/used in the ports (llvm-3.5.r203994). That is why I used the original 
source code from svn.

Also I don't know if this has anything to do with it but I'm running this test 
machine on vmware host.

Original comment by mr.code...@gmail.com on 30 Apr 2014 at 2:37

GoogleCodeExporter commented 9 years ago
Please note that adding FreeBSD support for sanitizers is still in progress. 
Currently, by 'check-all' we pass the common tests with no unexpected failures 
and the next thing to do is to pass Asan tests. By conincidence, the process 
memory mapping is what we are working on these days, so soon there should be a 
patch put on review that address this specific issue with interleaving memory 
regions.

Original comment by kutuzov....@gmail.com on 5 May 2014 at 8:19

GoogleCodeExporter commented 9 years ago

Original comment by konstant...@gmail.com on 6 May 2014 at 8:36

GoogleCodeExporter commented 9 years ago
Thank you for the reply/information. 

Please let me know when you will have any working version - I'll gladly test it.

Original comment by mr.code...@gmail.com on 6 May 2014 at 11:55

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have thi sissue on Linux 64bit.

g++ ./app.cpp -O0 --std=c++0x -pthread -Wall -fsanitize=address 
-fno-omit-frame-pointer

Original comment by ColinTre...@gmail.com on 23 Jul 2014 at 4:44

GoogleCodeExporter commented 9 years ago
With this kernel patch applied:

http://reviews.llvm.org/D3732#21

and this clang patch applied:

http://reviews.llvm.org/D4623

the latest revisions should pass Asan tests on FreeBSD 9.2 without unexpected 
failures. It's also known that at least one of the recent revisions does work 
on FreeBSD 10.0 with a couple minor changes.

Original comment by kutuzov....@gmail.com on 9 Aug 2014 at 11:34

GoogleCodeExporter commented 9 years ago
r218042 pass Asan test without unexpected failures on FreeBSD 10.0 with the 
/usr/src/sys/kern/kern_proc.c file patched and the 
kern.proc_vmmap_skip_resident_count kernel state set to 1. Attached are the 
patched and original versions of the source file.

Original comment by kutuzov....@gmail.com on 22 Sep 2014 at 6:32

Attachments: