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.
This commit is contained in:
Eugene Syromiatnikov 2019-03-05 17:50:28 -05:00 committed by DJ Delorie
parent 32b5bcdc8d
commit 5695a6a3e5
2 changed files with 57 additions and 1 deletions

View File

@ -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(&lte, 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(&lte);
+ }
+
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__

View File

@ -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 <esyr@redhat.com> - 0.7.91-31
- Fix "Too many return value classes" assert
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.91-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild