-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
test_mmap.test_access_parameter failing on macOS Sonoma 14.0 beta on Apple Silicon #107888
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
Comments
Failing on the 3.11 branch as well. I don't know if this is important enough to elevate for 3.12.0rc1, but Sonoma is supposed to be released in the fall. Fixing this issue now might be worth it. |
Ping @Yhg1s so he sees this. |
MacOS 14 is still in beta and contains bugs. We generally don't add workarounds for bugs in beta versions of an OS. Is this something that can be reproduced in C? |
For me the test appears to pass just fine on the current beta (14.0, 23A5312d):
Likewise with 3.11. Both are the latest release installed using the python.org installers, and likewise while running the test_mmap tests using EDIT: This is in an x86_64 VM, I don't have an arm64 vm/machine running the 14.0 beta. |
That's fine. I wasn't sure what three policy was, and thought it better to err on the side of caution. In case it's a problem with the Sonoma beta, I provided feedback to Apple with a reference to this issue as well. |
I can also reproduce the failure on an arm64 Sonoma beta. While it seems to be a change in OS behavior, the test is supposed to fail anyway; it now unexpectedly fails earlier.
With the Sonoma beta on arm64, the mmap.mmap() call is failing before it gets to try the Write calls that should fail. Dunno how significant a change that is or whether it might be an ill-defined test case. |
The test itself looks sane. Is this something that can be reproduced in a small C program? The following code should be equivalent to the call to #include <sys/mman.h>
#include <stdio.h>
#include <fcntl.h>
int main(void)
{
int fd = open("/dev/zero", O_RDONLY);
if (fd == -1) {
perror("open");
return 1;
}
void* m = mmap(NULL, 10, PROT_READ|PROT_EXEC, 0, fd, 0);
if (m == NULL) {
perror("mmap");
return 1;
}
printf("done\n");
return 0;
} If this does work, does code signing the binary with the same entitlements as CPython also work? Likewise code signing with a JIT entitlement. |
Thanks, Ronald. That works. I have no idea what you're talking about "code signing" though. |
Code signing as documented by Apple It is also possible to test this the other way: $ cp /Library/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python Python.backup
$ codesign --remove-signature /Library/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python
$ codesign -s - /Library/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python
$ /Library/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python -m test test.test_mmap -v
$ cp Python.backup /Library/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python (The dollar signs at the start of lines represent the shell prompt and shouldn't be copied when executing this). This makes a copy of the interpreter in the framework, then replaces the code signing and entitlements by a trivial code signature that's required on Apple Silicon, then runs the test and finally restores the original signed versions of the interpreter. Doing this tells is if the error is related to changes in the hardened runtime on macOS, or is a general behaviour change that affects the mmap extension module. |
FWIW, I was able to test this with the most recent macOS 14 Sonoma Developer Preview on both an Intel (x86_64) VM and an Apple Silicon (arm64) VM. |
Oh, I just reported the same issue, @ned-deily closed my issue gh-109916 as a duplicate of this one. Copy of my message. ARM64 macOS 3.x:
build: https://buildbot.python.org/all/#/builders/725/builds/5749 |
…ythonGH-109928) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
…ythonGH-109928) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
(cherry picked from commit 14098b7) Co-authored-by: Victor Stinner <[email protected]>
(cherry picked from commit 14098b7)
…ythonGH-109928) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
…ythonGH-109928) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
…ythonGH-109928) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
…ythonGH-109928) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
…H-109928) (GH-114183) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
…H-109928) (GH-114185) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
…H-109928) (GH-114184) (cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
* Backport pythongh-109928: Fix test_mmap.test_access_parameter() on macOS 14 * Backport pythongh-110125: Fix test_mmap PROT_EXEC comment * Add backport comment --------- Co-authored-by: slozier <[email protected]>
Bug report
The other day I decided to give the MacOS Sonoma beta a go on my M1 MBP.
test_mmap
is now consistently failing with aPermissionError
onmain
and3.12
branches.A clear and concise description of the bug
I happened to have an old MacBook Air laying about which is still running MacOS Monterey. I verified that all tests pass there.
Here's the output from the failing test:
Your environment
main
and3.12
branchesLinked PRs
The text was updated successfully, but these errors were encountered: