]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove MAP_FIXED in sysReserve for raceenabled on darwin
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 6 Nov 2019 23:18:28 +0000 (23:18 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 7 Nov 2019 01:38:25 +0000 (01:38 +0000)
This change removes a hack which was added to deal with Darwin 10.10's
weird ignorance of mapping hints which would cause race mode to fail
since it requires the heap to live within a certain address range.

We no longer support 10.10, and this is potentially causing problems
related to the page allocator, so drop this code.

Updates #26475.
Updates #35112.

Change-Id: I0e1c6f8c924afe715a2aceb659a969d7c7b6f749
Reviewed-on: https://go-review.googlesource.com/c/go/+/205757
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/mem_darwin.go

index 86d9fca85ac2e0e07bc58a061365167109bba0d7..3b5d565b0f59fd42f6eeb843a40da502eeb1196c 100644 (file)
@@ -49,19 +49,7 @@ func sysFault(v unsafe.Pointer, n uintptr) {
 }
 
 func sysReserve(v unsafe.Pointer, n uintptr) unsafe.Pointer {
-       flags := int32(_MAP_ANON | _MAP_PRIVATE)
-       if raceenabled {
-               // Currently the race detector expects memory to live within a certain
-               // range, and on Darwin 10.10 mmap is prone to ignoring hints, moreso
-               // than later versions and other BSDs (#26475). So, even though it's
-               // potentially dangerous to MAP_FIXED, we do it in the race detection
-               // case because it'll help maintain the race detector's invariants.
-               //
-               // TODO(mknyszek): Drop this once support for Darwin 10.10 is dropped,
-               // and reconsider this when #24133 is addressed.
-               flags |= _MAP_FIXED
-       }
-       p, err := mmap(v, n, _PROT_NONE, flags, -1, 0)
+       p, err := mmap(v, n, _PROT_NONE, _MAP_ANON|_MAP_PRIVATE, -1, 0)
        if err != 0 {
                return nil
        }