From 677424cd86c19dcb87713814d990d662e41a54e7 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 20 Aug 2026 04:20:15 +0200 Subject: [PATCH] deps: V8: cherry-pick ba4ef8d72cde Original commit message: [platform][posix] Fallback to conservative stack limit on musl For most libcs, pthread_getattr_np() returns the the stack reserved limit on the main thread, but musl only returns the current high-water mark at the time of the call. There's no macro to detect musl, so just fallback to the conservative stack limit in cases where the libc is not one that is known to work. Refs: https://github.com/nodejs/node/pull/65161 Change-Id: Ie2b51269b9e8d2d3451d5d68ad1a233d396af935 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8254825 Reviewed-by: Michael Lippautz Commit-Queue: Joyee Cheung Cr-Commit-Position: refs/heads/main@{#109406} Refs: https://github.com/v8/v8/commit/ba4ef8d72cdee9dd52d346e5309b7a82cffe3c8e Signed-off-by: Joyee Cheung PR-URL: https://github.com/nodejs/node/pull/65161 Reviewed-By: Antoine du Hamel Reviewed-By: Richard Lau --- common.gypi | 2 +- deps/v8/src/base/platform/platform-posix.cc | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common.gypi b/common.gypi index e8c157a1c07..d52123d8de0 100644 --- a/common.gypi +++ b/common.gypi @@ -44,7 +44,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.9', + 'v8_embedder_string': '-node.10', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index 66fd5764427..df122799fdc 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -1511,6 +1511,14 @@ Stack::StackSlot Stack::ObtainCurrentThreadStackReservedLimit() { } return stack.ss_sp; #else +// For most libcs, pthread_getattr_np() returns the the stack reserved +// limit on the main thread, but musl only returns the current high-water +// mark at the time of the call. There's no macro to detect musl, so +// let the caller do a fallback in cases where the libc is not one that +// is known to work. +#if V8_OS_LINUX && !V8_LIBC_GLIBC && !V8_LIBC_BIONIC && !V8_LIBC_UCLIBC + if (syscall(__NR_gettid) == getpid()) return nullptr; +#endif pthread_attr_t attr; int error = pthread_getattr_np(pthread_self(), &attr); if (error) {