From cb7c0e9eb785a8d605da5d5b26ab265d4d635f1e Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Wed, 13 Aug 2014 14:37:26 -0700 Subject: [PATCH] Ensure alternate signal stack is minimum size. On Mac a sigaltstack may need to be 32KB, setting it to 16KB causes sigaltstack to fail. (cherry picked from commit c24a1e00b13a7ebf10dd896f6a18b1ad09617ec7) Change-Id: Ic06d80f1acf5c4eb3d2dd1156bfa2805ab0df492 --- runtime/thread_linux.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/thread_linux.cc b/runtime/thread_linux.cc index 9aacb301e..125405625 100644 --- a/runtime/thread_linux.cc +++ b/runtime/thread_linux.cc @@ -33,8 +33,11 @@ static void SigAltStack(stack_t* new_stack, stack_t* old_stack) { } // The default SIGSTKSZ on linux is 8K. If we do any logging in a signal -// handler this is too small. We allocate 16K instead. -static constexpr int kHostAltSigStackSize = 16*1024; // 16K signal stack. +// handler this is too small. We allocate 16K instead or the minimum signal +// stack size. +// TODO: We shouldn't do logging (with locks) in signal handlers. +static constexpr int kHostAltSigStackSize = + 16 * KB < MINSIGSTKSZ ? MINSIGSTKSZ : 16 * KB; void Thread::SetUpAlternateSignalStack() { // Create and set an alternate signal stack. -- 2.11.0