diff --git a/.satyr.metadata b/.satyr.metadata index 85d8d02..bdf2891 100644 --- a/.satyr.metadata +++ b/.satyr.metadata @@ -1 +1 @@ -cbb66f6ff49bef81c36550d2888cd098021bdc4f SOURCES/satyr-0.9.tar.xz +3a1e70739102d91879ca625670e8efe60817b608 SOURCES/satyr-0.13.tar.xz diff --git a/SOURCES/satyr-0.13-disable-fingerprints.patch b/SOURCES/satyr-0.13-disable-fingerprints.patch new file mode 100644 index 0000000..3f8c6be --- /dev/null +++ b/SOURCES/satyr-0.13-disable-fingerprints.patch @@ -0,0 +1,98 @@ +From 58e874e4a28ce00623db208475b0d9fd22d601ac Mon Sep 17 00:00:00 2001 +From: Martin Milata +Date: Tue, 14 Jan 2014 13:40:45 +0100 +Subject: [SATYR PATCH 3/3] abrt: disable fingerprinting of core stacktraces + +Closes rhbz#1052402. + +Signed-off-by: Martin Milata +--- + include/abrt.h | 2 ++ + lib/abrt.c | 2 ++ + lib/core_fingerprint.c | 25 +++++++++++++++++++++++++ + 3 files changed, 29 insertions(+) + +diff --git a/include/abrt.h b/include/abrt.h +index 1ef7876..0a8f5ac 100644 +--- a/include/abrt.h ++++ b/include/abrt.h +@@ -31,6 +31,8 @@ bool + sr_abrt_print_report_from_dir(const char *directory, + char **error_message); + ++/* NOTE: the hash_fingerprints argument has no effect because fingerprint ++ * generation is disabled. */ + bool + sr_abrt_create_core_stacktrace(const char *directory, + bool hash_fingerprints, +diff --git a/lib/abrt.c b/lib/abrt.c +index 8c006fa..39bc45d 100644 +--- a/lib/abrt.c ++++ b/lib/abrt.c +@@ -87,11 +87,13 @@ create_core_stacktrace(const char *directory, const char *gdb_output, + if (!core_stacktrace) + return false; + ++#if 0 + sr_core_fingerprint_generate(core_stacktrace, + error_message); + + if (hash_fingerprints) + sr_core_fingerprint_hash(core_stacktrace); ++#endif + + char *json = sr_core_stacktrace_to_json(core_stacktrace); + +diff --git a/lib/core_fingerprint.c b/lib/core_fingerprint.c +index 8c5a228..3c7b5ba 100644 +--- a/lib/core_fingerprint.c ++++ b/lib/core_fingerprint.c +@@ -17,6 +17,8 @@ + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ ++#include "config.h" ++ + #include "core/fingerprint.h" + #include "core/stacktrace.h" + #include "core/frame.h" +@@ -33,6 +35,8 @@ + #include + #include + ++#if HAVE_LIBOPCODES ++ + static void + fingerprint_add_bool(struct sr_strbuf *buffer, + const char *name, +@@ -552,6 +556,27 @@ sr_core_fingerprint_generate_for_binary(struct sr_core_thread *thread, + return true; + } + ++#else // HAVE_LIBOPCODES ++ ++bool ++sr_core_fingerprint_generate(struct sr_core_stacktrace *stacktrace, ++ char **error_message) ++{ ++ *error_message = sr_strdup("satyr compiled without libopcodes"); ++ return false; ++} ++ ++bool ++sr_core_fingerprint_generate_for_binary(struct sr_core_thread *thread, ++ const char *binary_path, ++ char **error_message) ++{ ++ *error_message = sr_strdup("satyr compiled without libopcodes"); ++ return false; ++} ++ ++#endif // HAVE_LIBOPCODES ++ + static void + hash_frame (struct sr_core_frame *frame) + { +-- +1.8.3.1 + diff --git a/SOURCES/satyr-0.13-elfutils-0.158.patch b/SOURCES/satyr-0.13-elfutils-0.158.patch new file mode 100644 index 0000000..715b329 --- /dev/null +++ b/SOURCES/satyr-0.13-elfutils-0.158.patch @@ -0,0 +1,13 @@ +diff --git a/lib/core_unwind.c b/lib/core_unwind.c +index d0c7aec..7910254 100644 +--- a/lib/core_unwind.c ++++ b/lib/core_unwind.c +@@ -206,7 +206,7 @@ open_coredump(const char *elf_file, const char *exe_file, char **error_msg) + ch->cb.section_address = dwfl_offline_section_address; + ch->dwfl = dwfl_begin(&ch->cb); + +- if (dwfl_core_file_report(ch->dwfl, ch->eh) == -1) ++ if (dwfl_core_file_report(ch->dwfl, ch->eh, exe_file) == -1) + { + set_error_dwfl("dwfl_core_file_report"); + goto fail_dwfl; diff --git a/SOURCES/satyr-0.13-elfutils-unwinder.patch b/SOURCES/satyr-0.13-elfutils-unwinder.patch new file mode 100644 index 0000000..690fd45 --- /dev/null +++ b/SOURCES/satyr-0.13-elfutils-unwinder.patch @@ -0,0 +1,260 @@ +From 17853e2316aed32d56343b2c4a73fa82b43a078d Mon Sep 17 00:00:00 2001 +From: Martin Milata +Date: Mon, 21 Oct 2013 14:53:02 +0200 +Subject: [SATYR PATCH 2/3] unwind: Port to current API of elfutils unwinder + +Related to rhbz#1051569. + +Signed-off-by: Martin Milata +--- + configure.ac | 2 +- + lib/core_unwind_elfutils.c | 164 +++++++++++++++++++++++++++++---------------- + lib/internal_unwind.h | 2 +- + 3 files changed, 110 insertions(+), 58 deletions(-) + +diff --git a/configure.ac b/configure.ac +index af6cb3f..cf3a193 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -104,7 +104,7 @@ AC_CHECK_LIB([elf], [main]) + AC_CHECK_LIB([dw], [main]) + AC_CHECK_LIB([dwfl], [main]) + AC_CHECK_LIB([dl], [main]) +-AC_CHECK_FUNC(dwfl_frame_state_core, AC_DEFINE(HAVE_DWFL_FRAME_STATE_CORE, [], [Have function dwfl_frame_state_core for coredump unwinding])) ++AC_CHECK_FUNC(dwfl_getthreads, AC_DEFINE(HAVE_DWFL_NEXT_THREAD, [], [Have function dwfl_getthreads for coredump unwinding])) + + # libunwind + AC_CHECK_HEADERS([libunwind-coredump.h]) +diff --git a/lib/core_unwind_elfutils.c b/lib/core_unwind_elfutils.c +index 9a489ac..a8d8b3f 100644 +--- a/lib/core_unwind_elfutils.c ++++ b/lib/core_unwind_elfutils.c +@@ -29,59 +29,108 @@ + #include + #include + +-static struct sr_core_thread * +-unwind_thread(Dwfl *dwfl, Dwfl_Frame_State *state, char **error_msg) ++struct frame_callback_arg + { +- struct sr_core_frame *head = NULL, *tail = NULL; +- pid_t tid = 0; ++ struct sr_core_thread *thread; ++ char *error_msg; ++}; + +- if (state) ++struct thread_callback_arg ++{ ++ struct sr_core_stacktrace *stacktrace; ++ char *error_msg; ++}; ++ ++static int CB_STOP_UNWIND = DWARF_CB_ABORT+1; ++ ++static int ++frame_callback(Dwfl_Frame *frame, void *data) ++{ ++ struct frame_callback_arg *frame_arg = data; ++ char **error_msg = &frame_arg->error_msg; ++ ++ Dwarf_Addr pc; ++ bool minus_one; ++ if (!dwfl_frame_pc(frame, &pc, &minus_one)) + { +- tid = dwfl_frame_tid_get(state); ++ set_error_dwfl("dwfl_frame_pc"); ++ return DWARF_CB_ABORT; + } + +- while (state) ++ Dwfl *dwfl = dwfl_thread_dwfl(dwfl_frame_thread(frame)); ++ struct sr_core_frame *result = resolve_frame(dwfl, pc, minus_one); ++ ++ /* Do not unwind below __libc_start_main. */ ++ if (0 == sr_strcmp0(result->function_name, "__libc_start_main")) + { +- Dwarf_Addr pc; +- bool minus_one; +- if (!dwfl_frame_state_pc(state, &pc, &minus_one)) +- { +- warn("Failed to obtain PC: %s", dwfl_errmsg(-1)); +- break; +- } +- +- struct sr_core_frame *frame = resolve_frame(dwfl, pc, minus_one); +- list_append(head, tail, frame); +- +- /* Do not unwind below __libc_start_main. */ +- if (0 == sr_strcmp0(frame->function_name, "__libc_start_main")) +- break; +- +- if (!dwfl_frame_unwind(&state)) +- { +- warn("Cannot unwind frame: %s", dwfl_errmsg(-1)); +- break; +- } ++ sr_core_frame_free(result); ++ return CB_STOP_UNWIND; + } + +- if (!error_msg && !head) ++ frame_arg->thread->frames = ++ sr_core_frame_append(frame_arg->thread->frames, result); ++ ++ return DWARF_CB_OK; ++} ++ ++static int ++unwind_thread(Dwfl_Thread *thread, void *data) ++{ ++ struct thread_callback_arg *thread_arg = data; ++ char **error_msg = &thread_arg->error_msg; ++ ++ struct sr_core_thread *result = sr_core_thread_new(); ++ if (!result) + { +- set_error("No frames found for thread id %d", (int)tid); ++ set_error("Failed to initialize stacktrace memory"); ++ return DWARF_CB_ABORT; + } ++ result->id = (int64_t)dwfl_thread_tid(thread); ++ ++ struct frame_callback_arg frame_arg = ++ { ++ .thread = result, ++ .error_msg = NULL ++ }; + +- struct sr_core_thread *thread = sr_core_thread_new(); +- thread->id = (int64_t)tid; +- thread->frames = head; +- return thread; ++ int ret = dwfl_thread_getframes(thread, frame_callback, &frame_arg); ++ if (ret == -1) ++ { ++ warn("dwfl_thread_getframes failed for thread id %d: %s", ++ (int)result->id, dwfl_errmsg(-1)); ++ } ++ else if (ret == DWARF_CB_ABORT) ++ { ++ *error_msg = frame_arg.error_msg; ++ goto abort; ++ } ++ else if (ret != 0 && ret != CB_STOP_UNWIND) ++ { ++ *error_msg = sr_strdup("Unknown error in dwfl_thread_getframes"); ++ goto abort; ++ } ++ ++ if (!error_msg && !frame_arg.thread->frames) ++ { ++ set_error("No frames found for thread id %d", (int)result->id); ++ goto abort; ++ } ++ ++ thread_arg->stacktrace->threads = ++ sr_core_thread_append(thread_arg->stacktrace->threads, result); ++ return DWARF_CB_OK; ++ ++abort: ++ sr_core_thread_free(result); ++ return DWARF_CB_ABORT; + } + + struct sr_core_stacktrace * + sr_parse_coredump(const char *core_file, +- const char *exe_file, +- char **error_msg) ++ const char *exe_file, ++ char **error_msg) + { + struct sr_core_stacktrace *stacktrace = NULL; +- short signal = 0; + + /* Initialize error_msg to 'no error'. */ + if (error_msg) +@@ -91,11 +140,9 @@ sr_parse_coredump(const char *core_file, + if (*error_msg) + return NULL; + +- Dwfl_Frame_State *state = dwfl_frame_state_core(ch->dwfl, core_file); +- if (!state) ++ if (dwfl_core_file_attach(ch->dwfl, ch->eh) < 0) + { +- set_error("Failed to initialize frame state from core '%s'", +- core_file); ++ set_error_dwfl("dwfl_core_file_attach"); + goto fail_destroy_handle; + } + +@@ -105,20 +152,30 @@ sr_parse_coredump(const char *core_file, + set_error("Failed to initialize stacktrace memory"); + goto fail_destroy_handle; + } +- struct sr_core_thread *threads_tail = NULL; + +- do ++ struct thread_callback_arg thread_arg = + { +- struct sr_core_thread *t = unwind_thread(ch->dwfl, state, error_msg); +- if (*error_msg) +- { +- goto fail_destroy_trace; +- } +- list_append(stacktrace->threads, threads_tail, t); +- state = dwfl_frame_thread_next(state); +- } while (state); ++ .stacktrace = stacktrace, ++ .error_msg = NULL ++ }; + +- signal = get_signal_number(ch->eh, core_file); ++ int ret = dwfl_getthreads(ch->dwfl, unwind_thread, &thread_arg); ++ if (ret != 0) ++ { ++ if (ret == -1) ++ set_error_dwfl("dwfl_getthreads"); ++ else if (ret == DWARF_CB_ABORT) ++ *error_msg = thread_arg.error_msg; ++ else ++ *error_msg = sr_strdup("Unknown error in dwfl_getthreads"); ++ ++ goto fail_destroy_trace; ++ } ++ ++ stacktrace->executable = sr_strdup(exe_file); ++ stacktrace->signal = get_signal_number(ch->eh, core_file); ++ /* FIXME: is this the best we can do? */ ++ stacktrace->crash_thread = stacktrace->threads; + + fail_destroy_trace: + if (*error_msg) +@@ -128,11 +185,6 @@ fail_destroy_trace: + } + fail_destroy_handle: + core_handle_free(ch); +- +- stacktrace->executable = sr_strdup(exe_file); +- stacktrace->signal = signal; +- /* FIXME: is this the best we can do? */ +- stacktrace->crash_thread = stacktrace->threads; + return stacktrace; + } + +diff --git a/lib/internal_unwind.h b/lib/internal_unwind.h +index d537f86..2c9abb7 100644 +--- a/lib/internal_unwind.h ++++ b/lib/internal_unwind.h +@@ -27,7 +27,7 @@ + #include "config.h" + + /* define macros indicating what unwinder are we using */ +-#if (defined HAVE_LIBELF_H && defined HAVE_GELF_H && defined HAVE_LIBELF && defined HAVE_LIBDW && defined HAVE_ELFUTILS_LIBDWFL_H && defined HAVE_DWFL_FRAME_STATE_CORE) ++#if (defined HAVE_LIBELF_H && defined HAVE_GELF_H && defined HAVE_LIBELF && defined HAVE_LIBDW && defined HAVE_ELFUTILS_LIBDWFL_H && defined HAVE_DWFL_NEXT_THREAD) + # define WITH_LIBDWFL + #endif + +-- +1.8.3.1 + diff --git a/SOURCES/satyr-0.13-unwinder-refresh-config-h.patch b/SOURCES/satyr-0.13-unwinder-refresh-config-h.patch new file mode 100644 index 0000000..9a1abac --- /dev/null +++ b/SOURCES/satyr-0.13-unwinder-refresh-config-h.patch @@ -0,0 +1,31 @@ +diff -ur satyr-0.13/configure satyr-0.13-patched/configure +--- satyr-0.13/configure 2014-01-22 18:44:45.710649231 +0100 ++++ satyr-0.13-patched/configure 2014-01-22 18:40:12.606671169 +0100 +@@ -13261,10 +13255,10 @@ + + fi + +-ac_fn_c_check_func "$LINENO" "dwfl_frame_state_core" "ac_cv_func_dwfl_frame_state_core" +-if test "x$ac_cv_func_dwfl_frame_state_core" = xyes; then : ++ac_fn_c_check_func "$LINENO" "dwfl_getthreads" "ac_cv_func_dwfl_getthreads" ++if test "x$ac_cv_func_dwfl_getthreads" = xyes; then : + +-$as_echo "#define HAVE_DWFL_FRAME_STATE_CORE /**/" >>confdefs.h ++$as_echo "#define HAVE_DWFL_NEXT_THREAD /**/" >>confdefs.h + + fi + +diff -ur satyr-0.13/lib/config.h.in satyr-0.13-patched/lib/config.h.in +--- satyr-0.13/lib/config.h.in 2014-01-22 18:44:45.796649204 +0100 ++++ satyr-0.13-patched/lib/config.h.in 2014-01-22 18:40:13.001671173 +0100 +@@ -6,8 +6,8 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_DWARF_H + +-/* Have function dwfl_frame_state_core for coredump unwinding */ +-#undef HAVE_DWFL_FRAME_STATE_CORE ++/* Have function dwfl_getthreads for coredump unwinding */ ++#undef HAVE_DWFL_NEXT_THREAD + + /* Define to 1 if you have the header file. */ + #undef HAVE_ELFUTILS_LIBDWFL_H diff --git a/SPECS/satyr.spec b/SPECS/satyr.spec index 8a85168..3753ec1 100644 --- a/SPECS/satyr.spec +++ b/SPECS/satyr.spec @@ -7,31 +7,42 @@ %define enable_python_manpage 1 %endif +%if 0%{?suse_version} + %define python2_devel python-devel + %define libdw_devel libdw-devel + %define libelf_devel libelf-devel +%else + %define python2_devel python2-devel + %define libdw_devel elfutils-devel + %define libelf_devel elfutils-libelf-devel +%endif + Name: satyr -Version: 0.9 -Release: 1%{?dist} +Version: 0.13 +Release: 4%{?dist} Summary: Tools to create anonymous, machine-friendly problem reports Group: System Environment/Libraries License: GPLv2+ URL: https://github.com/abrt/satyr Source0: https://fedorahosted.org/released/abrt/satyr-%{version}.tar.xz -BuildRequires: python2-devel -BuildRequires: elfutils-devel, elfutils-libelf-devel, binutils-devel +BuildRequires: %{python2_devel} +BuildRequires: %{libdw_devel} +BuildRequires: %{libelf_devel} +BuildRequires: binutils-devel BuildRequires: rpm-devel - -# We're going to switch to elfutils unwinder once it's available -%if 0%{?rhel} -%else -# libunwind exists only on selected arches -%ifarch %{arm} hppa ia64 mips ppc ppc64 %{ix86} x86_64 -BuildRequires: libunwind-devel >= 1.1 -%endif -%endif - +BuildRequires: libtool +BuildRequires: pkgconfig +BuildRequires: automake +BuildRequires: gcc-c++ %if %{?enable_python_manpage} BuildRequires: python-sphinx %endif +Patch0: satyr-0.13-elfutils-0.158.patch +Patch1: satyr-0.13-elfutils-unwinder.patch +Patch2: satyr-0.13-disable-fingerprints.patch +Patch3: satyr-0.13-unwinder-refresh-config-h.patch + %description Satyr is a library that can be used to create and process microreports. Microreports consist of structured data suitable to be analyzed in a fully @@ -59,6 +70,10 @@ Python bindings for %{name}. %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %configure \ @@ -101,6 +116,36 @@ make check %endif %changelog +* Fri Jan 24 2014 Daniel Mach - 0.13-4 +- Mass rebuild 2014-01-24 + +* Wed Jan 22 2014 Martin Milata 0.13-3 +- Fix build with elfutils unwinder + - Resolves: #1051569 + +* Tue Jan 14 2014 Martin Milata 0.13-2 +- Use elfutils unwinder + - Resolves: #1051569 +- Disable function fingerprinting + - Resolves: #1052402 + +* Tue Jan 07 2014 Martin Milata 0.13-1 +- Rebase to satyr-0.13 + - Resolves: #1040900 +- Includes patch to build against elfutils-0.158 + +* Fri Dec 27 2013 Daniel Mach - 0.9-3 +- Mass rebuild 2013-12-27 + +* Wed Dec 04 2013 Martin Milata 0.9-2 +- Fix malformed JSON for some Java and koops reports + - Resolves: #1035317 + - Resolves: #1036790 +- Fix memory leak in RPM handling + - Resolves: #1016780 +- Check for unsigned overflows + - Resolves: #1034869 + * Wed Sep 11 2013 Jakub Filak 0.9-1 - New upstream version - Enrich koops uReport data with koops text and kernel version.