[PATCH] D51368: SafeStack: Fix thread liveness check on *BSD

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 28 11:31:09 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL340856: SafeStack: Fix thread liveness check on *BSD (authored by vlad.tsyrklevich, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D51368

Files:
  compiler-rt/trunk/lib/safestack/safestack.cc


Index: compiler-rt/trunk/lib/safestack/safestack.cc
===================================================================
--- compiler-rt/trunk/lib/safestack/safestack.cc
+++ compiler-rt/trunk/lib/safestack/safestack.cc
@@ -183,7 +183,10 @@
   thread_stack_ll **stackp = &temp_stacks;
   while (*stackp) {
     thread_stack_ll *stack = *stackp;
-    if (stack->pid != pid || TgKill(stack->pid, stack->tid, 0) == -ESRCH) {
+    int error;
+    if (stack->pid != pid ||
+        (internal_iserror(TgKill(stack->pid, stack->tid, 0), &error) &&
+         error == ESRCH)) {
       UnmapOrDie(stack->stack_base, stack->size);
       *stackp = stack->next;
       free(stack);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51368.162913.patch
Type: text/x-patch
Size: 669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180828/ca6ab125/attachment.bin>


More information about the llvm-commits mailing list