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
mmap: creating a file-backed map calls fcntl(fd, F_FULLFSYNC) on macOS with the GIL held #162356
On macOS, mmap.mmap(fd, ...) calls fcntl(fd, F_FULLFSYNC) before every file-backed mapping, even with a read-only descriptor. It holds the GIL during the call and the result gets ignored:
/* Issue #11277: fsync(2) is not enough on OS X - a special, OS X specific
fcntl(2) is necessary to force DISKSYNC and get around mmap(2) bug */
if (fd!=-1)
(void)fcntl(fd, F_FULLFSYNC);
#endif
if (fd!=-1) {
Py_BEGIN_ALLOW_THREADS
fstat_result=_Py_fstat_noraise(fd, &status);
Py_END_ALLOW_THREADS
}
The call was added in #55486 (buildbot crash). On a 32-bit kernel, the HFS+ function hfs_vnop_blockmap() truncated the remaining length of a range awaiting zero-fill to size_t. At 4 GiB the length wrapped to zero, so reading the mapped page raised SIGBUS. A full sync forced HFS+ to zero-fill the range before mapping:
I reproduced the crash on macOS 10.7.5 with the i386 kernel. Since 10.8, macOS has used only 64-bit kernels, where 4 GiB fits in size_t. And PEP 11 lists only x86_64 and aarch64 as supported macOS targets.
Activity
maurycy commentedon Nov 21, 2026
This is a duplicate of #113861