Page MenuHomePhabricator

Add FreeBSD support to Asan test cases that use mmap() with MAP_ANON
ClosedPublic

Authored by kutuzov.viktor.84 on Jul 17 2014, 6:35 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

kutuzov.viktor.84 retitled this revision from to Add FreeBSD support to Asan test cases that use mmap() with MAP_ANON.
kutuzov.viktor.84 updated this object.
kutuzov.viktor.84 edited the test plan for this revision. (Show Details)
kutuzov.viktor.84 added reviewers: kcc, samsonov.
kutuzov.viktor.84 added subscribers: Unknown Object (MLST), emaste.
emaste added inline comments.Jul 17 2014, 8:07 AM
test/asan/TestCases/Posix/large_allocator_unpoisons_on_free.cc
30 ↗(On Diff #11578)

Do the other platforms require it to be 0? Can it just be -1 for all?

-1 does work on my Linux 3.13, but I'm not sure about Darwin. Will try to test it.

samsonov added inline comments.Jul 17 2014, 6:17 PM
test/asan/TestCases/Posix/large_allocator_unpoisons_on_free.cc
30 ↗(On Diff #11578)

I think we should just change it to -1. "man mmap" tells that "The fd and offset arguments are ignored; however, some implementations require fd to be -1 if MAP_ANONYMOUS (or MAP_ANON) is specified, and portable applications should ensure this."

man mmap on

Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64

reads:

   MAP_ANON          Map anonymous memory not associated with any specific
                     file.  The offset argument is ignored.  Mac OS X spe-
                     cific: the file descriptor used for creating MAP_ANON
                     regions can be used to pass some Mach VM flags, and can
                     be specified as -1 if no such flags are associated with
                     the region.  Mach VM flags are defined in <mach/vm_sta-
                     tistics.h> and the ones that currently apply to mmap
                     are:
...

So, it looks it actually should be (-1) on Darwin. Will update the patch ASAP.

emaste accepted this revision.Jul 18 2014, 7:18 AM
emaste added a reviewer: emaste.
This revision is now accepted and ready to land.Jul 18 2014, 7:18 AM
samsonov accepted this revision.Jul 18 2014, 10:43 AM
samsonov edited edge metadata.

LGTM

kutuzov.viktor.84 updated this revision to Diff 11837.

Closed by commit rL213858 (authored by vkutuzov).