Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Unified Diff: src/client/linux/minidump_writer/linux_dumper.cc

Issue 150001: Fix a couple of bugs where we generate incorrect minidump files on... Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: '' Created 14 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/client/linux/minidump_writer/linux_dumper.cc
===================================================================
--- src/client/linux/minidump_writer/linux_dumper.cc (revision 642)
+++ src/client/linux/minidump_writer/linux_dumper.cc (working copy)
@@ -75,6 +75,26 @@
return false;
}
}
+#if defined(__i386) || defined(__x86_64)
+ // On x86, the stack pointer is NULL or -1, when executing trusted code in
+ // the seccomp sandbox. Not only does this cause difficulties down the line
+ // when trying to dump the thread's stack, it also results in the minidumps
+ // containing information about the trusted threads. This information is
+ // generally completely meaningless and just pollutes the minidumps.
+ // We thus test the stack pointer and exclude any threads that are part of
+ // the seccomp sandbox's trusted code.
+ user_regs_struct regs;
+ if (sys_ptrace(PTRACE_GETREGS, pid, NULL, &regs) == -1 ||
+#if defined(__i386)
kmixter 2010/08/16 17:21:34 won't this fail to compile on other architectures?
+ !regs.esp
+#elif defined(__x86_64)
+ !regs.rsp
+#endif
+ ) {
+ sys_ptrace(PTRACE_DETACH, pid, NULL, NULL);
+ return false;
+ }
+#endif
return true;
}
@@ -111,11 +131,19 @@
bool LinuxDumper::ThreadsSuspend() {
if (threads_suspended_)
return true;
- bool good = true;
- for (size_t i = 0; i < threads_.size(); ++i)
- good &= SuspendThread(threads_[i]);
+ for (size_t i = 0; i < threads_.size(); ++i) {
+ if (!SuspendThread(threads_[i])) {
+ // If the thread either disappeared before we could attach to it, or if
+ // it was part of the seccomp sandbox's trusted code, it is OK to
+ // silently drop it from the minidump.
+ memmove(&threads_[i], &threads_[i+1],
+ (threads_.size() - i - 1) * sizeof(threads_[i]));
+ threads_.resize(threads_.size() - 1);
+ --i;
+ }
+ }
threads_suspended_ = true;
- return good;
+ return threads_.size() > 0;
}
bool LinuxDumper::ThreadsResume() {

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted