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



commit a1a126c3081b29f375ea0cf06d8c121b927bde06
Author: Ell <ell_se yahoo com>
Date:   Mon Mar 5 02:21:52 2018 -0500

    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.

 libgimpbase/gimputils.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/libgimpbase/gimputils.c b/libgimpbase/gimputils.c
index 745e692..d40b4f2 100644
--- a/libgimpbase/gimputils.c
+++ b/libgimpbase/gimputils.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]