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

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