Package: elfutils Version: 0.166-2.2 Severity: normal Tags: patch Dear Maintainer,
Version 0.166 will crash if sections are added to an empty ELF file. This problem has been fixed in the released upstream version 0.167. The exact commit that fixes the problem is here [0]. A new tool [1] has been submitted for inclusion in Debian that would like to add sections to empty ELF files. This tool tests _ELFUTILS_VERSION to make sure it is at least 167 before activating the feature. Since this tool will most likely be available for stretch, it would be nice if 0.167 of the elfutils was also in stretch (rather than just patching 0.166). Therefore, I am requesting that elfutils moves to the new upstream version 0.167. I have attached a diff against the 0.166-debian directory to allow version 0.167 to be built. Hopefully this will help you. However, I was unsure how to handle the m68k_backend.diff patch since version 0.167 provides an m68k backend and this differs from the one implemented in the Debian patch. My diff ignores m68k_backend.diff, which is most likely not what you want. John Ogness [0] https://git.fedorahosted.org/cgit/elfutils.git/commit/?id=96e140f6687922606657a76f185a73cf47908ef2 [1] https://lists.debian.org/debian-devel/2016/09/msg00224.html -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.8.0-1-amd64 (SMP w/1 CPU core) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages elfutils depends on: ii libasm1 0.166-2.2 ii libc6 2.24-5 ii libdw1 0.166-2.2 ii libelf1 0.166-2.2 ii libstdc++6 6.2.0-13 elfutils recommends no packages. elfutils suggests no packages. -- no debconf information
diff -Nru elfutils-0.166/debian/changelog elfutils-0.167/debian/changelog --- elfutils-0.166/debian/changelog 2016-10-18 07:13:34.000000000 +0000 +++ elfutils-0.167/debian/changelog 2016-11-30 12:17:52.050276511 +0000 @@ -1,3 +1,9 @@ +elfutils (0.167-1) unstable; urgency=medium + + * New upstream. + + -- John Ogness <john.ogn...@linutronix.de> Wed, 30 Nov 2016 13:04:21 +0100 + elfutils (0.166-2.2) unstable; urgency=medium * Non-maintainer upload. diff -Nru elfutils-0.166/debian/libdw1.symbols elfutils-0.167/debian/libdw1.symbols --- elfutils-0.166/debian/libdw1.symbols 2016-01-11 20:45:33.000000000 +0000 +++ elfutils-0.167/debian/libdw1.symbols 2016-11-30 12:17:52.050276511 +0000 @@ -18,4 +18,5 @@ *@ELFUTILS_0.160 0.160 *@ELFUTILS_0.161 0.161 *@ELFUTILS_0.165 0.165 + *@ELFUTILS_0.167 0.167 *@ELFUTILS_0 0.126 diff -Nru elfutils-0.166/debian/patches/hppa_backend.diff elfutils-0.167/debian/patches/hppa_backend.diff --- elfutils-0.166/debian/patches/hppa_backend.diff 2015-12-26 20:35:48.000000000 +0000 +++ elfutils-0.167/debian/patches/hppa_backend.diff 2016-11-30 12:17:52.050276511 +0000 @@ -722,28 +722,28 @@ +extern int parisc_return_value_location_64(Dwarf_Die *, const Dwarf_Op **locp); + +#endif -Index: elfutils-0.164/backends/Makefile.am +Index: elfutils-0.167/backends/Makefile.am =================================================================== ---- elfutils-0.164.orig/backends/Makefile.am -+++ elfutils-0.164/backends/Makefile.am -@@ -33,11 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I +--- elfutils-0.167.orig/backends/Makefile.am ++++ elfutils-0.167/backends/Makefile.am +@@ -33,12 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ -- tilegx -+ tilegx parisc +- tilegx m68k bpf ++ tilegx m68k bpf parisc libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ -- libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a -+ libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \ -+ libebl_parisc_pic.a + libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \ +- libebl_m68k_pic.a libebl_bpf_pic.a ++ libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a noinst_LIBRARIES = $(libebl_pic) noinst_DATA = $(libebl_pic:_pic.a=.so) -@@ -111,6 +112,9 @@ tilegx_SRCS = tilegx_init.c tilegx_symbo - libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS) - am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os) +@@ -128,6 +128,9 @@ endif + libebl_bpf_pic_a_SOURCES = $(bpf_SRCS) + am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os) +parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c +libebl_parisc_pic_a_SOURCES = $(parisc_SRCS) diff -Nru elfutils-0.166/debian/patches/mips_backend.diff elfutils-0.167/debian/patches/mips_backend.diff --- elfutils-0.166/debian/patches/mips_backend.diff 2015-12-26 20:40:19.000000000 +0000 +++ elfutils-0.167/debian/patches/mips_backend.diff 2016-11-30 12:17:52.054276472 +0000 @@ -650,55 +650,28 @@ + { "mips", "elf_mipsel", "mipsel", 4, EM_MIPS_RS3_LE, 0, 0 }, { "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 }, - { "m68k", "elf_m68k", "m68k", 4, EM_68K, 0, 0 }, -Index: elfutils-0.164/backends/common-reloc.c + { "m68k", "elf_m68k", "m68k", 4, EM_68K, ELFCLASS32, ELFDATA2MSB }, +Index: elfutils-0.167/backends/Makefile.am =================================================================== ---- elfutils-0.164.orig/backends/common-reloc.c -+++ elfutils-0.164/backends/common-reloc.c -@@ -125,11 +125,13 @@ EBLHOOK(reloc_valid_use) (Elf *elf, int - } - - -+#ifndef NO_COPY_RELOC - bool - EBLHOOK(copy_reloc_p) (int reloc) - { - return reloc == R_TYPE (COPY); - } -+#endif - - bool - EBLHOOK(none_reloc_p) (int reloc) -@@ -151,7 +153,9 @@ EBLHOOK(init_reloc) (Ebl *ebl) - ebl->reloc_type_name = EBLHOOK(reloc_type_name); - ebl->reloc_type_check = EBLHOOK(reloc_type_check); - ebl->reloc_valid_use = EBLHOOK(reloc_valid_use); -+#ifndef NO_COPY_RELOC - ebl->copy_reloc_p = EBLHOOK(copy_reloc_p); -+#endif - ebl->none_reloc_p = EBLHOOK(none_reloc_p); - #ifndef NO_RELATIVE_RELOC - ebl->relative_reloc_p = EBLHOOK(relative_reloc_p); -Index: elfutils-0.164/backends/Makefile.am -=================================================================== ---- elfutils-0.164.orig/backends/Makefile.am -+++ elfutils-0.164/backends/Makefile.am -@@ -33,12 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I +--- elfutils-0.167.orig/backends/Makefile.am ++++ elfutils-0.167/backends/Makefile.am +@@ -33,12 +33,13 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ -- tilegx parisc -+ tilegx parisc mips +- tilegx m68k bpf parisc ++ tilegx m68k bpf parisc mips libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \ -- libebl_parisc_pic.a -+ libebl_parisc_pic.a libebl_mips_pic.a +- libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a ++ libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a \ ++ libebl_mips_pic.a noinst_LIBRARIES = $(libebl_pic) noinst_DATA = $(libebl_pic:_pic.a=.so) -@@ -116,6 +116,10 @@ parisc_SRCS = parisc_init.c parisc_symbo +@@ -132,6 +133,10 @@ parisc_SRCS = parisc_init.c parisc_symbo libebl_parisc_pic_a_SOURCES = $(parisc_SRCS) am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os) diff -Nru elfutils-0.166/debian/patches/series elfutils-0.167/debian/patches/series --- elfutils-0.166/debian/patches/series 2016-10-18 07:13:34.000000000 +0000 +++ elfutils-0.167/debian/patches/series 2016-11-30 12:17:52.054276472 +0000 @@ -1,7 +1,7 @@ hppa_backend.diff arm_backend.diff mips_backend.diff -m68k_backend.diff +# m68k_backend.diff testsuite-ignore-elflint.diff mips_readelf_w.patch kfreebsd_path.patch @@ -10,4 +10,3 @@ 0003-Add-mips-n64-relocation-format-hack.patch hurd_path.patch ignore_strmerge.diff -testsuite-amd64-fix-backtrace-native.patch diff -Nru elfutils-0.166/debian/patches/testsuite-amd64-fix-backtrace-native.patch elfutils-0.167/debian/patches/testsuite-amd64-fix-backtrace-native.patch --- elfutils-0.166/debian/patches/testsuite-amd64-fix-backtrace-native.patch 2016-10-18 07:13:34.000000000 +0000 +++ elfutils-0.167/debian/patches/testsuite-amd64-fix-backtrace-native.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,220 +0,0 @@ -From 9008499a5276c45b37bc0adb47e7ad227e6ba2a9 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard <m...@redhat.com> -Date: Thu, 25 Aug 2016 17:17:23 +0200 -Subject: [PATCH 1/1] tests: Simplify backtrace-native tests. Drop raise jmp - patching for x86_64. - -The backtrace-native[-biarch] testcase was a little too clever in places -making it unreliable. - -On x86_64 we tried to make an interesting backtrace by catching the -first signal and then replacing the pc with the address of the first -instruction of a function. Then we would raise a new signal, through -ptrace, to create a backtrace that went from a signal frame into a -frame at the start of a function. That way we could check that we were -trying to fetch the correct CFI for the (jmp) function even at the -first instruction (normally we would substract one from the return -address to get at the call address). - -This works as long as the CFI for the jmp() function is identical to -the CFI for the raise() function that we "patched away". Unfortunately -on Fedora rawhide glibc has a rewritten raise() implementation that has -different CFI, in particular the CFA is calculated differently. Making -the testcase fail because we cannot properly unwind from jmp(). -So this special x86_64 case has been disabled (the code is still there -in case we find another way to test this in a more reliable way). - -On Ubuntu there have been spurious testcase failures because -see_exec_module found two Dwfl_Modules with the same path. This would -trigger an assert. Although this might indicate some issue (maybe we -are not parsing the proc/pid/map correctly?) it isn't clear that it -really is a bug. Since the assert is not very helpful finding any -actual bug and for the testcase it is only necessary that the first -Dwfl_Module that represents the executable is found we just pick that -Dwfl_Module and don't iterate through any of the others. - -Signed-off-by: Mark Wielaard <m...@redhat.com> ---- - tests/backtrace-child.c | 18 ++++++++++++++---- - tests/backtrace.c | 39 +++++++++++++++++++++------------------ - 3 files changed, 51 insertions(+), 22 deletions(-) - -diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c -index 40e7b32..cf4547c 100644 ---- a/tests/backtrace-child.c -+++ b/tests/backtrace-child.c -@@ -1,5 +1,5 @@ - /* Test child for parent backtrace test. -- Copyright (C) 2013 Red Hat, Inc. -+ Copyright (C) 2013, 2016 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -19,7 +19,8 @@ - --ptraceme will call ptrace (PTRACE_TRACEME) in the two threads. - --gencore will call abort () at its end. - Main thread will signal SIGUSR2. Other thread will signal SIGUSR1. -- On x86_64 only: -+ There used to be a difference between x86_64 and other architectures. -+ To test getting a signal at the very first instruction of a function: - PC will get changed to function 'jmp' by backtrace.c function - prepare_thread. Then SIGUSR2 will be signalled to backtrace-child - which will invoke function sigusr2. -@@ -66,8 +67,17 @@ - # 5 0xf77c1a48 - 1 start - # 6 0xf77699da - 1 start_thread - # 7 0xf769bbfe - 1 __clone -+ -+ But the raise jmp patching was unreliable. It depends on the CFI for the raise() -+ function in glibc to be the same as for the jmp() function. This is not always -+ the case. Some newer glibc versions rewrote raise() and now the CFA is calculated -+ differently. So we disable raise jmp patching everywhere. - */ - -+#ifdef __x86_64__ -+/* #define RAISE_JMP_PATCHING 1 */ -+#endif -+ - #include <config.h> - #include <assert.h> - #include <stdlib.h> -@@ -130,7 +140,7 @@ dummy1 (void) - asm volatile (""); - } - --#ifdef __x86_64__ -+#ifdef RAISE_JMP_PATCHING - static NOINLINE_NOCLONE USED void - jmp (void) - { -@@ -157,7 +167,7 @@ stdarg (int f UNUSED, ...) - assert (errno == 0); - assert (l == 0); - } --#ifdef __x86_64__ -+#ifdef RAISE_JMP_PATCHING - if (! gencore) - { - /* Execution will get PC patched into function jmp. */ -diff --git a/tests/backtrace.c b/tests/backtrace.c -index 1247643..2440ab3 100644 ---- a/tests/backtrace.c -+++ b/tests/backtrace.c -@@ -1,5 +1,5 @@ - /* Test program for unwinding of frames. -- Copyright (C) 2013, 2014 Red Hat, Inc. -+ Copyright (C) 2013, 2014, 2016 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -64,7 +64,7 @@ dump_modules (Dwfl_Module *mod, void **userdata __attribute__ ((unused)), - return DWARF_CB_OK; - } - --static bool is_x86_64_native; -+static bool use_raise_jmp_patching; - static pid_t check_tid; - - static void -@@ -93,7 +93,7 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc, - static bool reduce_frameno = false; - if (reduce_frameno) - frameno--; -- if (! is_x86_64_native && frameno >= 2) -+ if (! use_raise_jmp_patching && frameno >= 2) - frameno += 2; - const char *symname2 = NULL; - switch (frameno) -@@ -112,8 +112,8 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc, - case 2: // x86_64 only - /* __restore_rt - glibc maybe does not have to have this symbol. */ - break; -- case 3: // x86_64 only -- if (is_x86_64_native) -+ case 3: // use_raise_jmp_patching -+ if (use_raise_jmp_patching) - { - /* Verify we trapped on the very first instruction of jmp. */ - assert (symname != NULL && strcmp (symname, "jmp") == 0); -@@ -138,7 +138,7 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc, - // there is no guarantee that the compiler doesn't reorder the - // instructions or even inserts some padding instructions at the end - // (which apparently happens on ppc64). -- if (is_x86_64_native) -+ if (use_raise_jmp_patching) - assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0); - break; - } -@@ -243,10 +243,10 @@ see_exec_module (Dwfl_Module *mod, void **userdata __attribute__ ((unused)), - return DWARF_CB_OK; - assert (data->mod == NULL); - data->mod = mod; -- return DWARF_CB_OK; -+ return DWARF_CB_ABORT; - } - --/* On x86_64 only: -+/* We used to do this on x86_64 only (see backtrace-child why we now don't): - PC will get changed to function 'jmp' by backtrace.c function - prepare_thread. Then SIGUSR2 will be signalled to backtrace-child - which will invoke function sigusr2. -@@ -254,13 +254,17 @@ see_exec_module (Dwfl_Module *mod, void **userdata __attribute__ ((unused)), - instruction of a function. Properly handled unwind should not slip into - the previous unrelated function. */ - -+#ifdef __x86_64__ -+/* #define RAISE_JMP_PATCHING 1 */ -+#endif -+ - static void - prepare_thread (pid_t pid2 __attribute__ ((unused)), - void (*jmp) (void) __attribute__ ((unused))) - { --#ifndef __x86_64__ -+#ifndef RAISE_JMP_PATCHING - abort (); --#else /* x86_64 */ -+#else /* RAISE_JMP_PATCHING */ - long l; - struct user_regs_struct user_regs; - errno = 0; -@@ -278,7 +282,7 @@ prepare_thread (pid_t pid2 __attribute__ ((unused)), - assert (got == pid2); - assert (WIFSTOPPED (status)); - assert (WSTOPSIG (status) == SIGUSR1); --#endif /* __x86_64__ */ -+#endif /* RAISE_JMP_PATCHING */ - } - - #include <asm/unistd.h> -@@ -370,21 +374,20 @@ exec_dump (const char *exec) - assert (ssize > 0 && ssize < (ssize_t) sizeof (data.selfpath)); - data.selfpath[ssize] = '\0'; - data.mod = NULL; -- ptrdiff_t ptrdiff = dwfl_getmodules (dwfl, see_exec_module, &data, 0); -- assert (ptrdiff == 0); -+ dwfl_getmodules (dwfl, see_exec_module, &data, 0); - assert (data.mod != NULL); - GElf_Addr loadbase; - Elf *elf = dwfl_module_getelf (data.mod, &loadbase); - GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem); - assert (ehdr != NULL); - /* It is false also on x86_64 with i386 inferior. */ --#ifndef __x86_64__ -- is_x86_64_native = false; --#else /* __x86_64__ */ -- is_x86_64_native = ehdr->e_machine == EM_X86_64; -+#ifndef RAISE_JMP_PATCHING -+ use_raise_jmp_patching = false; -+#else /* RAISE_JMP_PATCHING_ */ -+ use_raise_jmp_patching = ehdr->e_machine == EM_X86_64; - #endif /* __x86_64__ */ - void (*jmp) (void) = 0; -- if (is_x86_64_native) -+ if (use_raise_jmp_patching) - { - // Find inferior symbol named "jmp". - int nsym = dwfl_module_getsymtab (data.mod); --- -2.9.3 -