This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/55517] [ASAN] ASAN doesn't work with (soft) ulimit on virtual memory
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Nov 2012 13:00:27 +0000
- Subject: [Bug sanitizer/55517] [ASAN] ASAN doesn't work with (soft) ulimit on virtual memory
- Auto-submitted: auto-generated
- References: <bug-55517-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55517
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-28 13:00:27 UTC ---
I think raising soft limit is a standard approach done in multiple places, even
gcc itself does that, and is far better than just crashing. Unlike
RLIMIT_STACK, it doesn't cause significant problems if you enlarge RLIMIT_AS
during the runtime of a program as opposed to making sure it is big enough
already at process start.
You don't need to call getrlimit unconditionally, all you can do is upon mmap
MAP_FAILED on these 3 large mmap calls you try to do getrlimit and if hard
limit is bigger than what is needed and soft limit smaller, increase, setrlimit
and retry the mmap.