Add upstream xlatetom fix (#835877)

This commit is contained in:
Mark Wielaard 2012-07-18 13:18:05 +02:00
parent 33bbf67f49
commit 3152a53945
3 changed files with 54 additions and 47 deletions

View File

@ -1,42 +0,0 @@
diff -up elfutils-0.154/tests/Makefile.am.835877 elfutils-0.154/tests/Makefile.am
--- elfutils-0.154/tests/Makefile.am.835877 2012-07-02 07:20:15.050457120 -0400
+++ elfutils-0.154/tests/Makefile.am 2012-07-02 07:21:01.880423371 -0400
@@ -79,7 +79,7 @@ TESTS = run-arextract.sh run-arsymtest.s
run-early-offscn.sh run-dwarf-getmacros.sh \
run-test-flag-nobits.sh run-prelink-addr-test.sh \
run-dwarf-getstring.sh run-rerequest_tag.sh run-typeiter.sh \
- run-readelf-d.sh run-unstrip-n.sh run-low_high_pc.sh
+ run-readelf-d.sh run-low_high_pc.sh
if !STANDALONE
noinst_PROGRAMS += msg_tst md5-sha1-test
@@ -156,7 +156,7 @@ EXTRA_DIST = run-arextract.sh run-arsymt
testfile56.bz2 testfile57.bz2 testfile58.bz2 \
run-typeiter.sh testfile59.bz2 \
run-readelf-d.sh testlib_dynseg.so.bz2 \
- run-unstrip-n.sh testcore-rtlib.bz2 \
+ testcore-rtlib.bz2 \
run-low_high_pc.sh testfile_low_high_pc.bz2
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
diff -up elfutils-0.154/tests/Makefile.in.835877 elfutils-0.154/tests/Makefile.in
--- elfutils-0.154/tests/Makefile.in.835877 2012-07-02 07:20:07.830415701 -0400
+++ elfutils-0.154/tests/Makefile.in 2012-07-02 07:20:49.900433188 -0400
@@ -87,7 +87,7 @@ TESTS = run-arextract.sh run-arsymtest.s
run-dwarf-getmacros.sh run-test-flag-nobits.sh \
run-prelink-addr-test.sh run-dwarf-getstring.sh \
run-rerequest_tag.sh run-typeiter.sh run-readelf-d.sh \
- run-unstrip-n.sh run-low_high_pc.sh $(am__EXEEXT_1) \
+ run-low_high_pc.sh $(am__EXEEXT_1) \
$(am__EXEEXT_3)
@STANDALONE_FALSE@am__append_5 = msg_tst md5-sha1-test
@STANDALONE_FALSE@am__append_6 = msg_tst md5-sha1-test
@@ -575,7 +575,7 @@ EXTRA_DIST = run-arextract.sh run-arsymt
testfile56.bz2 testfile57.bz2 testfile58.bz2 \
run-typeiter.sh testfile59.bz2 \
run-readelf-d.sh testlib_dynseg.so.bz2 \
- run-unstrip-n.sh testcore-rtlib.bz2 \
+ testcore-rtlib.bz2 \
run-low_high_pc.sh testfile_low_high_pc.bz2
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \

View File

@ -0,0 +1,48 @@
commit bc0f7450cb0fd5717f532bce1b39f45312cc2fd9
Author: Petr Machata <pmachata@redhat.com>
Date: Tue Jul 17 16:29:18 2012 +0200
elf*_xlatetom: do not check ELF_T_NHDR has integer number of records
See this bug report for more details:
https://bugzilla.redhat.com/show_bug.cgi?id=835877
Signed-off-by: Petr Machata <pmachata@redhat.com>
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 89dd35f..0a6bcba 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-17 Petr Machata <pmachata@redhat.com>
+
+ * elf32_xlatetom.c (elfw2(LIBELFBITS, xlatetom)): Do not check for
+ integer number of records in case of ELF_T_NHDR.
+
2012-04-02 Mark Wielaard <mjw@redhat.com>
* elf32_offscn.c: Do not match SHT_NOBITS sections at OFFSET unless
diff --git a/libelf/elf32_xlatetom.c b/libelf/elf32_xlatetom.c
index 8fdf09d..368df07 100644
--- a/libelf/elf32_xlatetom.c
+++ b/libelf/elf32_xlatetom.c
@@ -1,5 +1,5 @@
/* Convert from file to memory representation.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2012 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -59,7 +59,11 @@ elfw2(LIBELFBITS, xlatetom) (dest, src, encode)
#endif
- if (src->d_size % recsize != 0)
+ /* We shouldn't require integer number of records when processing
+ notes. Payload bytes follow the header immediately, it's not an
+ array of records as is the case otherwise. */
+ if (src->d_type != ELF_T_NHDR
+ && src->d_size % recsize != 0)
{
__libelf_seterrno (ELF_E_INVALID_DATA);
return NULL;

View File

@ -1,7 +1,7 @@
Name: elfutils Name: elfutils
Summary: A collection of utilities and DSOs to handle compiled objects Summary: A collection of utilities and DSOs to handle compiled objects
Version: 0.154 Version: 0.154
%global baserelease 1.1 %global baserelease 2
URL: https://fedorahosted.org/elfutils/ URL: https://fedorahosted.org/elfutils/
%global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/ %global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/
License: GPLv3+ and (GPLv2+ or LGPLv3+) License: GPLv3+ and (GPLv2+ or LGPLv3+)
@ -46,9 +46,7 @@ Source: %{?source_url}%{name}-%{version}.tar.bz2
Patch1: %{?source_url}elfutils-robustify.patch Patch1: %{?source_url}elfutils-robustify.patch
Patch2: %{?source_url}elfutils-portability.patch Patch2: %{?source_url}elfutils-portability.patch
Patch3: elfutils-0.154-binutils-pr-ld-13621.patch Patch3: elfutils-0.154-binutils-pr-ld-13621.patch
%ifarch ppc %{power64} s390 s390x Patch4: elfutils-0.154-xlatetom-835877.patch
Patch4: elfutils-0.154-nounstripcheck-835877.patch
%endif
%if !%{compat} %if !%{compat}
Release: %{baserelease}%{?dist} Release: %{baserelease}%{?dist}
@ -214,7 +212,7 @@ sed -i.scanf-m -e 's/%m/%a/g' src/addr2line.c tests/line2addr.c
%endif %endif
%patch3 -p1 -b .binutils-pr-ld-13621 %patch3 -p1 -b .binutils-pr-ld-13621
%patch4 -p1 -b .nounstripcheck-835877 %patch4 -p1 -b .xlatetom-835877
find . -name \*.sh ! -perm -0100 -print | xargs chmod +x find . -name \*.sh ! -perm -0100 -print | xargs chmod +x
@ -331,6 +329,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.a %{_libdir}/libelf.a
%changelog %changelog
* Mon Jul 18 2012 Mark Wielaard <mjw@redhat.com> 0.154-2
- Add upstream xlatetom fix (#835877)
* Mon Jul 02 2012 Karsten Hopp <karsten@redhat.com> 0.154-1.1 * Mon Jul 02 2012 Karsten Hopp <karsten@redhat.com> 0.154-1.1
- disable unstrip-n check for now (835877) - disable unstrip-n check for now (835877)