[PATCH] D23589: Fix hang caused by memory corruption caused by insufficient alternate stack space for signal handlers.
bryant via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 16:18:42 PDT 2016
bryant created this revision.
bryant added a reviewer: rsmith.
bryant added a subscriber: llvm-commits.
bryant set the repository for this revision to rL LLVM.
On systems that support alternate signal stack frames,, the code currently asks
for `MINSIGSTKSZ + 8192` _bytes_, which translates to roughly 10 KiB. However,
this amount is far too low and results in later signal handlers writing past the
bounds of their allotted space.
On trunk builds compiled with the latest libcxx/-abi, the result is an acutely
unpleasant hang (as opposed to abort) upon false assertions.
The new size of 8 MiB was on the discerned similarity between "8192" and the
default Linux stack size of 8192 KiB:
```
$ ulimit -s
8192
```
Source of original code: https://reviews.llvm.org/rL270273
Repository:
rL LLVM
https://reviews.llvm.org/D23589
Files:
lib/Support/Unix/Signals.inc
Index: lib/Support/Unix/Signals.inc
===================================================================
--- lib/Support/Unix/Signals.inc
+++ lib/Support/Unix/Signals.inc
@@ -127,7 +127,7 @@
static stack_t OldAltStack;
static void CreateSigAltStack() {
- const size_t AltStackSize = MINSIGSTKSZ + 8192;
+ const size_t AltStackSize = MINSIGSTKSZ + 8192 * 1024 * 1024;
// If we're executing on the alternate stack, or we already have an alternate
// signal stack that we're happy with, there's nothing for us to do. Don't
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23589.68270.patch
Type: text/x-patch
Size: 533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160816/48838b95/attachment.bin>
More information about the llvm-commits
mailing list