[PATCH] D36284: [sanitizer] Remove use of task_for_pid from sanitizer_stoptheworld_mac.cc

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 13:38:01 PDT 2017


kubamracek created this revision.
kubamracek added a project: Sanitizers.

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()`.


Repository:
  rL LLVM

https://reviews.llvm.org/D36284

Files:
  lib/sanitizer_common/sanitizer_stoptheworld_mac.cc


Index: lib/sanitizer_common/sanitizer_stoptheworld_mac.cc
===================================================================
--- lib/sanitizer_common/sanitizer_stoptheworld_mac.cc
+++ lib/sanitizer_common/sanitizer_stoptheworld_mac.cc
@@ -55,17 +55,9 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36284.109623.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170803/84c0fd1c/attachment.bin>


More information about the llvm-commits mailing list