mfabik / rpms / satyr

Forked from rpms/satyr 3 years ago
Clone

Blame SOURCES/satyr-0.13-disable-hook-unwind-on-kernels-w-o-PTRACE_SEIZE.patch

01add4
From c1497bdb2a1deaa467fa75a80b1fb993a7d500f5 Mon Sep 17 00:00:00 2001
01add4
From: Martin Milata <mmilata@redhat.com>
01add4
Date: Mon, 8 Dec 2014 15:37:17 +0100
01add4
Subject: [PATCH 5/5] Disable hook unwind on kernels w/o PTRACE_SEIZE
01add4
01add4
Related to abrt/abrt#829.
01add4
01add4
Signed-off-by: Martin Milata <mmilata@redhat.com>
01add4
---
01add4
 lib/core_unwind.c          | 7 ++++---
01add4
 lib/core_unwind_elfutils.c | 6 ++++++
01add4
 2 files changed, 10 insertions(+), 3 deletions(-)
01add4
01add4
diff --git a/lib/core_unwind.c b/lib/core_unwind.c
01add4
index 8599f0f..cf9973a 100644
01add4
--- a/lib/core_unwind.c
01add4
+++ b/lib/core_unwind.c
01add4
@@ -25,6 +25,7 @@
01add4
 #include <string.h>
01add4
 #include <errno.h>
01add4
 #include <sys/procfs.h> /* struct elf_prstatus */
01add4
+#include <sys/ptrace.h> /* PTRACE_SEIZE */
01add4
 
01add4
 #include "utils.h"
01add4
 #include "core/unwind.h"
01add4
@@ -52,19 +53,19 @@ sr_parse_coredump(const char *coredump_filename,
01add4
 
01add4
 #endif /* !defined WITH_LIBDWFL && !defined WITH_LIBUNWIND */
01add4
 
01add4
-#if !defined WITH_LIBDWFL
01add4
+#if (!defined WITH_LIBDWFL || !defined PTRACE_SEIZE)
01add4
 
01add4
 struct sr_core_stacktrace *
01add4
 sr_core_stacktrace_from_core_hook(pid_t thread_id,
01add4
                                   const char *executable_filename,
01add4
                                   int signum,
01add4
-                                  char **error_message);
01add4
+                                  char **error_message)
01add4
 {
01add4
     *error_message = sr_asprintf("satyr is built without live process unwind support");
01add4
     return NULL;
01add4
 }
01add4
 
01add4
-#endif /* !defined WITH_LIBDWFL */
01add4
+#endif /* !defined WITH_LIBDWFL || !defined PTRACE_SEIZE */
01add4
 
01add4
 /* FIXME: is there another way to pass the executable name to the find_elf
01add4
  * callback? */
01add4
diff --git a/lib/core_unwind_elfutils.c b/lib/core_unwind_elfutils.c
01add4
index eb366cd..1482dba 100644
01add4
--- a/lib/core_unwind_elfutils.c
01add4
+++ b/lib/core_unwind_elfutils.c
01add4
@@ -212,6 +212,10 @@ fail:
01add4
     return stacktrace;
01add4
 }
01add4
 
01add4
+/* If PTRACE_SEIZE is not defined (kernel < 3.4), stub function from
01add4
+ * core_unwind.c is used. */
01add4
+#ifdef PTRACE_SEIZE
01add4
+
01add4
 struct sr_core_stacktrace *
01add4
 sr_core_stacktrace_from_core_hook(pid_t tid,
01add4
                                   const char *executable,
01add4
@@ -344,4 +348,6 @@ fail:
01add4
     return stacktrace;
01add4
 }
01add4
 
01add4
+#endif /* PTRACE_SEIZE */
01add4
+
01add4
 #endif /* WITH_LIBDWFL */
01add4
-- 
01add4
2.4.3
01add4