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


CrOS-Libchrome-Original-Commit: cb7d53e31de7cb61b190ab56f6136dd44a55aee9
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 @@
   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 @@
     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);