[compiler-rt] r310271 - [sanitizer] Remove use of task_for_pid from sanitizer_stoptheworld_mac.cc

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 11:07:20 PDT 2017


Author: kuba.brecka
Date: Mon Aug  7 11:07:20 2017
New Revision: 310271

URL: http://llvm.org/viewvc/llvm-project?rev=310271&view=rev
Log:
[sanitizer] Remove use of task_for_pid from sanitizer_stoptheworld_mac.cc

Using task_for_pid to get the "self" task is not necessary, and it can fail (e.g. for sandboxed processes). Let's just use mach_task_self().

Differential Revision: https://reviews.llvm.org/D36284


Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc?rev=310271&r1=310270&r2=310271&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc Mon Aug  7 11:07:20 2017
@@ -55,17 +55,9 @@ void RunThread(void *arg) {
   struct RunThreadArgs *run_args = (struct RunThreadArgs *)arg;
   SuspendedThreadsListMac suspended_threads_list;
 
-  mach_port_t task;
-  kern_return_t err = task_for_pid(mach_task_self(), internal_getpid(), &task);
-  if (err != KERN_SUCCESS) {
-    VReport(1, "Getting task from pid failed (errno %d).\n", err);
-    return;
-  }
-
   thread_array_t threads;
   mach_msg_type_number_t num_threads;
-
-  err = task_threads(task, &threads, &num_threads);
+  kern_return_t err = task_threads(mach_task_self(), &threads, &num_threads);
   if (err != KERN_SUCCESS) {
     VReport(1, "Failed to get threads for task (errno %d).\n", err);
     return;




More information about the llvm-commits mailing list