Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 347164cc authored by Josh Gao's avatar Josh Gao
Browse files

crash_dump: read /proc/<pid>/maps before dropping capabilities.

Reading /proc/<pid>/maps does a ptrace_may_access check, which will
fail if we have fewer capabilities than the target, even if we've
already ptraced it.

Bug: http://b/35070339
Test: debuggerd -b `pidof zygote`
Change-Id: I984a061022bd945a7950b88f6d579e1bd735e893
parent 9df28601
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -358,6 +358,11 @@ int main(int argc, char** argv) {
    }
    }
  }
  }


  std::unique_ptr<BacktraceMap> backtrace_map(BacktraceMap::Create(main_tid));
  if (!backtrace_map) {
    LOG(FATAL) << "failed to create backtrace map";
  }

  // Drop our capabilities now that we've attached to the threads we care about.
  // Drop our capabilities now that we've attached to the threads we care about.
  drop_capabilities();
  drop_capabilities();


@@ -365,7 +370,6 @@ int main(int argc, char** argv) {


  // TODO: Use seccomp to lock ourselves down.
  // TODO: Use seccomp to lock ourselves down.


  std::unique_ptr<BacktraceMap> backtrace_map(BacktraceMap::Create(main_tid));
  std::string amfd_data;
  std::string amfd_data;


  if (backtrace) {
  if (backtrace) {