From e5d81f757de4bd1bfd37a96300edd50b77b0d21c Mon Sep 17 00:00:00 2001 From: Chong Lu Date: Tue, 10 Dec 2013 16:58:01 +0800 Subject: meta/*: remove unnecessary patches The following patches are found, but not used by any recipe, so we should remove them. meta/recipes-connectivity/avahi/files/fix_for_automake_1.11.2.patch meta/recipes-connectivity/dhcp/dhcp/fix-client-path.patch meta/recipes-connectivity/libnss-mdns/files/alignment-fix.patch meta/recipes-core/dbus/dbus-1.6.10/test-run-path.patch meta/recipes-core/gettext/gettext-0.16.1/fixchicken.patch meta/recipes-core/gettext/gettext-0.16.1/getline.m4.patch meta/recipes-core/systemd/systemd/use-rootlibdir.patch meta/recipes-core/util-linux/util-linux/remove-lscpu.patch meta/recipes-core/util-linux/util-linux/remove_sigsetmark.patch meta/recipes-core/util-linux/util-linux/uclibc-compile.patch meta/recipes-devtools/autoconf/autoconf/autoconf-x.patch meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build.patch meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build2.patch meta/recipes-devtools/cdrtools/cdrtools-native/no_usr_src.patch meta/recipes-devtools/elfutils/elfutils-0.155/elfutils-robustify.patch meta/recipes-devtools/gdb/gdb/libiberty-cross.patch meta/recipes-devtools/perl/perl-5.14.3/asm-pageh-fix.patch meta/recipes-devtools/python/python-native/sys_platform_is_now_always_linux2.patch meta/recipes-devtools/python/python-pygobject/generate-constants.patch meta/recipes-devtools/qemu/files/3f08ffb4a4741d147634761dc053ed386243a0de.patch meta/recipes-devtools/qemu/files/enable-i386-linux-user.patch meta/recipes-devtools/qemu/files/init-info.patch meta/recipes-devtools/rpm/rpm/rpm_fix_for_automake-1.12.patch meta/recipes-devtools/tcf-agent/tcf-agent/fix_tcf-agent.init.patch meta/recipes-extended/iputils/files/arping-break-libsysfs-dependency.patch meta/recipes-extended/libarchive/libarchive/0003-Patch-from-upstream-rev-2516.patch meta/recipes-extended/procps/procps-3.2.8/pagesz-not-constant.patch meta/recipes-gnome/gtk+/gtk+-2.24.22/no-demos.patch meta/recipes-gnome/libglade/libglade-2.6.4/no-deprecation.patch meta/recipes-graphics/mesa/mesa/0005-llvmpipe-remove-the-power-of-two-sizeof-struct-cmd_b.patch meta/recipes-graphics/xorg-lib/libxxf86dga/libxxf86dga-1.1.3_fix_for_x32.patch meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch meta/recipes-kernel/linux-libc-headers/linux-libc-headers/connector-msg-size-fix.patch meta/recipes-kernel/linux/linux-yocto/tools-perf-no-scripting.patch meta/recipes-support/gnutls/gnutls/gnutls-texinfo-euro.patch meta/recipes-support/nspr/nspr/fix-build-on-aarch64.patch [YOCTO #5180] Signed-off-by: Chong Lu Signed-off-by: Richard Purdie --- .../avahi/files/fix_for_automake_1.11.2.patch | 44 - .../dhcp/dhcp/fix-client-path.patch | 23 - .../libnss-mdns/files/alignment-fix.patch | 13 - .../dbus/dbus-1.6.10/test-run-path.patch | 26 - .../gettext/gettext-0.16.1/fixchicken.patch | 33 - .../gettext/gettext-0.16.1/getline.m4.patch | 39 - .../systemd/systemd/use-rootlibdir.patch | 107 -- .../util-linux/util-linux/remove-lscpu.patch | 37 - .../util-linux/util-linux/remove_sigsetmark.patch | 35 - .../util-linux/util-linux/uclibc-compile.patch | 15 - .../autoconf/autoconf/autoconf-x.patch | 38 - .../btrfs-progs-fix-parallel-build.patch | 30 - .../btrfs-progs-fix-parallel-build2.patch | 27 - .../cdrtools/cdrtools-native/no_usr_src.patch | 33 - .../elfutils-0.155/elfutils-robustify.patch | 1756 -------------------- .../recipes-devtools/gdb/gdb/libiberty-cross.patch | 632 ------- .../perl/perl-5.14.3/asm-pageh-fix.patch | 21 - .../sys_platform_is_now_always_linux2.patch | 28 - .../python-pygobject/generate-constants.patch | 20 - .../3f08ffb4a4741d147634761dc053ed386243a0de.patch | 42 - .../qemu/files/enable-i386-linux-user.patch | 55 - meta/recipes-devtools/qemu/files/init-info.patch | 18 - .../rpm/rpm/rpm_fix_for_automake-1.12.patch | 21 - .../tcf-agent/tcf-agent/fix_tcf-agent.init.patch | 96 -- .../files/arping-break-libsysfs-dependency.patch | 296 ---- .../0003-Patch-from-upstream-rev-2516.patch | 63 - .../procps/procps-3.2.8/pagesz-not-constant.patch | 24 - .../recipes-gnome/gtk+/gtk+-2.24.22/no-demos.patch | 15 - .../libglade/libglade-2.6.4/no-deprecation.patch | 13 - ...move-the-power-of-two-sizeof-struct-cmd_b.patch | 41 - .../libxxf86dga-1.1.3_fix_for_x32.patch | 30 - .../kmod/kmod/fix-undefined-O_CLOEXEC.patch | 17 - .../connector-msg-size-fix.patch | 29 - .../linux-yocto/tools-perf-no-scripting.patch | 52 - .../gnutls/gnutls/gnutls-texinfo-euro.patch | 18 - .../nspr/nspr/fix-build-on-aarch64.patch | 101 -- 36 files changed, 3888 deletions(-) delete mode 100644 meta/recipes-connectivity/avahi/files/fix_for_automake_1.11.2.patch delete mode 100644 meta/recipes-connectivity/dhcp/dhcp/fix-client-path.patch delete mode 100644 meta/recipes-connectivity/libnss-mdns/files/alignment-fix.patch delete mode 100644 meta/recipes-core/dbus/dbus-1.6.10/test-run-path.patch delete mode 100644 meta/recipes-core/gettext/gettext-0.16.1/fixchicken.patch delete mode 100644 meta/recipes-core/gettext/gettext-0.16.1/getline.m4.patch delete mode 100644 meta/recipes-core/systemd/systemd/use-rootlibdir.patch delete mode 100644 meta/recipes-core/util-linux/util-linux/remove-lscpu.patch delete mode 100644 meta/recipes-core/util-linux/util-linux/remove_sigsetmark.patch delete mode 100644 meta/recipes-core/util-linux/util-linux/uclibc-compile.patch delete mode 100644 meta/recipes-devtools/autoconf/autoconf/autoconf-x.patch delete mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build.patch delete mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build2.patch delete mode 100644 meta/recipes-devtools/cdrtools/cdrtools-native/no_usr_src.patch delete mode 100644 meta/recipes-devtools/elfutils/elfutils-0.155/elfutils-robustify.patch delete mode 100644 meta/recipes-devtools/gdb/gdb/libiberty-cross.patch delete mode 100644 meta/recipes-devtools/perl/perl-5.14.3/asm-pageh-fix.patch delete mode 100644 meta/recipes-devtools/python/python-native/sys_platform_is_now_always_linux2.patch delete mode 100644 meta/recipes-devtools/python/python-pygobject/generate-constants.patch delete mode 100644 meta/recipes-devtools/qemu/files/3f08ffb4a4741d147634761dc053ed386243a0de.patch delete mode 100644 meta/recipes-devtools/qemu/files/enable-i386-linux-user.patch delete mode 100644 meta/recipes-devtools/qemu/files/init-info.patch delete mode 100644 meta/recipes-devtools/rpm/rpm/rpm_fix_for_automake-1.12.patch delete mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/fix_tcf-agent.init.patch delete mode 100644 meta/recipes-extended/iputils/files/arping-break-libsysfs-dependency.patch delete mode 100644 meta/recipes-extended/libarchive/libarchive/0003-Patch-from-upstream-rev-2516.patch delete mode 100644 meta/recipes-extended/procps/procps-3.2.8/pagesz-not-constant.patch delete mode 100644 meta/recipes-gnome/gtk+/gtk+-2.24.22/no-demos.patch delete mode 100644 meta/recipes-gnome/libglade/libglade-2.6.4/no-deprecation.patch delete mode 100644 meta/recipes-graphics/mesa/mesa/0005-llvmpipe-remove-the-power-of-two-sizeof-struct-cmd_b.patch delete mode 100644 meta/recipes-graphics/xorg-lib/libxxf86dga/libxxf86dga-1.1.3_fix_for_x32.patch delete mode 100644 meta/recipes-kernel/kmod/kmod/fix-undefined-O_CLOEXEC.patch delete mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/connector-msg-size-fix.patch delete mode 100644 meta/recipes-kernel/linux/linux-yocto/tools-perf-no-scripting.patch delete mode 100644 meta/recipes-support/gnutls/gnutls/gnutls-texinfo-euro.patch delete mode 100644 meta/recipes-support/nspr/nspr/fix-build-on-aarch64.patch diff --git a/meta/recipes-connectivity/avahi/files/fix_for_automake_1.11.2.patch b/meta/recipes-connectivity/avahi/files/fix_for_automake_1.11.2.patch deleted file mode 100644 index e7a1908a63..0000000000 --- a/meta/recipes-connectivity/avahi/files/fix_for_automake_1.11.2.patch +++ /dev/null @@ -1,44 +0,0 @@ -Upstream-Status: Pending - -automake version 1.11.2 has made use of dir variables more strict. -the use of pkglibdir with DATA var results in automake errors. - This commits uses pkgdatadir var instead of pkglibdir to avoid -the strict check errors. - -Fixes this error: -service-type-database/Makefile.am:21: `pkglibdir' is not a legitimate directory for `DATA' -autoreconf: automake failed with exit status: 1 -ERROR: autoreconf execution failed. - -Signed-Off-By: Nitin A Kamble -2011/12/28 - - -Index: avahi-0.6.30/service-type-database/Makefile.am -=================================================================== ---- avahi-0.6.30.orig/service-type-database/Makefile.am -+++ avahi-0.6.30/service-type-database/Makefile.am -@@ -18,13 +18,12 @@ - EXTRA_DIST=build-db.in service-types - - pkgdata_DATA=service-types --pkglib_DATA= - - if HAVE_PYTHON - if HAVE_GDBM - - noinst_SCRIPTS=build-db --pkglib_DATA+=service-types.db -+pkgdata_DATA+=service-types.db - - build-db: build-db.in - $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \ -@@ -41,7 +40,7 @@ endif - if HAVE_DBM - - noinst_SCRIPTS=build-db --pkglib_DATA+=service-types.db.pag service-types.db.dir -+pkgdata_DATA+=service-types.db.pag service-types.db.dir - - build-db: build-db.in - $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \ diff --git a/meta/recipes-connectivity/dhcp/dhcp/fix-client-path.patch b/meta/recipes-connectivity/dhcp/dhcp/fix-client-path.patch deleted file mode 100644 index 97ed0d9322..0000000000 --- a/meta/recipes-connectivity/dhcp/dhcp/fix-client-path.patch +++ /dev/null @@ -1,23 +0,0 @@ -CLIENT_PATH is the only environment when executing dhclient-script, -without this patch, dhclient-script won't run properly because it -invokes ifconfig and route - -Upstream-Status: Inappropriate [configuration] - -7/28/2010 - qhe - -diff -ru dhcp-4.1.1-P1.orig//client/Makefile.am dhcp-4.1.1-P1/client/Makefile.am ---- dhcp-4.1.1-P1.orig//client/Makefile.am 2010-07-29 13:20:05.000000000 +0800 -+++ dhcp-4.1.1-P1/client/Makefile.am 2010-07-29 13:28:14.000000000 +0800 -@@ -10,9 +10,9 @@ - EXTRA_DIST = $(man_MANS) - - dhclient.o: dhclient.c -- $(COMPILE) -DCLIENT_PATH='"$(sbindir)"' \ -+ $(COMPILE) -DCLIENT_PATH='"PATH=$(sbindir):$(base_sbindir):$(bindir):$(base_bindir)"' \ - -DLOCALSTATEDIR='"$(localstatedir)"' -c dhclient.c - - dhc6.o: dhc6.c -- $(COMPILE) -DCLIENT_PATH='"$(sbindir)"' \ -+ $(COMPILE) -DCLIENT_PATH='"PATH=$(sbindir):$(base_sbindir):$(bindir):$(base_bindir)"' \ - -DLOCALSTATEDIR='"$(localstatedir)"' -c dhc6.c diff --git a/meta/recipes-connectivity/libnss-mdns/files/alignment-fix.patch b/meta/recipes-connectivity/libnss-mdns/files/alignment-fix.patch deleted file mode 100644 index 70de305bac..0000000000 --- a/meta/recipes-connectivity/libnss-mdns/files/alignment-fix.patch +++ /dev/null @@ -1,13 +0,0 @@ -Upstream-Status: Pending - ---- nss-mdns-0.6/src/nss.c.orig 2005-09-25 17:27:51 +0200 -+++ nss-mdns-0.6/src/nss.c 2005-09-25 17:28:55 +0200 -@@ -456,6 +456,8 @@ - result->h_addrtype = af; - result->h_length = address_length; - -+ idx+=(sizeof(char*)-idx%sizeof(char*)); /* Align on 32 bit boundary */ -+ - /* Check if there's enough space for the addresses */ - if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) { - *errnop = ERANGE; diff --git a/meta/recipes-core/dbus/dbus-1.6.10/test-run-path.patch b/meta/recipes-core/dbus/dbus-1.6.10/test-run-path.patch deleted file mode 100644 index 5c08c9354a..0000000000 --- a/meta/recipes-core/dbus/dbus-1.6.10/test-run-path.patch +++ /dev/null @@ -1,26 +0,0 @@ - - -Signed-off-by: Björn Stenberg -Upstream-Status: Pending - ---- a/test/Makefile.am 2012-06-15 15:25:43.000000000 +0200 -+++ b/test/Makefile.am 2012-11-16 09:24:44.263140840 +0100 -@@ -119,12 +119,13 @@ - DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \ - DBUS_TEST_SYSCONFDIR=$(DESTDIR)$(sysconfdir) - -+ptest_run_dir = .. -+ - TESTS_ENVIRONMENT = \ -- DBUS_BLOCK_ON_ABORT=1 \ -- DBUS_FATAL_WARNINGS=1 \ -- DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \ -- DBUS_TEST_DATA=@abs_top_builddir@/test/data \ -- DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \ -+ DBUS_FATAL_WARNINGS=0 \ -+ DBUS_TEST_DAEMON=$(ptest_run_dir)/bus/dbus-daemon$(EXEEXT) \ -+ DBUS_TEST_DATA=$(ptest_run_dir)/test/data \ -+ DBUS_TEST_HOMEDIR=$(ptest_run_dir)/dbus \ - $(NULL) - - test_corrupt_SOURCES = corrupt.c diff --git a/meta/recipes-core/gettext/gettext-0.16.1/fixchicken.patch b/meta/recipes-core/gettext/gettext-0.16.1/fixchicken.patch deleted file mode 100644 index 36ce4630a2..0000000000 --- a/meta/recipes-core/gettext/gettext-0.16.1/fixchicken.patch +++ /dev/null @@ -1,33 +0,0 @@ - -# Pulled from OpenEmbedded -# -# Commented by: Saul Wold - -Upstream-Status: Inappropriate [licensing] - -Index: gettext-tools/m4/csharpcomp.m4 -=================================================================== -RCS file: /cvs/gettext/gettext/gettext-tools/m4/csharpcomp.m4,v -retrieving revision 1.4 -retrieving revision 1.6 -diff -u -r1.4 -r1.6 ---- a/gettext-tools/m4/csharpcomp.m4 30 Jan 2004 11:01:18 -0000 1.4 -+++ a/gettext-tools/m4/csharpcomp.m4 26 May 2004 12:15:23 -0000 1.6 -@@ -1,4 +1,4 @@ --# csharpcomp.m4 serial 2 (gettext-0.14.1) -+# csharpcomp.m4 serial 4 (gettext-0.15) - dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. - dnl This file is free software, distributed under the terms of the GNU - dnl General Public License. As a special exception to the GNU General -@@ -43,7 +43,8 @@ - ;; - sscli) - if test -n "$HAVE_CSC_IN_PATH" \ -- && csc -help >/dev/null 2>/dev/null; then -+ && csc -help >/dev/null 2>/dev/null \ -+ && { if csc -help 2>/dev/null | grep -i chicken > /dev/null; then false; else true; fi; }; then - HAVE_CSC=1 - ac_result="csc" - break - - diff --git a/meta/recipes-core/gettext/gettext-0.16.1/getline.m4.patch b/meta/recipes-core/gettext/gettext-0.16.1/getline.m4.patch deleted file mode 100644 index bf995bc622..0000000000 --- a/meta/recipes-core/gettext/gettext-0.16.1/getline.m4.patch +++ /dev/null @@ -1,39 +0,0 @@ - -# Pulled from OpenEmbedded -# -# Commented by: Saul Wold - -Upstream-Status: Inappropriate [licensing] - ---- /gettext-tools/m4/orig-getline.m4 2003-07-18 18:11:37.000000000 +0300 -+++ /gettext-tools/m4/getline.m4 2007-02-03 13:33:41.000000000 +0200 -@@ -42,12 +42,23 @@ - return 1; - len = getline (&line, &siz, in); - exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); -- } -- ], am_cv_func_working_getline=yes dnl The library version works. -- , am_cv_func_working_getline=no dnl The library version does NOT work. -- , am_cv_func_working_getline=no dnl We're cross compiling. -- )]) -- fi -+ } -+ ], am_cv_func_working_getline=yes dnl The library version works. -+ , am_cv_func_working_getline=no dnl The library version does NOT work. -+! , dnl We're cross compiling. Assume ir works on glibc2 systems. -+! [AC_EGREP_CPP([Lucky GNU user], -+! [ -+! #include -+! #ifdef __GNU_LIBRARY__ -+! #if (__GLIBC__ >= 2) -+! Lucky GNU user -+! #endif -+! #endif -+! ], -+! [am_cv_func_working_getline=yes], -+! [am_cv_func_working_getline=no])] -+ )]) -+ fi - - if test $am_cv_func_working_getline = no; then - dnl We must choose a different name for our function, since on ELF systems diff --git a/meta/recipes-core/systemd/systemd/use-rootlibdir.patch b/meta/recipes-core/systemd/systemd/use-rootlibdir.patch deleted file mode 100644 index 4c471b673b..0000000000 --- a/meta/recipes-core/systemd/systemd/use-rootlibdir.patch +++ /dev/null @@ -1,107 +0,0 @@ -Upstream-Status: Undecided - -This patch removes some of hardcoded references to /lib -and /usr/lib since on some architectures it should be -/lib64 and /usr/lib64 atleast in OE - -I am not sure about the intention of hardcoded values -thats why status is undecided - -Signed-off-by: Khem Raj - -Index: git/Makefile.am -=================================================================== ---- git.orig/Makefile.am 2012-09-22 11:07:58.811981199 -0700 -+++ git/Makefile.am 2012-09-22 11:09:11.267983956 -0700 -@@ -64,25 +64,25 @@ - - # Our own, non-special dirs - pkgsysconfdir=$(sysconfdir)/systemd --userunitdir=$(prefix)/lib/systemd/user --userpresetdir=$(prefix)/lib/systemd/user-preset --tmpfilesdir=$(prefix)/lib/tmpfiles.d --sysctldir=$(prefix)/lib/sysctl.d --usergeneratordir=$(prefix)/lib/systemd/user-generators -+userunitdir=$(prefix)/$(rootlibdir)/systemd/user -+userpresetdir=$(prefix)/$(rootlibdir)/systemd/user-preset -+tmpfilesdir=$(prefix)/$(rootlibdir)/tmpfiles.d -+sysctldir=$(prefix)/$(rootlibdir)/sysctl.d -+usergeneratordir=$(prefix)/$(rootlibdir)/systemd/user-generators - pkgincludedir=$(includedir)/systemd - systemgeneratordir=$(rootlibexecdir)/system-generators - systemshutdowndir=$(rootlibexecdir)/system-shutdown - systemsleepdir=$(rootlibexecdir)/system-sleep --systemunitdir=$(rootprefix)/lib/systemd/system --systempresetdir=$(rootprefix)/lib/systemd/system-preset --udevlibexecdir=$(rootprefix)/lib/udev -+systemunitdir=$(rootprefix)/$(rootlibdir)/systemd/system -+systempresetdir=$(rootprefix)/$(rootlibdir)/systemd/system-preset -+udevlibexecdir=$(rootprefix)/$(rootlibdir)/udev - udevhomedir = $(udevlibexecdir) - udevrulesdir = $(udevlibexecdir)/rules.d - - # And these are the special ones for / - rootprefix=@rootprefix@ - rootbindir=$(rootprefix)/bin --rootlibexecdir=$(rootprefix)/lib/systemd -+rootlibexecdir=$(rootprefix)/$(rootlibdir)/systemd - - CLEANFILES = $(BUILT_SOURCES) - EXTRA_DIST = -@@ -132,7 +132,7 @@ - -DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"$(bindir)/systemd-stdio-bridge\" \ - -DROOTPREFIX=\"$(rootprefix)\" \ - -DRUNTIME_DIR=\"/run\" \ -- -DRANDOM_SEED=\"$(localstatedir)/lib/random-seed\" \ -+ -DRANDOM_SEED=\"$(localstatedir)/$(rootlibdir)/random-seed\" \ - -DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\" \ - -DSYSTEM_GENERATOR_PATH=\"$(systemgeneratordir)\" \ - -DUSER_GENERATOR_PATH=\"$(usergeneratordir)\" \ -@@ -2692,7 +2692,7 @@ - - binfmt-install-data-hook: - $(MKDIR_P) -m 0755 \ -- $(DESTDIR)$(prefix)/lib/binfmt.d \ -+ $(DESTDIR)$(prefix)/$(rootlibdir)/binfmt.d \ - $(DESTDIR)$(sysconfdir)/binfmt.d \ - $(DESTDIR)$(systemunitdir)/sysinit.target.wants - ( cd $(DESTDIR)$(systemunitdir)/sysinit.target.wants && \ -@@ -3107,7 +3107,7 @@ - - timedated-install-data-hook: - $(MKDIR_P) -m 0755 \ -- $(DESTDIR)$(prefix)/lib/systemd/ntp-units.d \ -+ $(DESTDIR)$(prefix)/$(rootlibdir)/systemd/ntp-units.d \ - $(DESTDIR)$(sysconfdir)/systemd/ntp-units.d - ( cd $(DESTDIR)$(systemunitdir) && \ - rm -f dbus-org.freedesktop.timedate1.service && \ -@@ -3337,7 +3337,7 @@ - logind-install-data-hook: - $(MKDIR_P) -m 0755 \ - $(DESTDIR)$(systemunitdir)/multi-user.target.wants \ -- $(DESTDIR)$(localstatedir)/lib/systemd -+ $(DESTDIR)$(localstatedir)/$(rootlibdir)/systemd - ( cd $(DESTDIR)$(systemunitdir) && \ - rm -f dbus-org.freedesktop.login1.service && \ - $(LN_S) systemd-logind.service dbus-org.freedesktop.login1.service) -@@ -3494,7 +3494,7 @@ - -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \ - -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \ - -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' \ -- -e 's,@RANDOM_SEED\@,$(localstatedir)/lib/random-seed,g' \ -+ -e 's,@RANDOM_SEED\@,$(localstatedir)/$(rootlibdir)/random-seed,g' \ - -e 's,@prefix\@,$(prefix),g' \ - -e 's,@exec_prefix\@,$(exec_prefix),g' \ - -e 's,@libdir\@,$(libdir),g' \ -@@ -3619,9 +3619,9 @@ - $(MKDIR_P) -m 0755 \ - $(DESTDIR)$(tmpfilesdir) \ - $(DESTDIR)$(sysconfdir)/tmpfiles.d \ -- $(DESTDIR)$(prefix)/lib/modules-load.d \ -+ $(DESTDIR)$(prefix)/$(rootlibdir)/modules-load.d \ - $(DESTDIR)$(sysconfdir)/modules-load.d \ -- $(DESTDIR)$(prefix)/lib/sysctl.d \ -+ $(DESTDIR)$(prefix)/$(rootlibdir)/sysctl.d \ - $(DESTDIR)$(sysconfdir)/sysctl.d \ - $(DESTDIR)$(systemshutdowndir) \ - $(DESTDIR)$(systemsleepdir) \ diff --git a/meta/recipes-core/util-linux/util-linux/remove-lscpu.patch b/meta/recipes-core/util-linux/util-linux/remove-lscpu.patch deleted file mode 100644 index ddf14a50d1..0000000000 --- a/meta/recipes-core/util-linux/util-linux/remove-lscpu.patch +++ /dev/null @@ -1,37 +0,0 @@ -Upstream-Status: Inappropriate [distribution] - -Take out lscpu stuff from the code - -Signed-off-by: Saul Wold - -Index: util-linux-2.22.1/configure.ac -=================================================================== ---- util-linux-2.22.1.orig/configure.ac -+++ util-linux-2.22.1/configure.ac -@@ -937,7 +937,7 @@ UL_REQUIRES_BUILD([lsblk], [libmount]) - AM_CONDITIONAL(BUILD_LSBLK, test "x$build_lsblk" = xyes) - - --UL_BUILD_INIT([lscpu], [check]) -+UL_BUILD_INIT([lscpu], [no]) - UL_REQUIRES_LINUX([lscpu]) - UL_REQUIRES_HAVE([lscpu], [cpu_set_t], [cpu_set_t type]) - AM_CONDITIONAL(BUILD_LSCPU, test "x$build_lscpu" = xyes) -Index: util-linux-2.22.1/sys-utils/Makemodule.am -=================================================================== ---- util-linux-2.22.1.orig/sys-utils/Makemodule.am -+++ util-linux-2.22.1/sys-utils/Makemodule.am -@@ -224,13 +224,6 @@ swapoff_CFLAGS = $(AM_CFLAGS) -I$(ul_lib - swapoff_LDADD = $(LDADD) libmount.la - endif - --if BUILD_LSCPU --usrbin_exec_PROGRAMS += lscpu --lscpu_SOURCES = sys-utils/lscpu.c --lscpu_LDADD = $(LDADD) libcommon.la --dist_man_MANS += sys-utils/lscpu.1 --endif -- - if BUILD_CHCPU - sbin_PROGRAMS += chcpu - chcpu_SOURCES = sys-utils/chcpu.c diff --git a/meta/recipes-core/util-linux/util-linux/remove_sigsetmark.patch b/meta/recipes-core/util-linux/util-linux/remove_sigsetmark.patch deleted file mode 100644 index 02e4d16ff7..0000000000 --- a/meta/recipes-core/util-linux/util-linux/remove_sigsetmark.patch +++ /dev/null @@ -1,35 +0,0 @@ -simpleinit: remove deprecated sigsetmask() - -The sigsetmask() is deprecated in favor of sigprocmask(). - -This is not needed upstream since simpleinit is removed from -util-linux-ng master - -Signed-off-by: Khem Raj - -Upstream-Status: Inappropriate - -Index: util-linux-2.19.1/simpleinit/shutdown.c -=================================================================== ---- util-linux-2.19.1.orig/simpleinit/shutdown.c 2011-03-04 03:47:47.000000000 -0800 -+++ util-linux-2.19.1/simpleinit/shutdown.c 2011-07-06 08:43:39.183849752 -0700 -@@ -145,7 +145,7 @@ - { - int c, i, fd; - char *ptr; -- -+ sigset_t sigmask; - i = getdtablesize (); - for (fd = 3; fd < i; fd++) close (fd); - if (getpid () == 1) -@@ -153,7 +153,9 @@ - for (fd = 0; fd < 3; fd++) close (fd); - while (1) wait (NULL); /* Grim reaper never stops */ - } -- sigsetmask (0); /* simpleinit(8) blocks all signals: undo for ALRM */ -+ /* simpleinit(8) blocks all signals: undo for ALRM */ -+ sigemptyset(&sigmask); -+ sigprocmask (SIG_SETMASK, &sigmask, NULL); - for (i = 1; i < NSIG; i++) signal (i, SIG_DFL); - - setlocale(LC_ALL, ""); diff --git a/meta/recipes-core/util-linux/util-linux/uclibc-compile.patch b/meta/recipes-core/util-linux/util-linux/uclibc-compile.patch deleted file mode 100644 index 75774d8200..0000000000 --- a/meta/recipes-core/util-linux/util-linux/uclibc-compile.patch +++ /dev/null @@ -1,15 +0,0 @@ -Upstream-Status: Inappropriate [embedded specific] - -Index: util-linux-ng-2.16/misc-utils/cal.c -=================================================================== ---- util-linux-ng-2.16.orig/misc-utils/cal.c 2009-07-03 16:20:01.000000000 -0700 -+++ util-linux-ng-2.16/misc-utils/cal.c 2009-07-18 23:21:37.000000000 -0700 -@@ -407,7 +407,7 @@ - strcpy(day_headings,""); - strcpy(j_day_headings,""); - --#ifdef HAVE_LANGINFO_H -+#ifdef HAVE_LANGINFO_H && !defined(__UCLIBC__) - # define weekday(wd) nl_langinfo(ABDAY_1+wd) - #else - # define weekday(wd) _time_info->abbrev_wkday[wd] diff --git a/meta/recipes-devtools/autoconf/autoconf/autoconf-x.patch b/meta/recipes-devtools/autoconf/autoconf/autoconf-x.patch deleted file mode 100644 index 6ebef0a540..0000000000 --- a/meta/recipes-devtools/autoconf/autoconf/autoconf-x.patch +++ /dev/null @@ -1,38 +0,0 @@ -Upstream-Status: Pending - -Index: lib/autoconf/libs.m4 -=================================================================== -RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/libs.m4,v -retrieving revision 1.13 -diff -p -u -r1.13 libs.m4 ---- autoconf-2.59/lib/autoconf/libs.m4 6 Sep 2005 15:34:06 -0000 1.13 -+++ autoconf-2.59/lib/autoconf/libs.m4 18 Sep 2005 17:09:58 -0000 -@@ -265,13 +265,13 @@ ac_x_header_dirs=' - /usr/openwin/share/include' - - if test "$ac_x_includes" = no; then -- # Guess where to find include files, by looking for Intrinsic.h. -+ # Guess where to find include files, by looking for Xlib.h. - # First, try using that file with no special directory specified. -- AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include ])], -+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include ])], - [# We can compile using X headers with no special include directory. - ac_x_includes=], - [for ac_dir in $ac_x_header_dirs; do -- if test -r "$ac_dir/X11/Intrinsic.h"; then -+ if test -r "$ac_dir/X11/Xlib.h"; then - ac_x_includes=$ac_dir - break - fi -@@ -284,9 +284,9 @@ if test "$ac_x_libraries" = no; then - # Don't add to $LIBS permanently. - ac_save_LIBS=$LIBS -- LIBS="-lXt $LIBS" -- AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include ], -- [XtMalloc (0)])], -+ LIBS="-lX11 $LIBS" -+ AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include ], -+ [XrmInitialize ()])], - [LIBS=$ac_save_LIBS - # We can link X programs with no special library path. - ac_x_libraries=], diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build.patch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build.patch deleted file mode 100644 index e461cdf447..0000000000 --- a/meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build.patch +++ /dev/null @@ -1,30 +0,0 @@ -btrfs-progs: fix parallel build - -Upstream-Status: Submitted [http://permalink.gmane.org/gmane.comp.file-systems.btrfs/28197] - -Parallel execution of "make install" may fail due to late creation of -version.h, fix it by adding the dependence on version.h. - -The fix is similare to 7aaf00fc[btrfs-progs: fix parallel build] - -Signed-off-by: Roy.Li ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index c43cb68..40ef205 100644 ---- a/Makefile -+++ b/Makefile -@@ -190,7 +190,7 @@ clean : - $(libs) $(lib_links) - $(Q)$(MAKE) $(MAKEOPTS) -C man $@ - --install: $(libs) $(progs) install-man -+install: version.h $(libs) $(progs) install-man - $(INSTALL) -m755 -d $(DESTDIR)$(bindir) - $(INSTALL) $(progs) $(DESTDIR)$(bindir) - $(INSTALL) -m755 -d $(DESTDIR)$(libdir) --- -1.7.10.4 - diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build2.patch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build2.patch deleted file mode 100644 index af1a7606c4..0000000000 --- a/meta/recipes-devtools/btrfs-tools/btrfs-tools/btrfs-progs-fix-parallel-build2.patch +++ /dev/null @@ -1,27 +0,0 @@ -btrfs-progs: Fix parallel build - -Upstream-Status: Pending - -"make btrfs.o" fails unable to find version.h. - -This adds version.h as a dependency for all .o files and fixes various parallel -build failures. - -RP 20/9/2013 ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: git/Makefile -=================================================================== ---- git.orig/Makefile 2013-09-20 14:45:34.307723221 +0000 -+++ git/Makefile 2013-09-20 16:06:45.503611030 +0000 -@@ -76,7 +76,7 @@ - check = true - endif - --.c.o: -+%.o: %.c version.h - $(Q)$(check) $< - @echo " [CC] $@" - $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $< diff --git a/meta/recipes-devtools/cdrtools/cdrtools-native/no_usr_src.patch b/meta/recipes-devtools/cdrtools/cdrtools-native/no_usr_src.patch deleted file mode 100644 index 7341aecd6c..0000000000 --- a/meta/recipes-devtools/cdrtools/cdrtools-native/no_usr_src.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 8d835cc7185e7cd878712d8208e6aa29b227ceff Mon Sep 17 00:00:00 2001 -From: Andrei Dinu -Date: Thu, 9 May 2013 16:03:59 +0300 -Subject: [PATCH] Remove hard-coded references to /usr/src/linux/include to - avoid host contamination. - -Upstream-Status: Innappropriate [configuration] - -Signed-off-by: Andrei Dinu -Signed-off-by: Scott Garman ---- - cdrtools-3.00/DEFAULTS/Defaults.gnu | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - mode change 100644 => 100755 cdrtools-3.00/DEFAULTS/Defaults.gnu - -diff --git a/DEFAULTS/Defaults.gnu b/cdrtools-3.00/DEFAULTS/Defaults.gnu -old mode 100644 -new mode 100755 -index e3e102b..8a18209 ---- a/DEFAULTS/Defaults.gnu -+++ b/DEFAULTS/Defaults.gnu -@@ -28,7 +28,7 @@ DEFLINKMODE= static - ########################################################################### - CWARNOPTS= - --DEFINCDIRS= $(SRCROOT)/include /usr/src/linux/include -+DEFINCDIRS= $(SRCROOT)/include - LDPATH= -L/opt/schily/lib - #RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) - RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib --- -1.7.9.5 - diff --git a/meta/recipes-devtools/elfutils/elfutils-0.155/elfutils-robustify.patch b/meta/recipes-devtools/elfutils/elfutils-0.155/elfutils-robustify.patch deleted file mode 100644 index 9eee98412d..0000000000 --- a/meta/recipes-devtools/elfutils/elfutils-0.155/elfutils-robustify.patch +++ /dev/null @@ -1,1756 +0,0 @@ ---- elfutils/libdwfl/ChangeLog -+++ elfutils/libdwfl/ChangeLog -@@ -52,6 +52,11 @@ - * dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL. - Reported by Kurt Roeckx . - -+2011-03-23 Petr Machata -+ -+ * relocate.c (relocate_section): Use gelf_fsize instead of relying -+ on shdr->sh_entsize. -+ - 2011-02-11 Roland McGrath - - * linux-kernel-modules.c (try_kernel_name): Try .gz, .bz2, .xz ---- elfutils/libdwfl/relocate.c -+++ elfutils/libdwfl/relocate.c -@@ -1,5 +1,5 @@ - /* Relocate debug information. -- Copyright (C) 2005-2010 Red Hat, Inc. -+ Copyright (C) 2005-2011 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -457,7 +457,10 @@ relocate_section (Dwfl_Module *mod, Elf - } - } - -- size_t nrels = shdr->sh_size / shdr->sh_entsize; -+ size_t sh_entsize -+ = gelf_fsize (relocated, shdr->sh_type == SHT_REL ? ELF_T_REL : ELF_T_RELA, -+ 1, EV_CURRENT); -+ size_t nrels = shdr->sh_size / sh_entsize; - size_t complete = 0; - if (shdr->sh_type == SHT_REL) - for (size_t relidx = 0; !result && relidx < nrels; ++relidx) -@@ -559,7 +562,7 @@ relocate_section (Dwfl_Module *mod, Elf - nrels = next; - } - -- shdr->sh_size = reldata->d_size = nrels * shdr->sh_entsize; -+ shdr->sh_size = reldata->d_size = nrels * sh_entsize; - gelf_update_shdr (scn, shdr); - } - ---- elfutils/libelf/ChangeLog -+++ elfutils/libelf/ChangeLog -@@ -703,10 +703,53 @@ - If section content hasn't been read yet, do it before looking for the - block size. If no section data present, infer size of section header. - -+2005-05-14 Jakub Jelinek -+ -+ * libelfP.h (INVALID_NDX): Define. -+ * gelf_getdyn.c (gelf_getdyn): Use it. Remove ndx < 0 test if any. -+ * gelf_getlib.c (gelf_getlib): Likewise. -+ * gelf_getmove.c (gelf_getmove): Likewise. -+ * gelf_getrel.c (gelf_getrel): Likewise. -+ * gelf_getrela.c (gelf_getrela): Likewise. -+ * gelf_getsym.c (gelf_getsym): Likewise. -+ * gelf_getsyminfo.c (gelf_getsyminfo): Likewise. -+ * gelf_getsymshndx.c (gelf_getsymshndx): Likewise. -+ * gelf_getversym.c (gelf_getversym): Likewise. -+ * gelf_update_dyn.c (gelf_update_dyn): Likewise. -+ * gelf_update_lib.c (gelf_update_lib): Likewise. -+ * gelf_update_move.c (gelf_update_move): Likewise. -+ * gelf_update_rel.c (gelf_update_rel): Likewise. -+ * gelf_update_rela.c (gelf_update_rela): Likewise. -+ * gelf_update_sym.c (gelf_update_sym): Likewise. -+ * gelf_update_syminfo.c (gelf_update_syminfo): Likewise. -+ * gelf_update_symshndx.c (gelf_update_symshndx): Likewise. -+ * gelf_update_versym.c (gelf_update_versym): Likewise. -+ * elf_newscn.c (elf_newscn): Check for overflow. -+ * elf32_updatefile.c (__elfw2(LIBELFBITS,updatemmap)): Likewise. -+ (__elfw2(LIBELFBITS,updatefile)): Likewise. -+ * elf_begin.c (file_read_elf): Likewise. -+ * elf32_newphdr.c (elfw2(LIBELFBITS,newphdr)): Likewise. -+ * elf_getarsym.c (elf_getarsym): Likewise. -+ * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): Likewise. - 2005-05-11 Ulrich Drepper - - * elf.h: Update again. - -+2005-05-17 Jakub Jelinek -+ -+ * elf32_getphdr.c (elfw2(LIBELFBITS,getphdr)): Check if program header -+ table fits into object's bounds. -+ * elf_getshstrndx.c (elf_getshstrndx): Add elf->start_offset to -+ elf->map_address. Check if first section header fits into object's -+ bounds. -+ * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): -+ Check if section header table fits into object's bounds. -+ * elf_begin.c (get_shnum): Ensure section headers fits into -+ object's bounds. -+ (file_read_elf): Make sure scncnt is small enough to allocate both -+ ElfXX_Shdr and Elf_Scn array. Make sure section and program header -+ tables fit into object's bounds. Avoid memory leak on failure. -+ - 2005-05-09 Ulrich Drepper - - * elf.h: Update from glibc. ---- elfutils/libelf/elf32_getphdr.c -+++ elfutils/libelf/elf32_getphdr.c -@@ -93,6 +93,16 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) - - if (elf->map_address != NULL) - { -+ /* First see whether the information in the ELF header is -+ valid and it does not ask for too much. */ -+ if (unlikely (ehdr->e_phoff >= elf->maximum_size) -+ || unlikely (elf->maximum_size - ehdr->e_phoff < size)) -+ { -+ /* Something is wrong. */ -+ __libelf_seterrno (ELF_E_INVALID_PHDR); -+ goto out; -+ } -+ - /* All the data is already mapped. Use it. */ - void *file_phdr = ((char *) elf->map_address - + elf->start_offset + ehdr->e_phoff); ---- elfutils/libelf/elf32_getshdr.c -+++ elfutils/libelf/elf32_getshdr.c -@@ -60,7 +60,8 @@ load_shdr_wrlock (Elf_Scn *scn) - goto out; - - size_t shnum; -- if (__elf_getshdrnum_rdlock (elf, &shnum) != 0) -+ if (__elf_getshdrnum_rdlock (elf, &shnum) != 0 -+ || shnum > SIZE_MAX / sizeof (ElfW2(LIBELFBITS,Shdr))) - goto out; - size_t size = shnum * sizeof (ElfW2(LIBELFBITS,Shdr)); - -@@ -77,6 +78,16 @@ load_shdr_wrlock (Elf_Scn *scn) - - if (elf->map_address != NULL) - { -+ /* First see whether the information in the ELF header is -+ valid and it does not ask for too much. */ -+ if (unlikely (ehdr->e_shoff >= elf->maximum_size) -+ || unlikely (elf->maximum_size - ehdr->e_shoff < size)) -+ { -+ /* Something is wrong. */ -+ __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); -+ goto free_and_out; -+ } -+ - ElfW2(LIBELFBITS,Shdr) *notcvt; - - /* All the data is already mapped. If we could use it ---- elfutils/libelf/elf32_newphdr.c -+++ elfutils/libelf/elf32_newphdr.c -@@ -114,6 +114,12 @@ elfw2(LIBELFBITS,newphdr) (elf, count) - || count == PN_XNUM - || elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) - { -+ if (unlikely (count > SIZE_MAX / sizeof (ElfW2(LIBELFBITS,Phdr)))) -+ { -+ result = NULL; -+ goto out; -+ } -+ - /* Allocate a new program header with the appropriate number of - elements. */ - result = (ElfW2(LIBELFBITS,Phdr) *) ---- elfutils/libelf/elf32_updatefile.c -+++ elfutils/libelf/elf32_updatefile.c -@@ -202,6 +202,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf - /* Write all the sections. Well, only those which are modified. */ - if (shnum > 0) - { -+ if (unlikely (shnum > SIZE_MAX / sizeof (Elf_Scn *))) -+ return 1; -+ - Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; - Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *)); - char *const shdr_start = ((char *) elf->map_address + elf->start_offset -@@ -624,6 +627,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf - /* Write all the sections. Well, only those which are modified. */ - if (shnum > 0) - { -+ if (unlikely (shnum > SIZE_MAX / (sizeof (Elf_Scn *) -+ + sizeof (ElfW2(LIBELFBITS,Shdr))))) -+ return 1; -+ - off_t shdr_offset = elf->start_offset + ehdr->e_shoff; - #if EV_NUM != 2 - xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR]; ---- elfutils/libelf/elf_begin.c -+++ elfutils/libelf/elf_begin.c -@@ -144,7 +144,8 @@ get_shnum (void *map_address, unsigned c - - if (unlikely (result == 0) && ehdr.e32->e_shoff != 0) - { -- if (ehdr.e32->e_shoff + sizeof (Elf32_Shdr) > maxsize) -+ if (unlikely (ehdr.e32->e_shoff >= maxsize) -+ || unlikely (maxsize - ehdr.e32->e_shoff < sizeof (Elf32_Shdr))) - /* Cannot read the first section header. */ - return 0; - -@@ -192,7 +193,8 @@ get_shnum (void *map_address, unsigned c - - if (unlikely (result == 0) && ehdr.e64->e_shoff != 0) - { -- if (ehdr.e64->e_shoff + sizeof (Elf64_Shdr) > maxsize) -+ if (unlikely (ehdr.e64->e_shoff >= maxsize) -+ || unlikely (ehdr.e64->e_shoff + sizeof (Elf64_Shdr) > maxsize)) - /* Cannot read the first section header. */ - return 0; - -@@ -264,6 +266,15 @@ file_read_elf (int fildes, void *map_add - /* Could not determine the number of sections. */ - return NULL; - -+ /* Check for too many sections. */ -+ if (e_ident[EI_CLASS] == ELFCLASS32) -+ { -+ if (scncnt > SIZE_MAX / (sizeof (Elf_Scn) + sizeof (Elf32_Shdr))) -+ return NULL; -+ } -+ else if (scncnt > SIZE_MAX / (sizeof (Elf_Scn) + sizeof (Elf64_Shdr))) -+ return NULL; -+ - /* We can now allocate the memory. Even if there are no section headers, - we allocate space for a zeroth section in case we need it later. */ - const size_t scnmax = (scncnt ?: (cmd == ELF_C_RDWR || cmd == ELF_C_RDWR_MMAP) -@@ -303,6 +314,16 @@ file_read_elf (int fildes, void *map_add - { - /* We can use the mmapped memory. */ - elf->state.elf32.ehdr = ehdr; -+ -+ if (unlikely (ehdr->e_shoff >= maxsize) -+ || unlikely (maxsize - ehdr->e_shoff -+ < scncnt * sizeof (Elf32_Shdr))) -+ { -+ free_and_out: -+ free (elf); -+ __libelf_seterrno (ELF_E_INVALID_FILE); -+ return NULL; -+ } - elf->state.elf32.shdr - = (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff); - -@@ -389,6 +410,11 @@ file_read_elf (int fildes, void *map_add - { - /* We can use the mmapped memory. */ - elf->state.elf64.ehdr = ehdr; -+ -+ if (unlikely (ehdr->e_shoff >= maxsize) -+ || unlikely (ehdr->e_shoff -+ + scncnt * sizeof (Elf32_Shdr) > maxsize)) -+ goto free_and_out; - elf->state.elf64.shdr - = (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff); - ---- elfutils/libelf/elf_getarsym.c -+++ elfutils/libelf/elf_getarsym.c -@@ -181,6 +181,9 @@ elf_getarsym (elf, ptr) - size_t index_size = atol (tmpbuf); - - if (SARMAG + sizeof (struct ar_hdr) + index_size > elf->maximum_size -+#if SIZE_MAX <= 4294967295U -+ || n >= SIZE_MAX / sizeof (Elf_Arsym) -+#endif - || n * w > index_size) - { - /* This index table cannot be right since it does not fit into ---- elfutils/libelf/elf_getshdrstrndx.c -+++ elfutils/libelf/elf_getshdrstrndx.c -@@ -104,10 +104,25 @@ elf_getshdrstrndx (elf, dst) - if (elf->map_address != NULL - && elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA - && (ALLOW_UNALIGNED -- || (((size_t) ((char *) elf->map_address + offset)) -+ || (((size_t) ((char *) elf->map_address -+ + elf->start_offset + offset)) - & (__alignof__ (Elf32_Shdr) - 1)) == 0)) -- /* We can directly access the memory. */ -- num = ((Elf32_Shdr *) (elf->map_address + offset))->sh_link; -+ { -+ /* First see whether the information in the ELF header is -+ valid and it does not ask for too much. */ -+ if (unlikely (elf->maximum_size - offset -+ < sizeof (Elf32_Shdr))) -+ { -+ /* Something is wrong. */ -+ __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); -+ result = -1; -+ goto out; -+ } -+ -+ /* We can directly access the memory. */ -+ num = ((Elf32_Shdr *) (elf->map_address + elf->start_offset -+ + offset))->sh_link; -+ } - else - { - /* We avoid reading in all the section headers. Just read -@@ -142,10 +157,25 @@ elf_getshdrstrndx (elf, dst) - if (elf->map_address != NULL - && elf->state.elf64.ehdr->e_ident[EI_DATA] == MY_ELFDATA - && (ALLOW_UNALIGNED -- || (((size_t) ((char *) elf->map_address + offset)) -+ || (((size_t) ((char *) elf->map_address -+ + elf->start_offset + offset)) - & (__alignof__ (Elf64_Shdr) - 1)) == 0)) -- /* We can directly access the memory. */ -- num = ((Elf64_Shdr *) (elf->map_address + offset))->sh_link; -+ { -+ /* First see whether the information in the ELF header is -+ valid and it does not ask for too much. */ -+ if (unlikely (elf->maximum_size - offset -+ < sizeof (Elf64_Shdr))) -+ { -+ /* Something is wrong. */ -+ __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); -+ result = -1; -+ goto out; -+ } -+ -+ /* We can directly access the memory. */ -+ num = ((Elf64_Shdr *) (elf->map_address + elf->start_offset -+ + offset))->sh_link; -+ } - else - { - /* We avoid reading in all the section headers. Just read ---- elfutils/libelf/elf_newscn.c -+++ elfutils/libelf/elf_newscn.c -@@ -83,10 +83,18 @@ elf_newscn (elf) - else - { - /* We must allocate a new element. */ -- Elf_ScnList *newp; -+ Elf_ScnList *newp = NULL; - - assert (elf->state.elf.scnincr > 0); - -+ if ( -+#if SIZE_MAX <= 4294967295U -+ likely (elf->state.elf.scnincr -+ < SIZE_MAX / 2 / sizeof (Elf_Scn) - sizeof (Elf_ScnList)) -+#else -+ 1 -+#endif -+ ) - newp = (Elf_ScnList *) calloc (sizeof (Elf_ScnList) - + ((elf->state.elf.scnincr *= 2) - * sizeof (Elf_Scn)), 1); ---- elfutils/libelf/gelf_getdyn.c -+++ elfutils/libelf/gelf_getdyn.c -@@ -1,5 +1,5 @@ - /* Get information from dynamic table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -72,7 +72,7 @@ gelf_getdyn (data, ndx, dst) - table entries has to be adopted. The user better has provided - a buffer where we can store the information. While copying the - data we are converting the format. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Dyn, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -93,7 +93,7 @@ gelf_getdyn (data, ndx, dst) - - /* The data is already in the correct form. Just make sure the - index is OK. */ -- if (unlikely ((ndx + 1) * sizeof (GElf_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Dyn, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_getlib.c -+++ elfutils/libelf/gelf_getlib.c -@@ -1,5 +1,5 @@ - /* Get library from table at the given index. -- Copyright (C) 2004 Red Hat, Inc. -+ Copyright (C) 2004-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2004. - -@@ -65,7 +65,7 @@ gelf_getlib (data, ndx, dst) - /* The data is already in the correct form. Just make sure the - index is OK. */ - GElf_Lib *result = NULL; -- if (unlikely ((ndx + 1) * sizeof (GElf_Lib) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Lib, data)) - __libelf_seterrno (ELF_E_INVALID_INDEX); - else - { ---- elfutils/libelf/gelf_getmove.c -+++ elfutils/libelf/gelf_getmove.c -@@ -1,5 +1,5 @@ - /* Get move structure at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -62,7 +62,7 @@ gelf_getmove (data, ndx, dst) - - /* The data is already in the correct form. Just make sure the - index is OK. */ -- if (unlikely ((ndx + 1) * sizeof (GElf_Move) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Move, data)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_getrela.c -+++ elfutils/libelf/gelf_getrela.c -@@ -1,5 +1,5 @@ - /* Get RELA relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -50,12 +50,6 @@ gelf_getrela (data, ndx, dst) - if (data_scn == NULL) - return NULL; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return NULL; -- } -- - if (unlikely (data_scn->d.d_type != ELF_T_RELA)) - { - __libelf_seterrno (ELF_E_INVALID_HANDLE); -@@ -72,7 +66,7 @@ gelf_getrela (data, ndx, dst) - if (scn->elf->class == ELFCLASS32) - { - /* We have to convert the data. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rela, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - result = NULL; -@@ -93,7 +87,7 @@ gelf_getrela (data, ndx, dst) - { - /* Simply copy the data after we made sure we are actually getting - correct data. */ -- if (unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rela, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - result = NULL; ---- elfutils/libelf/gelf_getrel.c -+++ elfutils/libelf/gelf_getrel.c -@@ -1,5 +1,5 @@ - /* Get REL relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -50,12 +50,6 @@ gelf_getrel (data, ndx, dst) - if (data_scn == NULL) - return NULL; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return NULL; -- } -- - if (unlikely (data_scn->d.d_type != ELF_T_REL)) - { - __libelf_seterrno (ELF_E_INVALID_HANDLE); -@@ -72,7 +66,7 @@ gelf_getrel (data, ndx, dst) - if (scn->elf->class == ELFCLASS32) - { - /* We have to convert the data. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rel, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - result = NULL; -@@ -92,7 +86,7 @@ gelf_getrel (data, ndx, dst) - { - /* Simply copy the data after we made sure we are actually getting - correct data. */ -- if (unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rel, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - result = NULL; ---- elfutils/libelf/gelf_getsym.c -+++ elfutils/libelf/gelf_getsym.c -@@ -1,5 +1,5 @@ - /* Get symbol information from symbol table at the given index. -- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 1999-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 1999. - -@@ -69,7 +69,7 @@ gelf_getsym (data, ndx, dst) - table entries has to be adopted. The user better has provided - a buffer where we can store the information. While copying the - data we are converting the format. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data->d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, data)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -98,7 +98,7 @@ gelf_getsym (data, ndx, dst) - - /* The data is already in the correct form. Just make sure the - index is OK. */ -- if (unlikely ((ndx + 1) * sizeof (GElf_Sym) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Sym, data)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_getsyminfo.c -+++ elfutils/libelf/gelf_getsyminfo.c -@@ -1,5 +1,5 @@ - /* Get additional symbol information from symbol table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -63,7 +63,7 @@ gelf_getsyminfo (data, ndx, dst) - - /* The data is already in the correct form. Just make sure the - index is OK. */ -- if (unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Syminfo, data)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_getsymshndx.c -+++ elfutils/libelf/gelf_getsymshndx.c -@@ -1,6 +1,6 @@ - /* Get symbol information and separate section index from symbol table - at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -69,7 +69,7 @@ gelf_getsymshndx (symdata, shndxdata, nd - section index table. */ - if (likely (shndxdata_scn != NULL)) - { -- if (unlikely ((ndx + 1) * sizeof (Elf32_Word) > shndxdata_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Word, &shndxdata_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -89,7 +89,7 @@ gelf_getsymshndx (symdata, shndxdata, nd - table entries has to be adopted. The user better has provided - a buffer where we can store the information. While copying the - data we are converting the format. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata->d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, symdata)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -118,7 +118,7 @@ gelf_getsymshndx (symdata, shndxdata, nd - - /* The data is already in the correct form. Just make sure the - index is OK. */ -- if (unlikely ((ndx + 1) * sizeof (GElf_Sym) > symdata->d_size)) -+ if (INVALID_NDX (ndx, GElf_Sym, symdata)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_getversym.c -+++ elfutils/libelf/gelf_getversym.c -@@ -1,5 +1,5 @@ - /* Get symbol version information at the given index. -- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 1999-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 1999. - -@@ -71,7 +71,7 @@ gelf_getversym (data, ndx, dst) - - /* The data is already in the correct form. Just make sure the - index is OK. */ -- if (unlikely ((ndx + 1) * sizeof (GElf_Versym) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Versym, data)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - result = NULL; ---- elfutils/libelf/gelf_update_dyn.c -+++ elfutils/libelf/gelf_update_dyn.c -@@ -1,5 +1,5 @@ - /* Update information in dynamic table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -50,12 +50,6 @@ gelf_update_dyn (data, ndx, src) - if (data == NULL) - return 0; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return 0; -- } -- - if (unlikely (data_scn->d.d_type != ELF_T_DYN)) - { - /* The type of the data better should match. */ -@@ -81,7 +75,7 @@ gelf_update_dyn (data, ndx, src) - } - - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Dyn, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -95,7 +89,7 @@ gelf_update_dyn (data, ndx, src) - else - { - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf64_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Dyn, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_update_lib.c -+++ elfutils/libelf/gelf_update_lib.c -@@ -1,5 +1,5 @@ - /* Update library in table at the given index. -- Copyright (C) 2004 Red Hat, Inc. -+ Copyright (C) 2004-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2004. - -@@ -47,12 +47,6 @@ gelf_update_lib (data, ndx, src) - if (data == NULL) - return 0; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return 0; -- } -- - Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data; - if (unlikely (data_scn->d.d_type != ELF_T_LIB)) - { -@@ -66,7 +60,7 @@ gelf_update_lib (data, ndx, src) - - /* Check whether we have to resize the data buffer. */ - int result = 0; -- if (unlikely ((ndx + 1) * sizeof (Elf64_Lib) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Lib, &data_scn->d)) - __libelf_seterrno (ELF_E_INVALID_INDEX); - else - { ---- elfutils/libelf/gelf_update_move.c -+++ elfutils/libelf/gelf_update_move.c -@@ -1,5 +1,5 @@ - /* Update move structure at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -54,8 +54,7 @@ gelf_update_move (data, ndx, src) - assert (sizeof (GElf_Move) == sizeof (Elf64_Move)); - - /* Check whether we have to resize the data buffer. */ -- if (unlikely (ndx < 0) -- || unlikely ((ndx + 1) * sizeof (GElf_Move) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Move, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - return 0; ---- elfutils/libelf/gelf_update_rela.c -+++ elfutils/libelf/gelf_update_rela.c -@@ -1,5 +1,5 @@ - /* Update RELA relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -47,12 +47,6 @@ gelf_update_rela (Elf_Data *dst, int ndx - if (dst == NULL) - return 0; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return 0; -- } -- - if (unlikely (data_scn->d.d_type != ELF_T_RELA)) - { - /* The type of the data better should match. */ -@@ -80,7 +74,7 @@ gelf_update_rela (Elf_Data *dst, int ndx - } - - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rela, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -96,7 +90,7 @@ gelf_update_rela (Elf_Data *dst, int ndx - else - { - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rela, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_update_rel.c -+++ elfutils/libelf/gelf_update_rel.c -@@ -1,5 +1,5 @@ - /* Update REL relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -47,12 +47,6 @@ gelf_update_rel (Elf_Data *dst, int ndx, - if (dst == NULL) - return 0; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return 0; -- } -- - if (unlikely (data_scn->d.d_type != ELF_T_REL)) - { - /* The type of the data better should match. */ -@@ -78,7 +72,7 @@ gelf_update_rel (Elf_Data *dst, int ndx, - } - - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rel, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -93,7 +87,7 @@ gelf_update_rel (Elf_Data *dst, int ndx, - else - { - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rel, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_update_sym.c -+++ elfutils/libelf/gelf_update_sym.c -@@ -1,5 +1,5 @@ - /* Update symbol information in symbol table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -51,12 +51,6 @@ gelf_update_sym (data, ndx, src) - if (data == NULL) - return 0; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return 0; -- } -- - if (unlikely (data_scn->d.d_type != ELF_T_SYM)) - { - /* The type of the data better should match. */ -@@ -81,7 +75,7 @@ gelf_update_sym (data, ndx, src) - } - - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -104,7 +98,7 @@ gelf_update_sym (data, ndx, src) - else - { - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf64_Sym) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Sym, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_update_syminfo.c -+++ elfutils/libelf/gelf_update_syminfo.c -@@ -1,5 +1,5 @@ - /* Update additional symbol information in symbol table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -51,12 +51,6 @@ gelf_update_syminfo (data, ndx, src) - if (data == NULL) - return 0; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return 0; -- } -- - if (unlikely (data_scn->d.d_type != ELF_T_SYMINFO)) - { - /* The type of the data better should match. */ -@@ -72,7 +66,7 @@ gelf_update_syminfo (data, ndx, src) - rwlock_wrlock (scn->elf->lock); - - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Syminfo, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_update_symshndx.c -+++ elfutils/libelf/gelf_update_symshndx.c -@@ -1,6 +1,6 @@ - /* Update symbol information and section index in symbol table at the - given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -56,12 +56,6 @@ gelf_update_symshndx (symdata, shndxdata - if (symdata == NULL) - return 0; - -- if (unlikely (ndx < 0)) -- { -- __libelf_seterrno (ELF_E_INVALID_INDEX); -- return 0; -- } -- - if (unlikely (symdata_scn->d.d_type != ELF_T_SYM)) - { - /* The type of the data better should match. */ -@@ -107,7 +101,7 @@ gelf_update_symshndx (symdata, shndxdata - } - - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, &symdata_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; -@@ -130,7 +124,7 @@ gelf_update_symshndx (symdata, shndxdata - else - { - /* Check whether we have to resize the data buffer. */ -- if (unlikely ((ndx + 1) * sizeof (Elf64_Sym) > symdata_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Sym, &symdata_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - goto out; ---- elfutils/libelf/gelf_update_versym.c -+++ elfutils/libelf/gelf_update_versym.c -@@ -1,5 +1,5 @@ - /* Update symbol version information. -- Copyright (C) 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2001-2009 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2001. - -@@ -54,8 +54,7 @@ gelf_update_versym (data, ndx, src) - assert (sizeof (GElf_Versym) == sizeof (Elf64_Versym)); - - /* Check whether we have to resize the data buffer. */ -- if (unlikely (ndx < 0) -- || unlikely ((ndx + 1) * sizeof (GElf_Versym) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Versym, &data_scn->d)) - { - __libelf_seterrno (ELF_E_INVALID_INDEX); - return 0; ---- elfutils/libelf/libelfP.h -+++ elfutils/libelf/libelfP.h -@@ -587,4 +587,8 @@ extern uint32_t __libelf_crc32 (uint32_t - /* Align offset to 4 bytes as needed for note name and descriptor data. */ - #define NOTE_ALIGN(n) (((n) + 3) & -4U) - -+/* Convenience macro. */ -+#define INVALID_NDX(ndx, type, data) \ -+ unlikely ((data)->d_size / sizeof (type) <= (unsigned int) (ndx)) -+ - #endif /* libelfP.h */ ---- elfutils/src/ChangeLog -+++ elfutils/src/ChangeLog -@@ -344,6 +344,12 @@ - - * readelf.c (dwarf_attr_string): Grok DW_AT_GNU_odr_signature. - -+2011-03-23 Petr Machata -+ -+ * readelf.c (handle_dynamic, handle_relocs_rel) -+ (handle_relocs_rela, handle_versym, print_liblist): -+ Use gelf_fsize instead of relying on shdr->sh_entsize. -+ - 2011-02-11 Roland McGrath - - * elfcmp.c (verbose): New variable. -@@ -2056,6 +2062,16 @@ - object symbols or symbols with unknown type. - (check_rel): Likewise. - -+2005-06-09 Roland McGrath -+ -+ * readelf.c (handle_dynamic, handle_symtab): Check for bogus sh_link. -+ (handle_verneed, handle_verdef, handle_versym, handle_hash): Likewise. -+ (handle_scngrp): Check for bogus sh_info. -+ -+ * strip.c (handle_elf): Check for bogus values in sh_link, sh_info, -+ st_shndx, e_shstrndx, and SHT_GROUP or SHT_SYMTAB_SHNDX data. -+ Don't use assert on input values, instead bail with "illformed" error. -+ - 2005-06-08 Roland McGrath - - * readelf.c (print_ops): Add consts. -@@ -2101,6 +2117,19 @@ - - * readelf.c (dwarf_tag_string): Add new tags. - -+2005-05-17 Jakub Jelinek -+ -+ * elflint.c (check_hash): Don't check entries beyond end of section. -+ (check_note): Don't crash if gelf_rawchunk fails. -+ (section_name): Return if gelf_getshdr returns NULL. -+ -+2005-05-14 Jakub Jelinek -+ -+ * elflint.c (section_name): Return "" instead of -+ crashing on invalid section name. -+ (check_symtab, is_rel_dyn, check_rela, check_rel, check_dynamic, -+ check_symtab_shndx, check_hash, check_versym): Robustify. -+ - 2005-05-08 Roland McGrath - - * strip.c (handle_elf): Don't translate hash and versym data formats, ---- elfutils/src/elflint.c -+++ elfutils/src/elflint.c -@@ -123,6 +123,10 @@ static uint32_t shstrndx; - /* Array to count references in section groups. */ - static int *scnref; - -+/* Numbers of sections and program headers. */ -+static unsigned int shnum;