From 5695a6a3e519e6f15ae9c975b97edb9912357c68 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Tue, 5 Mar 2019 17:50:28 -0500 Subject: [PATCH] Fix "Too many return value classes" assert Patch to ensure e_machine is properly initialized in some cases where we attach to a running multi-threaded process. --- ltrace-0.7.91-emachine-init.patch | 49 +++++++++++++++++++++++++++++++ ltrace.spec | 9 +++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 ltrace-0.7.91-emachine-init.patch diff --git a/ltrace-0.7.91-emachine-init.patch b/ltrace-0.7.91-emachine-init.patch new file mode 100644 index 0000000..7bcc765 --- /dev/null +++ b/ltrace-0.7.91-emachine-init.patch @@ -0,0 +1,49 @@ +Patch to ensure e_machine is properly initialized in some cases where +we attach to a running multi-threaded process. + +diff -rup a/proc.c b/proc.c +--- a/proc.c 2019-02-28 17:32:50.020734842 -0500 ++++ b/proc.c 2019-02-28 21:04:31.179942091 -0500 +@@ -38,6 +38,7 @@ + #include "breakpoint.h" + #include "debug.h" + #include "fetch.h" ++#include "ltrace-elf.h" + #include "options.h" + #include "proc.h" + #include "value_dict.h" +@@ -218,6 +219,21 @@ process_init(struct process *proc, const + return -1; + } + ++ { ++ struct ltelf lte; ++ ++ if (ltelf_init(<e, filename) < 0) { ++ process_bare_destroy(proc, 0); ++ goto fail; ++ } ++ ++ proc->e_machine = lte.ehdr.e_machine; ++ proc->e_class = lte.ehdr.e_ident[EI_CLASS]; ++ get_arch_dep(proc); ++ ++ ltelf_destroy(<e); ++ } ++ + if (os_process_init(proc) < 0) { + process_bare_destroy(proc, 0); + goto fail; +diff -rup a/sysdeps/linux-gnu/x86/fetch.c b/sysdeps/linux-gnu/x86/fetch.c +--- a/sysdeps/linux-gnu/x86/fetch.c 2019-02-28 17:32:50.168810377 -0500 ++++ b/sysdeps/linux-gnu/x86/fetch.c 2019-02-28 20:57:32.162800555 -0500 +@@ -275,6 +275,9 @@ allocate_integer(struct fetch_context *c + #undef HANDLE32 + } + ++ assert(!"Unknown machine architecture"); ++ abort(); ++ + case POOL_RETVAL: + switch (context->ireg) { + #ifdef __x86_64__ diff --git a/ltrace.spec b/ltrace.spec index f2ff26e..287e190 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 30%{?dist} +Release: 31%{?dist} URL: http://ltrace.alioth.debian.org/ License: GPLv2+ @@ -108,6 +108,9 @@ Patch28: ltrace-0.7.91-aarch64-params.patch # gcc-9 fix. Avoid passing NULL as argument to %s Patch29: ltrace-0.7.91-null.patch +# Fix "Too many return value classes" assert +Patch30: ltrace-0.7.91-emachine-init.patch + %description Ltrace is a debugging program which runs a specified command until the command exits. While the command is executing, ltrace intercepts and @@ -149,6 +152,7 @@ execution of processes. %patch27 -p1 %patch28 -p1 %patch29 -p1 +%patch30 -p1 %build autoreconf -i @@ -173,6 +177,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Tue Mar 5 2019 Eugene Syromiatnikov - 0.7.91-31 +- Fix "Too many return value classes" assert + * Fri Feb 01 2019 Fedora Release Engineering - 0.7.91-30 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild