diff options
author | chappedm@gmail.com <chappedm@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50> | 2012-11-03 16:14:25 +0000 |
---|---|---|
committer | chappedm@gmail.com <chappedm@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50> | 2012-11-03 16:14:25 +0000 |
commit | 5c17459c5e7b4133a2dec5ffe6a9237a114f5378 (patch) | |
tree | 0f087583420b0aff1054155da837dfeb00eaf6e6 /src/base | |
parent | 6287bbbbad8730712cfd1ee28ecc0648cbaa9f94 (diff) | |
download | gperftools-5c17459c5e7b4133a2dec5ffe6a9237a114f5378.tar.gz |
issue-476: Amendment to r152:issue-437 to fix a build error due to PR_SET_TRACER not being defined in older glibc releases.
git-svn-id: http://gperftools.googlecode.com/svn/trunk@171 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/linuxthreads.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/base/linuxthreads.cc b/src/base/linuxthreads.cc index 1f8d4c3..73eef04 100644 --- a/src/base/linuxthreads.cc +++ b/src/base/linuxthreads.cc @@ -609,8 +609,8 @@ int ListAllProcessThreads(void *parameter, #include "linux_syscall_support.h" #endif - /* Lock before clone so that parent - * can set ptrace permissions prior + /* Lock before clone so that parent can set + * ptrace permissions (if necessary) prior * to ListerThread actually executing */ if (sem_init(&lock, 0, 0) == 0) { @@ -622,11 +622,15 @@ int ListAllProcessThreads(void *parameter, sys_sigprocmask(SIG_SETMASK, &sig_old, &sig_old); if (clone_pid >= 0) { - /* Allow child process to ptrace us - * and then release lock so that - * ListerThread then executes +#ifdef PR_SET_PTRACER + /* In newer versions of glibc permission must explicitly + * be given to allow for ptrace. */ prctl(PR_SET_PTRACER, clone_pid, 0, 0, 0); +#endif + /* Releasing the lock here allows the + * ListerThread to execute and ptrace us. + */ sem_post(&lock); int status, rc; while ((rc = sys0_waitpid(clone_pid, &status, __WALL)) < 0 && |