From 61ef6a39dd75032a3ab7eff1f0cf1181e4ee98d0 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 6 Nov 2019 23:18:28 +0000 Subject: [PATCH] runtime: remove MAP_FIXED in sysReserve for raceenabled on darwin 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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/runtime/mem_darwin.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/runtime/mem_darwin.go b/src/runtime/mem_darwin.go index 86d9fca85a..3b5d565b0f 100644 --- a/src/runtime/mem_darwin.go +++ b/src/runtime/mem_darwin.go @@ -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 } -- 2.50.0