Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(943)

Unified Diff: base/debug/stack_trace_android.cc

Issue 18293007: Enable IO before reading /proc/self/maps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/stack_trace_android.cc
diff --git a/base/debug/stack_trace_android.cc b/base/debug/stack_trace_android.cc
index 487cbc495c6b07bcea869bb88e94b280ff5a57ef..4c53d4a94c8cfc1bb3dcf801cfbc9d5dda486471 100644
--- a/base/debug/stack_trace_android.cc
+++ b/base/debug/stack_trace_android.cc
@@ -9,6 +9,7 @@
#include "base/debug/proc_maps_linux.h"
#include "base/strings/stringprintf.h"
+#include "base/threading/thread_restrictions.h"
namespace {
@@ -85,6 +86,12 @@ void StackTrace::PrintBacktrace() const {
void StackTrace::OutputToStream(std::ostream* os) const {
std::string proc_maps;
std::vector<MappedMemoryRegion> regions;
+ // Allow IO to read /proc/self/maps. Reading this file doesn't hit the disk
+ // since it lives in procfs, and this is currently used to print a stack trace
+ // on fatal log messages in debug builds only. If the restriction is enabled
+ // then it will recursively trigger fatal failures when this enters on the
+ // UI thread.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
if (!ReadProcMaps(&proc_maps)) {
__android_log_write(
ANDROID_LOG_ERROR, "chromium", "Failed to read /proc/self/maps");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698