-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[utils] Don't use MAP_32BIT on Apple platforms, fixes crash with XCode 11 beta6 #16441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e 11 beta6 As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol: ```diff --- /Applications/Xcode11-beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-07-25 17:43:49.000000000 -0400 +++ /Applications/Xcode11-beta6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-08-06 21:03:07.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -145,6 +145,10 @@ #define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */ #define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */ +#if !defined(CONFIG_EMBEDDED) +#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only: Requires entitlement */ +#endif /* !defined(CONFIG_EMBEDDED) */ + #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* ``` This causes the mono_valloc() function to try to use the MAP_32BIT flag for mmap(). However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make mmap() behave like it did before.
|
Is this 32bit stuff worth much? |
|
Not sure. We specifically use it on amd64 in the code manager: mono/mono/utils/mono-codeman.c Lines 60 to 64 in cb1f7c0
I guess the idea is to keep it within the 4gb range, so calls/jumps between code can be in a certain limited distance. Removing that could lead to a slight performance regression. Probably not much, but if it's easily avoidable (that is, we can use the entitlement), we should rather do that. Is this blocking something or can we wait for Xcode 11 beta 7 (hopefully next week) and see if something has changed? |
|
Hmm, maybe it isn't too bad either way: mono/mono/utils/mono-codeman.c Lines 393 to 398 in cb1f7c0
We try to keep chunks together anyway. |
|
@lewurm we can certainly wait for beta7, but note that we weren't using this flag on Apple platforms before since earlier Xcode didn't define it and so we defined it to edit using the hypothetical entitlement would be bad since we'd need to |
|
Agreed no-op and the right direction. |
|
@monojenkins backport 2019-08 |
…e 11 beta6 As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol. This causes the `mono_valloc()` function to try to use the `MAP_32BIT` flag for `mmap()`. However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make `mmap()` behave like it did before. Backport of mono#16441
…e 11 beta6 As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol. This causes the `mono_valloc()` function to try to use the `MAP_32BIT` flag for `mmap()`. However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make `mmap()` behave like it did before. Backport of mono#16441
…e 11 beta6 As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol. This causes the `mono_valloc()` function to try to use the `MAP_32BIT` flag for `mmap()`. However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make `mmap()` behave like it did before. Backport of mono#16441
…e 11 beta6 (#16480) As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol. This causes the `mono_valloc()` function to try to use the `MAP_32BIT` flag for `mmap()`. However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make `mmap()` behave like it did before. Backport of #16441
…e 11 beta6 (#16482) As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol. This causes the `mono_valloc()` function to try to use the `MAP_32BIT` flag for `mmap()`. However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make `mmap()` behave like it did before. Backport of #16441
…e 11 beta6 (#16481) As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol. This causes the `mono_valloc()` function to try to use the `MAP_32BIT` flag for `mmap()`. However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make `mmap()` behave like it did before. Backport of #16441
…e 11 beta6 (mono/mono#16441) As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol: ```diff --- /Applications/Xcode11-beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-07-25 17:43:49.000000000 -0400 +++ /Applications/Xcode11-beta6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-08-06 21:03:07.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -145,6 +145,10 @@ #define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */ #define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */ +#if !defined(CONFIG_EMBEDDED) +#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only: Requires entitlement */ +#endif /* !defined(CONFIG_EMBEDDED) */ + #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* ``` This causes the mono_valloc() function to try to use the MAP_32BIT flag for mmap(). However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet. This in turn causes the mmap call to fail presumably because we're missing that entitlement. Instead we now skip setting this flag on Apple platforms to make mmap() behave like it did before. Commit migrated from mono/mono@2f2771f
As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol:
This causes the
mono_valloc()function to try to use theMAP_32BITflag formmap().However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement which isn't available/documented anywhere yet.
This in turn causes the mmap call to fail presumably because we're missing that entitlement.
Instead we now skip setting this flag on Apple platforms to make
mmap()behave like it did before.