Bug 55679 - new asan tests from r194458 fail on x86_64-apple-darwin10
Summary: new asan tests from r194458 fail on x86_64-apple-darwin10
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: sanitizer (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-13 22:14 UTC by Jack Howarth
Modified: 2013-01-23 17:34 UTC (History)
4 users (show)

See Also:
Host: x86_64-apple-darwin*
Target: x86_64-apple-darwin*
Build: x86_64-apple-darwin*
Known to work:
Known to fail:
Last reconfirmed: 2012-12-14 00:00:00


Attachments
assembly file for c-c++-common/asan/global-overflow-1.c -O1 execution test on x86_64-apple-darwin10 (3.12 KB, text/plain)
2012-12-14 00:05 UTC, Jack Howarth
Details
assembly file for c-c++-common/asan/rlimit-mmap-test-1.c -O0 execution test on x86_64-apple-darwin10 (3.25 KB, text/plain)
2012-12-14 00:11 UTC, Jack Howarth
Details
assembly file for c-c++-common/asan/stack-overflow-1.c -O1 execution test on x86_64-apple-darwin10 (3.35 KB, text/plain)
2012-12-14 00:17 UTC, Jack Howarth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Howarth 2012-12-13 22:14:17 UTC
Some of the new tests added in r194458 fail on x86_64-apple-darwin. These failures include...

FAIL: c-c++-common/asan/global-overflow-1.c  -O1  execution test
FAIL: c-c++-common/asan/global-overflow-1.c  -O2  execution test
FAIL: c-c++-common/asan/global-overflow-1.c  -O3 -fomit-frame-pointer  execution test
FAIL: c-c++-common/asan/global-overflow-1.c  -O3 -g  execution test
FAIL: c-c++-common/asan/global-overflow-1.c  -Os  execution test
FAIL: c-c++-common/asan/global-overflow-1.c  -O2 -flto -flto-partition=none  execution test
FAIL: c-c++-common/asan/global-overflow-1.c  -O2 -flto  execution test
FAIL: c-c++-common/asan/rlimit-mmap-test-1.c  -O0  execution test
FAIL: c-c++-common/asan/stack-overflow-1.c  -O1  execution test
FAIL: c-c++-common/asan/stack-overflow-1.c  -O2  execution test
FAIL: c-c++-common/asan/stack-overflow-1.c  -O3 -fomit-frame-pointer  execution test
FAIL: c-c++-common/asan/stack-overflow-1.c  -O3 -g  execution test
FAIL: c-c++-common/asan/stack-overflow-1.c  -Os  execution test
FAIL: c-c++-common/asan/stack-overflow-1.c  -O2 -flto -flto-partition=none  execution test
FAIL: c-c++-common/asan/stack-overflow-1.c  -O2 -flto  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O0  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O1  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O2  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -fomit-frame-pointer  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -fomit-frame-pointer -funroll-loops  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -g  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -Os  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O2 -flto -flto-partition=none  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O2 -flto  (test for excess errors)


FAIL: c-c++-common/asan/rlimit-mmap-test-1.c  -O0  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O0  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O1  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O2  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -fomit-frame-pointer  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -fomit-frame-pointer -funroll-loops  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O3 -g  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -Os  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O2 -flto -flto-partition=none  (test for excess errors)
FAIL: c-c++-common/asan/swapcontext-test-1.c  -O2 -flto  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -O0  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -O1  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -O2  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -O3 -fomit-frame-pointer  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -O3 -g  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -Os  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -O2 -flto -flto-partition=none  (test for excess errors)
FAIL: g++.dg/asan/interception-test-1.C  -O2 -flto  (test for excess errors)

at both -m32 and -m64.
Comment 1 Jack Howarth 2012-12-13 22:16:22 UTC
=================================================================
==47584== ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000214a at pc 0x1ba6 bp 0xbfffc9c8 sp 0xbfffc9bc
READ of size 1 at 0x0000214a thread T0
    #0 0x1ba5 (/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/gcc/./global-overflow-1.exe+0x1ba5)
    #1 0x19c4 (/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/gcc/./global-overflow-1.exe+0x19c4)
    #2 0x0 (/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/gcc/./global-overflow-1.exe+0x0)
0x0000214a is located 0 bytes to the right of global variable 'YYY (/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/global-overflow-1.c)' (0x2140) of size 10
  'YYY (/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/global-overflow-1.c)' is ascii string ''
Shadow byte and word:
  0x20000429: 2
  0x20000428: 00 02 f9 f9
More shadow bytes:
  0x20000418: 00 00 00 00
  0x2000041c: 00 00 00 00
  0x20000420: 00 02 f9 f9
  0x20000424: f9 f9 f9 f9
=>0x20000428: 00 02 f9 f9
  0x2000042c: f9 f9 f9 f9
  0x20000430: 00 02 f9 f9
  0x20000434: f9 f9 f9 f9
  0x20000438: 00 00 00 00
Stats: 0M malloced (0M for red zones) by 0 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 0 calls
Stats: 0M really freed by 0 calls
Stats: 0M (0 full pages) mmaped in 0 calls
  mmaps   by size class:
  mallocs by size class:
  frees   by size class:
  rfrees  by size class:
Stats: malloc large: 0 small slow: 0
==47584== ABORTING
Executing on host: addr2line -f -e /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/gcc/./global-overflow-1.exe 0x1ba5 0x19c4 0x0   (timeout = 300)
PASS: c-c++-common/asan/global-overflow-1.c  -O0  execution test
PASS: c-c++-common/asan/global-overflow-1.c  -O0  output pattern test, READ of size 1 at 0x[0-9a-f]+ thread T0.*(
|^M
|^M)    #0 0x[0-9a-f]+ (in _*main ([^
^M]*global-overflow-1.c:15|[^
^M]*:0)|[(])[^
^M]*(
|^M
|^M).*0x[0-9a-f]+ is located 0 bytes to the right of global variable.*YYY[^
^M]* of size 10[^
^M]*(
|^M
|^M)
Comment 2 Jack Howarth 2012-12-13 22:20:55 UTC
Ignore Comment 1. The actual failures produce no particular error messages and can't be reproduced by hand for the c-c++-common/asan/global-overflow-1.c  -O1  execution test....

Executing on host: /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/global-overflow-1.c   -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs  -fsanitize=address -g -fno-diagnostics-show-caret   -O1  -fno-builtin-memset  -lm   -m32 -o ./global-overflow-1.exe    (timeout = 300)
PASS: c-c++-common/asan/global-overflow-1.c  -O1  (test for excess errors)
Setting LD_LIBRARY_PATH to :/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc:/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs::/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc:/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs:/usr/local/NMRPipe/nmrbin.mac/lib
FAIL: c-c++-common/asan/global-overflow-1.c  -O1  execution test
Comment 3 Jack Howarth 2012-12-14 00:05:51 UTC
Created attachment 28946 [details]
assembly file for c-c++-common/asan/global-overflow-1.c  -O1  execution test on x86_64-apple-darwin10

Generated with...

/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/global-overflow-1.c -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs -fsanitize=address -g -fno-diagnostics-show-caret -O1 -fno-builtin-memset -lm -m32 -o ./global-overflow-1.exe --save-temps

for failing c-c++-common/asan/global-overflow-1.c  -O1  execution test on x86_64-apple-darwin10. The resulting executable runs without crashing or triggering in libasan...

# ./global-overflow-1.exe                                                                                                            #
Comment 4 Jack Howarth 2012-12-14 00:11:30 UTC
Created attachment 28947 [details]
assembly file for c-c++-common/asan/rlimit-mmap-test-1.c  -O0  execution test on x86_64-apple-darwin10

Generated with...

/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs -fsanitize=address -g -fno-diagnostics-show-caret -O0 -lm -m32 -o ./rlimit-mmap-test-1.exe --save-temps

for failing c-c++-common/asan/rlimit-mmap-test-1.c  -O0  execution test on x86_64-apple-darwin10. The resulting executable runs without crashing or
triggering in libasan...

# ./rlimit-mmap-test-1.exe
#
Comment 5 Jack Howarth 2012-12-14 00:17:22 UTC
Created attachment 28948 [details]
assembly file for c-c++-common/asan/stack-overflow-1.c  -O1  execution test on x86_64-apple-darwin10

Generated with...

/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs -fsanitize=address -g -fno-diagnostics-show-caret -O1 -fno-builtin-memset -lm -m32 -o ./stack-overflow-1.exe --save-temps

for failing c-c++-common/asan/stack-overflow-1.c  -O1  execution test x86_64-apple-darwin10. The resulting executable runs without crashing or triggering in libasan...

# ./stack-overflow-1.exe
#
Comment 6 Jack Howarth 2012-12-14 00:19:58 UTC
The c-c++-common/asan/swapcontext-test-1.c  test for excess errors failures are all of the form...


Executing on host: /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ swapcontext_available47450.c   -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs  -fsanitize=address -g -fno-diagnostics-show-caret  -fno-builtin  -lm   -m32 -o swapcontext_available47450.exe    (timeout = 300)
Executing on host: /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c   -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs  -fsanitize=address -g -fno-diagnostics-show-caret   -O0    -lm   -m32 -o ./swapcontext-test-1.exe    (timeout = 300)
In file included from /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:6:0:^M
/usr/include/ucontext.h:42:2: error: #error ucontext routines are deprecated, and require _XOPEN_SOURCE to be defined^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:9:1: error: unknown type name 'ucontext_t'^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:10:1: error: unknown type name 'ucontext_t'^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c: In function 'Run':^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:33:16: error: request for member 'uc_stack' in something not a structure or union^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:34:16: error: request for member 'uc_stack' in something not a structure or union^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:36:18: error: request for member 'uc_link' in something not a structure or union^M
compiler exited with status 1
output is:
In file included from /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:6:0:^M
/usr/include/ucontext.h:42:2: error: #error ucontext routines are deprecated, and require _XOPEN_SOURCE to be defined^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:9:1: error: unknown type name 'ucontext_t'^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:10:1: error: unknown type name 'ucontext_t'^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c: In function 'Run':^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:33:16: error: request for member 'uc_stack' in something not a structure or union^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:34:16: error: request for member 'uc_stack' in something not a structure or union^M
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/c-c++-common/asan/swapcontext-test-1.c:36:18: error: request for member 'uc_link' in something not a structure or union^M

FAIL: c-c++-common/asan/swapcontext-test-1.c  -O0  (test for excess errors)
Comment 7 Jack Howarth 2012-12-14 00:22:31 UTC
The g++.dg/asan/interception-test-1.C test for excess errors failures are all of the form...

Executing on host: /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/g++/../../xg++ -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/g++/../../ /sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/gcc/testsuite/g++.dg/asan/interception-test-1.C  -fsanitize=address -g -fno-diagnostics-show-caret  -nostdinc++ -I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libstdc++-v3/include/x86_64-apple-darwin10.8.0 -I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libstdc++-v3/include -I/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121213/libstdc++-v3/testsuite/util -fmessage-length=0  -O0  -fno-builtin-malloc -fno-builtin-free    -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libsanitizer/asan/.libs   -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libstdc++-v3/src/.libs  -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libstdc++-v3/src/.libs  -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin10.8.0/i386/libstdc++-v3/src/.libs  -multiply_defined suppress -lm   -m32 -o ./interception-test-1.exe    (timeout = 300)
Undefined symbols for architecture i386:^M
  "___interceptor_strtol", referenced from:^M
      _strtol in ccYdXB2Q.o^M
ld: symbol(s) not found for architecture i386^M
collect2: error: ld returned 1 exit status^M
compiler exited with status 1
output is:
Undefined symbols for architecture i386:^M
  "___interceptor_strtol", referenced from:^M
      _strtol in ccYdXB2Q.o^M
ld: symbol(s) not found for architecture i386^M
collect2: error: ld returned 1 exit status^M

FAIL: g++.dg/asan/interception-test-1.C  -O0  (test for excess errors)
Comment 8 Jack Howarth 2012-12-14 00:36:10 UTC
The g++.dg/asan/interception-test-1.C  test should have...

// { dg-skip-if ""  { { *-*-darwin* } { "*" } { "" } }

since darwin uses mac function interposition rather than interception.
Comment 9 Jack Howarth 2012-12-14 00:45:26 UTC
The c-c++-common/asan/swapcontext-test-1.c test case should have...

// { dg-skip-if "" { *-*-darwin* } { "*" } { "" } }

since ucontext support was depreciated in Mac OS X 10.6 and removed entirely in Mac OS X 10.7.
Comment 10 Jack Howarth 2012-12-14 01:23:42 UTC
Patch posted to skip the invalid g++.dg/asan/interception-test-1.C and c-c++-common/asan/swapcontext-test-1.c on darwin...

http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00952.html
Comment 11 Dominique d'Humieres 2012-12-14 07:21:35 UTC
Confirmed.
Comment 12 Dominique d'Humieres 2012-12-14 16:23:51 UTC
c-c++-common/asan/global-overflow-1.c and c-c++-common/asan/stack-overflow-1.c fail at -O1 and above because the out of bound read is not detected. If I compile the tests with '-O1 -fno-tree-fre' or '-Ox -fno-tree-fre -fno-tree-pre' (with x==2 or above), I get the expected output. Is this a bug in tree-fre/pre or should these options be passed to the test?
Comment 13 Jack Howarth 2012-12-14 21:24:33 UTC
Perhaps this is a red-herring, but comparing the assembly files for stack-overflow-1.s and global-overflow-1.s generated on darwin and linux, I notice that the linux assembly always has at least one instance of __asan_report_load1 whereas only the assembly for -O0 on darwin shows a call to ___asan_report_load1. At the higher optimizations that fail to detect the out of bound read, these calls to ___asan_report_load1 are missing.
Comment 14 Dominique d'Humieres 2012-12-14 23:31:37 UTC
Concerning the failure of c-c++-common/asan/rlimit-mmap-test-1.c, I have looked at the man for setrlimit. For Linux I see:

RLIMIT_AS
...
RLIMIT_CORE
...
RLIMIT_CPU
...
RLIMIT_DATA
...
RLIMIT_FSIZE
...
RLIMIT_LOCKS (Early Linux 2.4 only)
...
RLIMIT_MEMLOCK
...
RLIMIT_MSGQUEUE (Since Linux 2.6.8)
...
RLIMIT_NICE (since Linux 2.6.12, but see BUGS below)
...
RLIMIT_NOFILE
...
RLIMIT_NPROC
...
RLIMIT_RSS
...
RLIMIT_RTPRIO (Since Linux 2.6.12, but see BUGS)
...
RLIMIT_RTTIME (Since Linux 2.6.25)
...
RLIMIT_SIGPENDING (Since Linux 2.6.8)
...
RLIMIT_STACK
...

But for darwin I only see:

RLIMIT_CORE 
...
RLIMIT_CPU 
...
RLIMIT_DATA
...
RLIMIT_FSIZE
...
RLIMIT_MEMLOCK
...
RLIMIT_NOFILE
...
RLIMIT_NPROC 
...
RLIMIT_RSS
...
RLIMIT_STACK
...
Comment 15 Jack Howarth 2012-12-15 03:09:31 UTC
The absence of RLIMIT_AS support on darwin appears to be a longstanding issue...

http://lists.apple.com/archives/Unix-porting/2007/Apr/msg00026.html

and really should be fixed since SUSv3 Unix (which darwin claims to be) demands it.
Comment 16 Dominique d'Humieres 2012-12-16 18:23:24 UTC
(In reply to comments #12 and #13)
With -O1, the invalid tests c-c++-common/asan/global-overflow-1.c and c-c++-common/asan/stack-overflow-1.c are optimized to a valid "return 0" as shown by the following differences between the outputs of -dump-tree-optimized with and without -fno-tree-fre:

--- stack-overflow-1.c.164t.optimized	2012-12-16 17:26:13.000000000 +0100
+++ stack-overflow-1.c.164t_f.optimized	2012-12-16 17:25:13.000000000 +0100
@@ -3,18 +3,14 @@
 
 main ()
 {
-  int res;
   char x[10];
   int ten.1;
-  char _4;
 
   <bb 2>:
   __builtin_memset (&x, 0, 10);
   ten.1_3 ={v} ten;
-  _4 = x[ten.1_3];
-  res_5 = (int) _4;
   x ={v} {CLOBBER};
-  return res_5;
+  return 0;
 
 }
 
So the problem for these two tests has nothing to do with asan. Note that they regress cleanly if I add '-fno-tree-fre -fno-tree-pre' to '-fno-builtin-memset' in the dg-options. The optimization is also defeated If I add a line such as

  x[1] = 1;

Although I doubt this behavior is a bug, I'll open a new PR for it tomorrow unless there is some objection.
Comment 17 Dominique d'Humieres 2012-12-16 21:41:25 UTC
(In reply to comment #15)
> The absence of RLIMIT_AS support on darwin appears to be a longstanding
> issue...
>
> http://lists.apple.com/archives/Unix-porting/2007/Apr/msg00026.html
>
> and really should be fixed since SUSv3 Unix (which darwin claims to be) demands
> it.

I have investigated the behavior of get/setrlimit(RLIMIT_AS...):

(1) looking at sys/resource.h it appears that RLIMIT_AS is an (undocumented) alias of RLIMIT_RSS.
(2) RLIMIT_AS seems to be correctly gotten/set by get/setrlimit.
(3) However this does seems to affect the behavior of malloc.

The following patch fixes the failure

--- ../_clean/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c	2012-12-13 11:08:19.000000000 +0100
+++ gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c	2012-12-16 21:11:59.000000000 +0100
@@ -2,7 +2,7 @@
 
 /* { dg-do run { target setrlimit } } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
-/* { dg-shouldfail "asan" } */
+/* { dg-shouldfail "asan" { ! *-*-darwin* } } */
 
 #include <stdlib.h>
 #include <assert.h>
@@ -18,4 +18,4 @@ int main(int argc, char **argv) {
   return 0;
 }
 
-/* { dg-output "AddressSanitizer is unable to mmap" } */
+/* { dg-output "AddressSanitizer is unable to mmap" { xfail *-*-darwin* } } */
Comment 18 Jack Howarth 2012-12-18 15:15:38 UTC
(In reply to comment #16)

I am puzzled as to why this issue with global-overflow-1.c and stack-overflow-1.c can't be triggered on x86_64 linux. The obvious change of -mtune=core2 seems to be insufficient to cause the failures.
Comment 19 mrs@gcc.gnu.org 2013-01-17 21:29:01 UTC
Author: mrs
Date: Thu Jan 17 21:28:56 2013
New Revision: 195281

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195281
Log:
        PR sanitizer/55679
        * g++.dg/asan/interception-test-1.C: Skip on darwin.
        * lib/target-supports.exp (check_effective_target_swapcontext): Use
        check_no_compiler_messages to test support in ucontext.h.
	(check_effective_target_setrlimit): Return 0 for Darwin's non-posix
	compliant RLIMIT_AS.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/asan/interception-test-1.C
    trunk/gcc/testsuite/lib/target-supports.exp
Comment 20 Dominique d'Humieres 2013-01-20 16:54:50 UTC
(In reply to comment #18)
> I am puzzled as to why this issue with global-overflow-1.c and
> stack-overflow-1.c can't be triggered on x86_64 linux. The obvious change of
> -mtune=core2 seems to be insufficient to cause the failures.

I have opened pr56053 for these failures. This PR could probably be closed as fixed.
Comment 21 Jack Howarth 2013-01-23 17:34:25 UTC
Fixed at r195281.