erts: Fix alternate signal stack sizing on musl (AT_MINSIGSTKSZ)#11249
Open
arctarus wants to merge 1 commit into
Open
erts: Fix alternate signal stack sizing on musl (AT_MINSIGSTKSZ)#11249arctarus wants to merge 1 commit into
arctarus wants to merge 1 commit into
Conversation
Contributor
CT Test Results 3 files 136 suites 50m 25s ⏱️ Results for commit 3a94587. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
garazdawi
requested changes
Jun 16, 2026
Author
|
@garazdawi I applied your suggestions. Thanks for the review! |
On Linux, the kernel may report a minimum signal stack size larger than the compile-time SIGSTKSZ (e.g. on AVX-512 / AMX CPUs). musl keeps SIGSTKSZ a static 8192, so sigaltstack() can fail with ENOMEM. Take the max of SIGSTKSZ and getauxval(AT_MINSIGSTKSZ) when available.
c094e1d to
3a94587
Compare
Contributor
|
Thanks for the contribution. We currently have a bit of administrative ambiguities about AI produced code and licensing. So, I rewrote the fix, based on |
Author
|
@sverker no problem at all. Thanks! |
sverker
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Size the JIT's alternate signal stack to
max(SIGSTKSZ, AT_MINSIGSTKSZ)instead of the bareSIGSTKSZ, so the emulator starts on musl/Alpine running on CPUs with large signal frames.Fixes #11248.
Why
On musl,
SIGSTKSZis a static8192. On CPUs whose kernel reportsAT_MINSIGSTKSZ > 8192(AVX-512 / AMX),
sigaltstack()returnsENOMEMand the BEAM aborts at startup. glibc >= 2.34made
SIGSTKSZdynamic for exactly this reason; musl did not. Affects musl JIT builds, OTP 27+.Reproduction (hardware-independent, any musl host)
Force sigaltstack to reject the 8192-byte request (simulating a kernel whose minimum exceeds it):
Unpatched: aborts with "Failed to set alternate signal stack". Patched: boots normally.
Notes / open questions for reviewers
#if defined(__linux__)guard you suggested; happy to switch to a configurecheck for
getauxval(AC_CHECK_FUNCS) instead if you'd prefer that for portability.max(SIGSTKSZ, AT_MINSIGSTKSZ). If you'd like headroom above the barekernel minimum (for the handler's own frames), I can add a margin — let me know the policy
you'd want.