[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 10:28:31 PDT 2018
vlad.tsyrklevich created this revision.
vlad.tsyrklevich added a reviewer: eugenis.
Herald added subscribers: Sanitizers, llvm-commits, delcypher.
The Linux/BSD system call interfaces report errors differently, use the
internal_iserror() function to correctly check errors on either.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D51368
Files:
lib/safestack/safestack.cc
Index: lib/safestack/safestack.cc
===================================================================
--- lib/safestack/safestack.cc
+++ 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.162898.patch
Type: text/x-patch
Size: 615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180828/63a8f922/attachment.bin>
More information about the llvm-commits
mailing list