diff --git a/ltrace-0.7.2-e_machine.patch b/ltrace-0.7.2-e_machine.patch new file mode 100644 index 0000000..2cfc15a --- /dev/null +++ b/ltrace-0.7.2-e_machine.patch @@ -0,0 +1,20 @@ +diff -up ltrace-0.7.2/proc.c\~ ltrace-0.7.2/proc.c +--- ltrace-0.7.2/proc.c~ 2014-02-13 12:16:33.000000000 +0100 ++++ ltrace-0.7.2/proc.c 2014-02-13 15:44:25.000000000 +0100 +@@ -194,9 +197,11 @@ process_init(struct process *proc, const + goto fail; + } + +- if (proc->leader != proc) +- return 0; +- if (process_init_main(proc) < 0) { ++ if (proc->leader != proc) { ++ proc->e_machine = proc->leader->e_machine; ++ proc->e_class = proc->leader->e_class; ++ get_arch_dep(proc); ++ } else if (process_init_main(proc) < 0) { + process_bare_destroy(proc, 0); + goto fail; + } + +Diff finished. Thu Feb 13 15:50:21 2014 diff --git a/ltrace-0.7.2-rindex_NULL.patch b/ltrace-0.7.2-rindex_NULL.patch new file mode 100644 index 0000000..67f494a --- /dev/null +++ b/ltrace-0.7.2-rindex_NULL.patch @@ -0,0 +1,29 @@ +From aafb00b7d7751049b99cac3953b5021e4f474ac4 Mon Sep 17 00:00:00 2001 +From: Petr Machata +Date: Tue, 8 Jan 2013 18:12:07 +0100 +Subject: [PATCH] Don't add 1 to potentially NULL pointer comming from rindex + +--- + ltrace-elf.c | 8 +++++--- + 1 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/ltrace-elf.c b/ltrace-elf.c +index 1d0f769..29c204f 100644 +--- a/ltrace-elf.c ++++ b/ltrace-elf.c +@@ -889,8 +889,10 @@ read_module(struct library *lib, struct process *proc, + goto fail; + library_set_soname(lib, soname, 1); + } else { +- const char *soname = rindex(lib->pathname, '/') + 1; +- if (soname == NULL) ++ const char *soname = rindex(lib->pathname, '/'); ++ if (soname != NULL) ++ soname += 1; ++ else + soname = lib->pathname; + library_set_soname(lib, soname, 0); + } +-- +1.7.6.5 + diff --git a/ltrace-0.7.2-static-free.patch b/ltrace-0.7.2-static-free.patch new file mode 100644 index 0000000..a483a99 --- /dev/null +++ b/ltrace-0.7.2-static-free.patch @@ -0,0 +1,44 @@ +From cae76962c7e0ec6119952addb36d1cf8d19f5228 Mon Sep 17 00:00:00 2001 +From: Peter Wu +Date: Thu, 26 Sep 2013 00:55:57 +0200 +Subject: [PATCH] Prevent freeing static-alloc'd memory for %p and %n in printf + +The following code caused ltrace 0.7.3-1 to crash on Arch Linux because +an invalid pointer was passed to free(): + + printf("%p", &whatever); + +In printf.c, the elt_info pointer was always a statically allocated +memory address from type_get_simple(): + +115 if (format_type == ARGTYPE_ARRAY || + format_type == ARGTYPE_POINTER) +116 elt_info = type_get_simple(elt_type); + +Therefore, do not assert that the caller form_next_param owns the +elt_info pointer. + +Originally reported at +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=724253 + +Signed-off-by: Peter Wu +--- + printf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/printf.c b/printf.c +index 9051d71..52b212c 100644 +--- a/printf.c ++++ b/printf.c +@@ -168,7 +168,7 @@ form_next_param(struct param_enum *self, + type_init_pointer(infop, array, 1); + + } else if (format_type == ARGTYPE_POINTER) { +- type_init_pointer(infop, elt_info, 1); ++ type_init_pointer(infop, elt_info, 0); + + } else { + *infop = *type_get_simple(format_type); +-- +2.1.0 + diff --git a/ltrace.spec b/ltrace.spec index eaadbc9..e5dbaf5 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.2 -Release: 7%{?dist} +Release: 10%{?dist} URL: http://ltrace.alioth.debian.org/ License: GPLv2+ Group: Development/Debuggers @@ -27,6 +27,15 @@ Patch2: ltrace-0.7.2-unused-typedef.patch # s390 set_instruction_pointer: Set highest bit in 31-bit tracer Patch3: ltrace-0.7.2-s390-set_instruction_pointer.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1044766 +Patch4: ltrace-0.7.2-rindex_NULL.patch + +# https://bugzilla.redhat.com/show_bug.cgi?id=1064406 +Patch5: ltrace-0.7.2-e_machine.patch + +# https://bugzilla.redhat.com/show_bug.cgi?id=1212314 +Patch6: ltrace-0.7.2-static-free.patch + %description Ltrace is a debugging program which runs a specified command until the command exits. While the command is executing, ltrace intercepts and @@ -43,6 +52,9 @@ execution of processes. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build autoreconf -i @@ -68,6 +80,20 @@ echo ====================TESTING END===================== %config(noreplace) %{_sysconfdir}/ltrace.conf %changelog +* Thu Apr 16 2015 Petr Machata - 0.7.2-10 +- Add an upstream patch that fixes memory errors when %%p is used in a + formatting string in printf-like calls. + (ltrace-0.7.2-static-free.patch) + +* Thu Feb 13 2014 Petr Machata - 0.7.2-9 +- Add an upstream patch that fixes missed initialization of some + fields in struct process after atteching to a multi-threaded + process. (ltrace-0.7.2-e_machine.patch) + +* Wed Jan 15 2014 Petr Machata - 0.7.2-8 +- Add an upstream patch for proper checking of rindex call over + pathname for NULL-ness. (ltrace-0.7.2-rindex_NULL.patch) + * Wed Aug 7 2013 Ville Skyttä - 0.7.2-7 - Install docs to %%{_pkgdocdir} where available (#992149).