You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Some MAP_ constants defined on macOS but not in mmap #113868
The following MAP_* flags are defined on macOS, but are not exposed in the module mmap:
MAP_NORESERVE
MAP_NOEXTEND
MAP_HASSEMAPHORE
MAP_NOCACHE
MAP_JIT
MAP_RESILIENT_CODESIGN
MAP_RESILIENT_MEDIA
MAP_32BIT
MAP_TRANSLATED_ALLOW_EXECUTE
MAP_UNIX03
MAP_TPRO
The system also defines MAP_COPY, MAP_RENAME, but those seem to be less useful. MAP_FILE and MAP_FIXED are generic flags that aren't useful for module mmap.
This is based on the macOS 14.2 SDK.
Two other things I noticed, but something for different issues:
There's a comment about msync(2) flags in the implementation for mmap.mmap.flush()
There is no way to change the memory protection (PROT_READ etc.) after creating the mapping, exposing such functionality could be useful for using mmap to write executable code in Python.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
There is no way to change the memory protection (PROT_READ etc.) after creating the mapping, exposing such functionality could be useful for using mmap to write executable code in Python.
Sorry I'm late, but +1 for exposing mprotect. I was prototyping JITs in pure-Python a while back, and it was unfortunate to have to hack around the edges with ctypes just to do something like this (which "feels like" it should be part of the mmap module).
Activity
pythongh-113868: Add a number of MAP_* flags from macOS to module mmap
gh-113868: Add a number of MAP_* flags from macOS to module mmap (#11…
brandtbucher commentedon Jan 16, 2024
Sorry I'm late, but +1 for exposing
mprotect. I was prototyping JITs in pure-Python a while back, and it was unfortunate to have to hack around the edges withctypesjust to do something like this (which "feels like" it should be part of themmapmodule).pythongh-113868: Add a number of MAP_* flags from macOS to module mmap (
pythongh-113868: Add a number of MAP_* flags from macOS to module mmap (
pythongh-113868: Add a number of MAP_* flags from macOS to module mmap (