summaryrefslogtreecommitdiffstats
path: root/base/linux_util.cc
diff options
context:
space:
mode:
authorkmixter@chromium.org <kmixter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 04:21:06 +0000
committerkmixter@chromium.org <kmixter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 04:21:06 +0000
commitcb7d53e31de7cb61b190ab56f6136dd44a55aee9 (patch)
tree8df5e007f3eb983e2b6ab6ab0d088d893e53cf81 /base/linux_util.cc
parentd01576c153e5a60a7a76340220bcb096180993b0 (diff)
downloadchromium_src-cb7d53e31de7cb61b190ab56f6136dd44a55aee9.zip
chromium_src-cb7d53e31de7cb61b190ab56f6136dd44a55aee9.tar.gz
chromium_src-cb7d53e31de7cb61b190ab56f6136dd44a55aee9.tar.bz2
Always search TIDs for the crashing processes.
Kernels newer than 2.6.32 support TID and PID namespacing where processes' view of their TIDs and PIDs are not globally unique or externally meaningful. We have workarounds to find the TID and PID of the crashing process from outside in the browser process. However, we were only assuming TID namespacing was happening if PID namespacing was enabled and the kernel had a bug that was fixed since 2.6.38. This change causes us to always treat the TID as subject to namespacing. Our trick to find the TID relies on a procfs feature added in 2008. We assume if that feature is not yet present that the TID translation is not necessary. This fixes the bug where all crashes of non-browser processes on Linux 2.6.38+ (Chrome OS r13+) are unusable (result in UnspecifiedStackSignature). BUG=chromium-os:15462 TEST=Do about:crash on 2.6.38 kernel and verify proper tid listed in MDException block Review URL: http://codereview.chromium.org/7190019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89795 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/linux_util.cc')
-rw-r--r--base/linux_util.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/base/linux_util.cc b/base/linux_util.cc
index 2f9f862..a24f311 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -252,9 +252,14 @@ bool FindProcessHoldingSocket(pid_t* pid_out, ino_t socket_inode) {
return already_found;
}
-pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data) {
+pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data,
+ bool* syscall_supported) {
char buf[256];
snprintf(buf, sizeof(buf), "/proc/%d/task", pid);
+
+ if (syscall_supported != NULL)
+ *syscall_supported = false;
+
DIR* task = opendir(buf);
if (!task) {
LOG(WARNING) << "Cannot open " << buf;
@@ -280,6 +285,8 @@ pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data) {
int fd = open(buf, O_RDONLY);
if (fd < 0)
continue;
+ if (syscall_supported != NULL)
+ *syscall_supported = true;
bool read_ret =
file_util::ReadFromFD(fd, syscall_data.get(), expected_data.length());
close(fd);