Bug 66154 - ReserveShadowMemoryRange test suite errors when memory overcommitting is turned off on Linux
Summary: ReserveShadowMemoryRange test suite errors when memory overcommitting is turn...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: sanitizer (show other bugs)
Version: 4.9.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-15 00:51 UTC by Frank Heckenbach
Modified: 2015-05-15 01:05 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Heckenbach 2015-05-15 00:51:07 UTC

    
Comment 1 Frank Heckenbach 2015-05-15 00:52:10 UTC
Somehow this got sent before the text was inserted, so here goes:

Also reported on Debian, but I was asked to report it here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=785249

When I tried to build gcc on Debian jessie from sources
(debuild -us -uc), I got a number of errors like this:

FAIL: g++.dg/asan/interception-malloc-test-1.C  -O1  output pattern test, is ==25380==ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 0x02008fff7000 (12)
==25380==ReserveShadowMemoryRange failed while trying to map 0xdfff0001000 bytes. Perhaps you're using ulimit -v
, should match malloc call.*(
|
)[^
]*heap-use-after-free

In fact I wasn't using ulimit -v, but I had turned off memory
overcommitting (sysctl: vm.overcommit_memory=2). Obviously I have
less than 14 TB of RAM in my system. ;) After I turned it on, these
errors disappeared.

So I suggest:

- If possible, amend the test to use a more reasonable allocation.
  Not sure what it's actually testing, but I wonder what I can do
  with 14 TB (which is way short of the 64 bit address range) that
  it couldn't do with, say 6 GB (larger than 32 bit range, in case
  that matters). Otherwise:

- In the wording of the message, add "or have turned off memory
  overcommitting" as a possible reason, at least for Linux systems.

- Verify [ `sysctl -n vm.overcommit_memory` -eq 0 ] early in the
  build process, so you don't get to see such errors after a long
  time building.

  Same for a ulimit check if there isn't one already.
Comment 2 Andrew Pinski 2015-05-15 01:05:36 UTC
I think sanitizer in general needs overcommit turned on.  You should file this bug upstream to them.