From 05113d6751c269ecd556b470f4abff8df052b596 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 3 Apr 2012 00:41:30 +0200 Subject: [PATCH] Fix for eu-unstrip emits garbage for librt.so.1 (#805447) --- ...ils-0.153-dwfl_segment_report_module.patch | 45 +++++++++++++++++++ elfutils.spec | 9 +++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 elfutils-0.153-dwfl_segment_report_module.patch diff --git a/elfutils-0.153-dwfl_segment_report_module.patch b/elfutils-0.153-dwfl_segment_report_module.patch new file mode 100644 index 0000000..f893c4f --- /dev/null +++ b/elfutils-0.153-dwfl_segment_report_module.patch @@ -0,0 +1,45 @@ +commit 210c2f03efbbaacc51f2641baa0947d9c316de12 +Author: Roland McGrath +Date: Wed Mar 28 10:22:35 2012 -0700 + + RHBZ#805447: Fix core file grokking for case of truncated .dynstr + +diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog +index 87a0555..86f6fba 100644 +--- a/libdwfl/ChangeLog ++++ b/libdwfl/ChangeLog +@@ -1,3 +1,10 @@ ++2012-03-28 Roland McGrath ++ ++ * dwfl_segment_report_module.c ++ (dwfl_segment_report_module: read_portion): Don't use existing buffer ++ when FILESZ is zero (string mode) and available portion doesn't hold ++ a terminated string. ++ + 2011-12-02 Roland McGrath + + * elf-from-memory.c (elf_from_remote_memory): Fix ELFCLASS64 case +diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c +index 012a0fd..5534180 100644 +--- a/libdwfl/dwfl_segment_report_module.c ++++ b/libdwfl/dwfl_segment_report_module.c +@@ -1,5 +1,5 @@ + /* Sniff out modules from ELF headers visible in memory segments. +- Copyright (C) 2008-2010 Red Hat, Inc. ++ Copyright (C) 2008-2012 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify +@@ -155,7 +155,11 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, + inline bool read_portion (void **data, size_t *data_size, + GElf_Addr vaddr, size_t filesz) + { +- if (vaddr - start + filesz > buffer_available) ++ if (vaddr - start + filesz > buffer_available ++ /* If we're in string mode, then don't consider the buffer we have ++ sufficient unless it contains the terminator of the string. */ ++ || (filesz == 0 && memchr (vaddr - start + buffer, '\0', ++ buffer_available - (vaddr - start)) == NULL)) + { + *data = NULL; + *data_size = filesz; diff --git a/elfutils.spec b/elfutils.spec index 00116c1..76e3da8 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,7 +1,7 @@ Name: elfutils Summary: A collection of utilities and DSOs to handle compiled objects Version: 0.153 -%global baserelease 1 +%global baserelease 2 URL: https://fedorahosted.org/elfutils/ %global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/ License: GPLv2 with exceptions @@ -46,6 +46,8 @@ Source: %{?source_url}%{name}-%{version}.tar.bz2 Patch1: %{?source_url}elfutils-robustify.patch Patch2: %{?source_url}elfutils-portability.patch +Patch3: elfutils-0.153-dwfl_segment_report_module.patch + %if !%{compat} Release: %{baserelease}%{?dist} %else @@ -205,6 +207,8 @@ sed -i.scanf-m -e 's/%m/%a/g' src/addr2line.c tests/line2addr.c find . -name \*.sh ! -perm -0100 -print | xargs chmod +x +%patch3 -p1 -b .dwfl_segment_report_module + %build # Remove -Wall from default flags. The makefiles enable enough warnings # themselves, and they use -Werror. Appending -Wall defeats the cases where @@ -318,6 +322,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/libelf.a %changelog +* Mon Apr 02 2012 Mark Wielaard - 0.153-2 +- Fix for eu-unstrip emits garbage for librt.so.1 (#805447) + * Thu Feb 23 2012 Mark Wielaard - 0.153-1 - Update to 0.153 - New --disable-werror for portability.