darwin,linux: more conservative minimum stack size#2310
Merged
bnoordhuis merged 1 commit intolibuv:v1.xfrom Jun 7, 2019
Merged
darwin,linux: more conservative minimum stack size#2310bnoordhuis merged 1 commit intolibuv:v1.xfrom
bnoordhuis merged 1 commit intolibuv:v1.xfrom
Conversation
saghul
approved these changes
May 24, 2019
cjihrig
approved these changes
May 24, 2019
uv_thread_create() inspects min(PTHREAD_STACK_MIN, RLIMIT_STACK) to find out the minimum allowed stack size. After spelunking through kernel and libc code, I came to the conclusion that allowing such small stacks does not mix well with signals. Musl's PTHREAD_STACK_MIN is 2 KB but signal handlers on many architectures need at least 1 KB to store the signal context, making it almost impossible to do anything on the thread without signal delivery overflowing the stack. Therefore, increase the lower bound to 8 KB. That corresponds to PTHREAD_STACK_MIN + MINSIGSTKSZ on arm64, which has the largest MINSIGSTKSZ of the architectures that musl supports. PR-URL: libuv#2310 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
e445a19 to
d89bd15
Compare
liujinye-sys
pushed a commit
to open-vela/apps_system_libuv
that referenced
this pull request
Jul 23, 2025
uv_thread_create() inspects min(PTHREAD_STACK_MIN, RLIMIT_STACK) to find out the minimum allowed stack size. After spelunking through kernel and libc code, I came to the conclusion that allowing such small stacks does not mix well with signals. Musl's PTHREAD_STACK_MIN is 2 KB but signal handlers on many architectures need at least 1 KB to store the signal context, making it almost impossible to do anything on the thread without signal delivery overflowing the stack. Therefore, increase the lower bound to 8 KB. That corresponds to PTHREAD_STACK_MIN + MINSIGSTKSZ on arm64, which has the largest MINSIGSTKSZ of the architectures that musl supports. PR-URL: libuv/libuv#2310 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
liujinye-sys
pushed a commit
to open-vela/apps_system_libuv
that referenced
this pull request
Dec 16, 2025
uv_thread_create() inspects min(PTHREAD_STACK_MIN, RLIMIT_STACK) to find out the minimum allowed stack size. After spelunking through kernel and libc code, I came to the conclusion that allowing such small stacks does not mix well with signals. Musl's PTHREAD_STACK_MIN is 2 KB but signal handlers on many architectures need at least 1 KB to store the signal context, making it almost impossible to do anything on the thread without signal delivery overflowing the stack. Therefore, increase the lower bound to 8 KB. That corresponds to PTHREAD_STACK_MIN + MINSIGSTKSZ on arm64, which has the largest MINSIGSTKSZ of the architectures that musl supports. PR-URL: libuv/libuv#2310 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
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.
uv_thread_create() inspects min(PTHREAD_STACK_MIN, RLIMIT_STACK) to
find out the minimum allowed stack size. After spelunking through
kernel and libc code, I came to the conclusion that allowing such
small stacks does not mix well with signals.
Musl's PTHREAD_STACK_MIN is 2 KB but signal handlers on many
architectures need at least 1 KB to store the signal context,
making it almost impossible to do anything on the thread without
signal delivery overflowing the stack.
Therefore, increase the lower bound to 8 KB. That corresponds to
PTHREAD_STACK_MIN + MINSIGSTKSZ on arm64, which has the largest
MINSIGSTKSZ of the architectures that musl supports.
CI: https://ci.nodejs.org/job/libuv-test-commit/1408/