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

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: added comment 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 4c11a244d6ee2f5513c560f67702de21ab924c5c..50d3a4ed1036a65d737d5a579c6a6df5d67f5a90 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"
// TODO(dmikurube): Remove when Bionic's get_backtrace() gets popular.
// See http://crbug.com/236855.
@@ -98,6 +99,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)) {
scherkus (not reviewing) 2013/07/10 15:35:30 Q: thoughts on putting the ScopedAllowIO inside Re
Joao da Silva 2013/07/10 15:36:44 Seems like a better place for this to me. Mark, wh
__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