[PATCH] Add FreeBSD support to Asan test cases that use mmap() with MAP_ANON

Alexey Samsonov vonosmas at gmail.com
Thu Jul 17 18:18:02 PDT 2014

Comment at: test/asan/TestCases/Posix/large_allocator_unpoisons_on_free.cc:30
@@ -29,2 +29,3 @@
-  char *q = (char *)mmap(p, kPageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0);
+  // FreeBSD requires fd to be (-1) when MAP_ANON is specified.
+#if defined(__FreeBSD__)
Ed Maste wrote:
> Do the other platforms require it to be 0?  Can it just be -1 for all?
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."


More information about the llvm-commits mailing list