Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING #820

Closed
apli opened this issue Jun 9, 2017 · 8 comments

Comments

@apli
Copy link

apli commented Jun 9, 2017

I am using gcc 6.3.0, and link ASAN statically by adding link option -static-libasan.

==15947==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
==15947==ASan shadow was supposed to be located in the [0x1ffff000-0x3fffffff] range.
==15947==Process memory map follows:
0x08048000-0x19c7e000 /home/llt/test/utproj
0x19c7e000-0x212cf000 /home/llt/test/utproj
0x212cf000-0x23773000
0xf733c000-0xf74e8000
0xf74e8000-0xf7695000 /lib/i386-linux-gnu/libc-2.17.so
0xf7695000-0xf7697000 /lib/i386-linux-gnu/libc-2.17.so
0xf7697000-0xf7698000 /lib/i386-linux-gnu/libc-2.17.so
0xf7698000-0xf769b000
0xf769b000-0xf76b2000 /lib/i386-linux-gnu/libpthread-2.17.so
0xf76b2000-0xf76b3000 /lib/i386-linux-gnu/libpthread-2.17.so
0xf76b3000-0xf76b4000 /lib/i386-linux-gnu/libpthread-2.17.so
0xf76b4000-0xf76b6000
0xf76b6000-0xf76b9000 /lib/i386-linux-gnu/libdl-2.17.so
0xf76b9000-0xf76ba000 /lib/i386-linux-gnu/libdl-2.17.so
0xf76ba000-0xf76bb000 /lib/i386-linux-gnu/libdl-2.17.so
0xf76bb000-0xf76c2000 /lib/i386-linux-gnu/librt-2.17.so
0xf76c2000-0xf76c3000 /lib/i386-linux-gnu/librt-2.17.so
0xf76c3000-0xf76c4000 /lib/i386-linux-gnu/librt-2.17.so
0xf76c4000-0xf7705000 /lib/i386-linux-gnu/libm-2.17.so
0xf7705000-0xf7706000 /lib/i386-linux-gnu/libm-2.17.so
0xf7706000-0xf7707000 /lib/i386-linux-gnu/libm-2.17.so
0xf7707000-0xf7708000 /lib32/libachk.so
0xf7708000-0xf7709000 /lib32/libachk.so
0xf771f000-0xf7729000
0xf7729000-0xf772a000 [vdso]
0xf772a000-0xf774a000 /lib/i386-linux-gnu/ld-2.17.so
0xf774a000-0xf774b000 /lib/i386-linux-gnu/ld-2.17.so
0xf774b000-0xf774c000 /lib/i386-linux-gnu/ld-2.17.so
0xffcd7000-0xffcf8000 [stack]
==15947==End of process memory map.

@yugr
Copy link

yugr commented Jun 9, 2017

0x08048000-0x19c7e000 /home/llt/test/utproj

Your executable's global variables occupy 298M of memory. This takes too much virtual space and prevents ASan from functioning properly.

You could try running on x64 or refactoring your test to not use so much static data.

@eugenis
Copy link
Contributor

eugenis commented Jun 9, 2017 via email

@apli
Copy link
Author

apli commented Jun 19, 2017

@yugr,Thanks!

@apli
Copy link
Author

apli commented Jun 19, 2017

@eugenis ,
Thanks, I will try!

@apli apli closed this as completed Jun 20, 2017
@Lilujie
Copy link

Lilujie commented Mar 28, 2022

so,how did you solve this problem?

@CLanguagePurist
Copy link

CLanguagePurist commented Jun 22, 2022

I am writing this for everyone who are trying to find a solution to the problem of running sanitizer on Linux and arrive at this thread from googling. The root of the problem is ASLR randomizing address when ASAN required fixed address as you can see here. As you might infers from this problem, you have to disable ASLR on Linux via "nokaslr" option to be able to run sanitizer, but that put you at a potential security risk, so what I would recommends is to do the followings:

  1. Create a virtual machine
  2. Install Linux Distro of your choice
  3. Ensure that Distro does not use hardened linux kernel variant
  4. Configure grub.cfg or whatever boot configuration to include "nokaslr" option at the end of kernel line in the VM
  5. Compile your binary with "-fsanitize=address" for both compile arguments and linker arguments
  6. Reboot VM and simply copy your binary over to VM and run it to view sanitizer output

@stackmystack
Copy link

3. Ensure that Distro does not use hardened linux kernel variant

What distro did you use?

@CLanguagePurist
Copy link

3. Ensure that Distro does not use hardened linux kernel variant

What distro did you use?

Arch Linux on a host machine, I use Hardened Linux Kernel with my own configured SELinux policies. (I write SELinux policies to secure the machine the best I can.)

Also the instructions above are old, but mostly the same, just any Distro would work as long as it is on virtualized guest machine since it seems ASLR isn't running there and ASAN could work fine there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants