Make -D mode work when the Yama LSM is enabled
* strace.c [HAVE_PRCTL]: Include sys/prctl.h. (startup_child) [HAVE_PRCTL && PR_SET_PTRACER && PR_SET_PTRACER_ANY]: In -D mode, allow tracing the process that is going to become the tracee.
This commit is contained in:
parent
7a0fb38386
commit
882478a072
8
strace.c
8
strace.c
@ -39,6 +39,9 @@
|
||||
#include <grp.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/utsname.h>
|
||||
#ifdef HAVE_PRCTL
|
||||
# include <sys/prctl.h>
|
||||
#endif
|
||||
#if defined(IA64)
|
||||
# include <asm/ptrace_offsets.h>
|
||||
#endif
|
||||
@ -1134,6 +1137,11 @@ startup_child(char **argv)
|
||||
*/
|
||||
params_for_tracee.pathname = NOMMU_SYSTEM ? strdup(pathname) : pathname;
|
||||
|
||||
#if defined HAVE_PRCTL && defined PR_SET_PTRACER && defined PR_SET_PTRACER_ANY
|
||||
if (daemonized_tracer)
|
||||
prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY);
|
||||
#endif
|
||||
|
||||
strace_child = pid = fork();
|
||||
if (pid < 0) {
|
||||
perror_msg_and_die("fork");
|
||||
|
Loading…
Reference in New Issue
Block a user