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.resize() crashes on NetBSD when growing a shared anonymous mapping #154258
resize() returns without error and the original page is still readable, but the grown region is not backed, so accessing it crashes.
The cause is NetBSD's mremap(): growing a MAP_SHARED | MAP_ANON mapping returns a mapping whose new region is unmapped (verified with a standalone C program — a MAP_PRIVATE anonymous mapping grows correctly, a MAP_SHARED one does not). This is the same behaviour as the Linux kernel bug that Modules/mmapmodule.c already guards against for __linux__ (https://bugzilla.kernel.org/show_bug.cgi?id=8691); Linux later made mremap() reject the grow, but NetBSD still returns the broken mapping. Because NetBSD's mremap() does not return MAP_FAILED, the failure can't be detected from its return value.
The NetBSD behaviour is undocumented (not in the mremap(2) BUGS section) and appears unreported upstream.
Fix: reject growing a shared anonymous mapping on NetBSD with ValueError, as is already done on Linux.
Activity
gh-154258: Fix mmap.resize() crash on NetBSD growing a shared anonymo…
[3.13] gh-154258: Fix mmap.resize() crash on NetBSD growing a shared …
[3.14] gh-154258: Fix mmap.resize() crash on NetBSD growing a shared …
[3.15] gh-154258: Fix mmap.resize() crash on NetBSD growing a shared …