Skip to content

gh-154258: Fix mmap.resize() crash on NetBSD growing a shared anonymous mapping#154259

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:mmap-resize-netbsd-crash
Jul 20, 2026
Merged

gh-154258: Fix mmap.resize() crash on NetBSD growing a shared anonymous mapping#154259
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:mmap-resize-netbsd-crash

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 20, 2026

Copy link
Copy Markdown
Member

On NetBSD, mmap.resize() crashed (SIGSEGV) when growing a shared anonymous mapping, because NetBSD mremap() returns a mapping whose grown region is not backed (same behaviour as the Linux kernel bug the code already guards against, https://bugzilla.kernel.org/show_bug.cgi?id=8691). Reject it with ValueError, as is already done on Linux.

Verified on NetBSD 10 (crash gone, resize() now raises ValueError, test_mmap passes) and on Linux and FreeBSD (unaffected).

🤖 Generated with Claude Code

…nonymous mapping

NetBSD mremap() returns a mapping whose grown region is not backed when
growing a shared anonymous mapping, so accessing it crashes.  Reject it
with ValueError, as is already done on Linux.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 20, 2026
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) July 20, 2026 14:04
@serhiy-storchaka
serhiy-storchaka merged commit 542b982 into python:main Jul 20, 2026
64 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

GH-154262 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 20, 2026
@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

GH-154263 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 20, 2026
@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

GH-154264 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 20, 2026
serhiy-storchaka added a commit that referenced this pull request Jul 20, 2026
…anonymous mapping (GH-154259) (GH-154264)

NetBSD mremap() returns a mapping whose grown region is not backed when
growing a shared anonymous mapping, so accessing it crashes.  Reject it
with ValueError, as is already done on Linux.
(cherry picked from commit 542b982)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Jul 20, 2026
…anonymous mapping (GH-154259) (GH-154263)

NetBSD mremap() returns a mapping whose grown region is not backed when
growing a shared anonymous mapping, so accessing it crashes.  Reject it
with ValueError, as is already done on Linux.
(cherry picked from commit 542b982)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Jul 20, 2026
…anonymous mapping (GH-154259) (GH-154262)

NetBSD mremap() returns a mapping whose grown region is not backed when
growing a shared anonymous mapping, so accessing it crashes.  Reject it
with ValueError, as is already done on Linux.
(cherry picked from commit 542b982)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension-modules C modules in the Modules dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant