From df9a3ff5d9a0fedd7a977f8118972949c26f534e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 4 Feb 2016 16:30:39 +0100 Subject: [PATCH] 0.165-5 - Add elfutils-0.165-nobitsalign-strip.patch. --- elfutils-0.165-nobitsalign-strip.patch | 42 ++++++++++++++++++++++++++ elfutils.spec | 7 ++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 elfutils-0.165-nobitsalign-strip.patch diff --git a/elfutils-0.165-nobitsalign-strip.patch b/elfutils-0.165-nobitsalign-strip.patch new file mode 100644 index 0000000..4833431 --- /dev/null +++ b/elfutils-0.165-nobitsalign-strip.patch @@ -0,0 +1,42 @@ +Upstream proposed patch. +Note that this backport doesn't actually contain the new testcase. +It is just the elf_getdata fix. + +commit edff83d3416a136ce58a21a1244c99805e98f6d8 +Author: Mark Wielaard +Date: Thu Feb 4 09:53:41 2016 +0100 + + libelf: elf_getdata should not adjust alignment for SHT_NOBITS sections. + + In commit c0748e "libelf: More checking of valid sh_addralign values." we + adjusted bogus alignment of data buffers if they were greater than the + offset of the data in the file. This works OK, except when there is no + data in the file. So make sure to not adjust any NOBITS sections. + + Also adds a test that shows the issue and makes sure elflint is called + with --gnu in run-strip-test.sh. + + https://bugzilla.redhat.com/show_bug.cgi?id=1303845 + + Signed-off-by: Mark Wielaard + +diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c +index 4ec94b9..d1fafbf 100644 +--- a/libelf/elf_getdata.c ++++ b/libelf/elf_getdata.c +@@ -1,5 +1,5 @@ + /* Return the next data element from the section after possibly converting it. +- Copyright (C) 1998-2005, 2006, 2007, 2015 Red Hat, Inc. ++ Copyright (C) 1998-2005, 2006, 2007, 2015, 2016 Red Hat, Inc. + This file is part of elfutils. + Written by Ulrich Drepper , 1998. + +@@ -363,7 +363,7 @@ __libelf_set_rawdata_wrlock (Elf_Scn *scn) + at least an ehdr this will only trigger for alignment values > 64 + which should be uncommon. */ + align = align ?: 1; +- if (align > offset) ++ if (type != SHT_NOBITS && align > offset) + align = offset; + scn->rawdata.d.d_align = align; + if (elf->class == ELFCLASS32 diff --git a/elfutils.spec b/elfutils.spec index 93b1ee8..0cbeb1c 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.165 -%global baserelease 4 +%global baserelease 5 URL: https://fedorahosted.org/elfutils/ %global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/ License: GPLv3+ and (GPLv2+ or LGPLv3+) @@ -24,6 +24,7 @@ Source: %{?source_url}%{name}-%{version}.tar.bz2 # Needed for older (pre-2.22) glibc (f22 and earlier) Patch1: elfutils-0.165-elf-libelf.patch Patch2: elfutils-0.165-reloc.patch +Patch3: elfutils-0.165-nobitsalign-strip.patch Requires: elfutils-libelf%{depsuffix} = %{version}-%{release} Requires: elfutils-libs%{depsuffix} = %{version}-%{release} @@ -169,6 +170,7 @@ profiling) of processes. # Apply patches %patch1 -p1 -b .elf_libelf %patch2 -p1 -b .reloc +%patch3 -p1 -b .nobitsalign find . -name \*.sh ! -perm -0100 -print | xargs chmod +x @@ -305,6 +307,9 @@ rm -rf ${RPM_BUILD_ROOT} %endif %changelog +* Thu Feb 04 2016 Mark Wielaard - 0.165-5 +- Add elfutils-0.165-nobitsalign-strip.patch. + * Wed Feb 03 2016 Fedora Release Engineering - 0.165-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild