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
diff --git a/runtime/thread_linux.cc b/runtime/thread_linux.cc
index 9aacb30..1254056 100644
--- a/runtime/thread_linux.cc
+++ b/runtime/thread_linux.cc
@@ -33,8 +33,11 @@
 }
 
 // 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.