libgimpbase: in gimp_stack_trace_print(), clear ptrace permission on exit

Clear the ptrace permission given to the child after it terminates,
so that a future process that happens to have the same PID the
child had can't ptrace us.
This commit is contained in:
Ell 2018-03-05 02:21:52 -05:00
parent b9e629abbb
commit a1a126c308
1 changed files with 5 additions and 0 deletions

View File

@ -1252,6 +1252,11 @@ gimp_stack_trace_print (const gchar *prog_name,
waitpid (pid, &status, 0);
#ifdef PR_SET_PTRACER
/* Clear ptrace permission set above */
prctl (PR_SET_PTRACER, 0, 0, 0, 0);
#endif
while ((read_n = read (out_fd[0], buffer, 256)) > 0)
{
/* It's hard to know if the debugger was found since it