From d7048fd73627cc808d8705a7f8031c39000043f2 Mon Sep 17 00:00:00 2001 From: roland Date: Aug 28 2008 07:44:31 +0000 Subject: alignment fixes, segment table botch fix --- diff --git a/Makefile b/Makefile index 239309a..21983d6 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,12 @@ # Makefile for source rpm: elfutils -# $Id: Makefile,v 1.23 2007/05/03 22:49:17 roland Exp $ +# $Id: Makefile,v 1.28 2008/08/27 19:37:47 roland Exp $ NAME := elfutils SPECFILE = elfutils.spec +UPSTREAM_CHECKS := sig +UPSTREAM_FILES = $(NAME)-$(VERSION).tar.gz +upstream:; + define find-makefile-common for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef @@ -20,15 +24,27 @@ endif include $(MAKEFILE_COMMON) +ifneq (,$(CURL)) +CURL += -k +endif + MONOTONE = mtn -elfutils-portability.patch: elfutils-$(VERSION).tar.gz - @rm -rf elfutils-master elfutils-portable - $(MONOTONE) checkout -b com.redhat.elfutils elfutils-master - $(MONOTONE) checkout -b com.redhat.elfutils.portable elfutils-portable +branch-portability = portable + +elfutils-base = t:elfutils-$(VERSION) + +elfutils-%.patch: elfutils-$(VERSION).tar.gz Makefile + @rm -rf elfutils-master elfutils-$* +# $(MONOTONE) checkout -b com.redhat.elfutils elfutils-master + $(MONOTONE) checkout -b com.redhat.elfutils \ + -r $(elfutils-base) elfutils-master + $(MONOTONE) checkout \ + -b com.redhat.elfutils.$(firstword $(branch-$*) $*) \ + elfutils-$* cd elfutils-master; autoreconf -i; rm -rf autom4te.cache _MTN - cd elfutils-portable; autoreconf -i; rm -rf autom4te.cache _MTN - diff -rpu elfutils-master elfutils-portable | \ + cd elfutils-$*; autoreconf -i; rm -rf autom4te.cache _MTN + diff -Nrpu elfutils-master elfutils-$* | \ filterdiff --remove-timestamps --strip=1 --addprefix=elfutils/ > $@.new mv $@.new $@ diff --git a/elfutils-0.137-fixes.patch b/elfutils-0.137-fixes.patch new file mode 100644 index 0000000..49940d7 --- /dev/null +++ b/elfutils-0.137-fixes.patch @@ -0,0 +1,118 @@ +--- elfutils-0.137/libdwfl/ChangeLog ++++ elfutils-0.137/libdwfl/ChangeLog +@@ -1,3 +1,12 @@ ++2008-08-28 Roland McGrath ++ ++ * segment.c (reify_segments): Fix last change. ++ ++2008-08-27 Roland McGrath ++ ++ * linux-proc-maps.c (read_proc_memory): Return 0 for EINVAL or EPERM ++ failure from pread64. ++ + 2008-08-26 Roland McGrath + + * segment.c (reify_segments): Insert a trailing segment for a module +--- elfutils-0.137/libdwfl/linux-proc-maps.c ++++ elfutils-0.137/libdwfl/linux-proc-maps.c +@@ -267,6 +267,9 @@ read_proc_memory (void *arg, void *data, + { + const int fd = *(const int *) arg; + ssize_t nread = pread64 (fd, data, maxread, (off64_t) address); ++ /* Some kernels don't actually let us do this read, ignore those errors. */ ++ if (nread < 0 && (errno == EINVAL || errno == EPERM)) ++ return 0; + if (nread > 0 && (size_t) nread < minread) + nread = 0; + return nread; +--- elfutils-0.137/libdwfl/segment.c ++++ elfutils-0.137/libdwfl/segment.c +@@ -175,9 +175,17 @@ reify_segments (Dwfl *dwfl) + return true; + ++idx; + } ++ else if (dwfl->lookup_addr[idx] < start) ++ { ++ /* The module starts past the end of this segment. ++ Add a new one. */ ++ if (unlikely (insert (dwfl, idx + 1, start, end, -1))) ++ return true; ++ ++idx; ++ } + +- if (((size_t) idx + 1 == dwfl->lookup_elts +- || end < dwfl->lookup_addr[idx + 1]) ++ if ((size_t) idx + 1 < dwfl->lookup_elts ++ && end < dwfl->lookup_addr[idx + 1] + /* The module ends in the middle of this segment. Split it. */ + && unlikely (insert (dwfl, idx + 1, + end, dwfl->lookup_addr[idx + 1], -1))) +--- elfutils-0.137/libelf/ChangeLog ++++ elfutils-0.137/libelf/ChangeLog +@@ -1,3 +1,9 @@ ++2008-08-27 Roland McGrath ++ ++ * elf_begin.c (get_shnum): Avoid misaligned reads for matching endian. ++ ++ * libelfP.h [!ALLOW_UNALIGNED] (__libelf_type_align): Fix CLASS index. ++ + 2008-08-25 Roland McGrath + + * Makefile.am (libelf_so_LDLIBS): New variable. +--- elfutils-0.137/libelf/elf_begin.c ++++ elfutils-0.137/libelf/elf_begin.c +@@ -110,8 +110,14 @@ get_shnum (void *map_address, unsigned c + } ehdr_mem; + bool is32 = e_ident[EI_CLASS] == ELFCLASS32; + ++ // e_shnum shoff ++ + /* Make the ELF header available. */ +- if (e_ident[EI_DATA] == MY_ELFDATA) ++ if (e_ident[EI_DATA] == MY_ELFDATA ++ && (ALLOW_UNALIGNED ++ || (((size_t) e_ident ++ & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr)) ++ - 1)) == 0))) + ehdr.p = e_ident; + else + { +@@ -130,8 +136,11 @@ get_shnum (void *map_address, unsigned c + else + memcpy (&ehdr_mem, e_ident, sizeof (Elf32_Ehdr)); + +- CONVERT (ehdr_mem.e32.e_shnum); +- CONVERT (ehdr_mem.e32.e_shoff); ++ if (e_ident[EI_DATA] != MY_ELFDATA) ++ { ++ CONVERT (ehdr_mem.e32.e_shnum); ++ CONVERT (ehdr_mem.e32.e_shoff); ++ } + } + else + { +@@ -143,8 +152,11 @@ get_shnum (void *map_address, unsigned c + else + memcpy (&ehdr_mem, e_ident, sizeof (Elf64_Ehdr)); + +- CONVERT (ehdr_mem.e64.e_shnum); +- CONVERT (ehdr_mem.e64.e_shoff); ++ if (e_ident[EI_DATA] != MY_ELFDATA) ++ { ++ CONVERT (ehdr_mem.e64.e_shnum); ++ CONVERT (ehdr_mem.e64.e_shoff); ++ } + } + } + +--- elfutils-0.137/libelf/libelfP.h ++++ elfutils-0.137/libelf/libelfP.h +@@ -460,7 +460,7 @@ extern const uint_fast8_t __libelf_type_ + version, binary class, and type. */ + extern const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] attribute_hidden; + # define __libelf_type_align(class, type) \ +- (__libelf_type_aligns[LIBELF_EV_IDX][class][type] ?: 1) ++ (__libelf_type_aligns[LIBELF_EV_IDX][class - 1][type] ?: 1) + #else + # define __libelf_type_align(class, type) 1 + #endif diff --git a/elfutils.spec b/elfutils.spec index bd00cf6..2b515e2 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,5 +1,5 @@ %define eu_version 0.137 -%define eu_release 1 +%define eu_release 2 %if %{?_with_compat:1}%{!?_with_compat:0} %define compat 1 @@ -35,6 +35,7 @@ URL: https://fedorahosted.org/elfutils/ Source: http://fedorahosted.org/releases/e/l/elfutils/%{name}-%{version}.tar.gz Patch1: elfutils-portability.patch Patch2: elfutils-robustify.patch +Patch3: elfutils-0.137-fixes.patch Requires: elfutils-libelf-%{_arch} = %{version}-%{release} Requires: elfutils-libs-%{_arch} = %{version}-%{release} @@ -156,6 +157,8 @@ find . \( -name configure -o -name config.h.in \) -print | xargs touch %patch2 -p1 -b .robustify +%patch3 -p1 -b .fixes + find . -name \*.sh ! -perm -0100 -print | xargs chmod +x %build @@ -262,10 +265,11 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/libelf.a %changelog -* Wed Aug 27 2008 Roland McGrath - 0.137-1 +* Thu Aug 28 2008 Roland McGrath - 0.137-2 - Update to 0.137 - libdwfl: bug fixes; new segment interfaces; all the libdwfl-based tools now support --core=COREFILE option +- Resolves: RHBZ #325021, RHBZ #447416 * Mon Jul 7 2008 Tom "spot" Callaway - 0.135-2 - fix conditional comparison @@ -354,7 +358,6 @@ rm -rf ${RPM_BUILD_ROOT} - New program eu-ar. - libdw: fix missing dwarf_getelf (#227206) - libdwfl: dwfl_module_addrname for st_size=0 symbols (#227167, #227231) -- Resolves: RHBZ #227206, RHBZ #227167, RHBZ #227231 * Wed Jan 10 2007 Roland McGrath - 0.125-3 - Fix overeager warn_unused_result build failures.