From 4bf7d392453cbcbd65b36c054e1fdbdb1590def7 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 11 Mar 2010 00:44:28 -0800 Subject: elf.h: Add missing R_X86_64_*64 relocs. --- elf/elf.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'elf') diff --git a/elf/elf.h b/elf/elf.h index fd6236b8cf..f41a02649e 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -2666,7 +2666,13 @@ typedef Elf32_Addr Elf32_Conflict; #define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ #define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative offset to GOT */ -/* 27 .. 31 */ +#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ +#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset + to GOT entry */ +#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ +#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ +#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset + to PLT entry */ #define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ #define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ #define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ -- cgit v1.2.3 From 4c35fb65c9ea221561bc5698358944a73383b3d6 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 12 Mar 2010 07:57:19 -0800 Subject: Don't underestimate length of DST substitution --- ChangeLog | 5 +++++ elf/dl-dst.h | 21 +++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index c3fda93de9..be5d5557e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-03-12 Andreas Schwab + + * elf/dl-dst.h: Include "trusted-dirs.h". + (DL_DST_REQUIRED): Take $LIB into account. + 2010-03-11 Roland McGrath * elf/elf.h (R_X86_64_GOT64, R_X86_64_GOTPCREL64): New macros. diff --git a/elf/dl-dst.h b/elf/dl-dst.h index 76076a6036..ae8d119c0d 100644 --- a/elf/dl-dst.h +++ b/elf/dl-dst.h @@ -18,6 +18,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "trusted-dirs.h" + /* Determine the number of DST elements in the name. Only if IS_PATH is nonzero paths are recognized (i.e., multiple, ':' separated filenames). */ #define DL_DST_COUNT(name, is_path) \ @@ -39,12 +41,13 @@ \ if (__cnt > 0) \ { \ - size_t origin_len; \ + size_t dst_len; \ /* Now we make a guess how many extra characters on top of the \ length of S we need to represent the result. We know that \ we have CNT replacements. Each at most can use \ - MAX (strlen (ORIGIN), strlen (_dl_platform)) \ - minus 7 (which is the length of "$ORIGIN"). \ + MAX (MAX (strlen (ORIGIN), strlen (_dl_platform)), \ + strlen (DL_DST_LIB)) \ + minus 4 (which is the length of "$LIB"). \ \ First get the origin string if it is not available yet. \ This can only happen for the map of the executable. */ \ @@ -53,14 +56,16 @@ { \ assert ((l)->l_name[0] == '\0'); \ (l)->l_origin = _dl_get_origin (); \ - origin_len = ((l)->l_origin && (l)->l_origin != (char *) -1 \ + dst_len = ((l)->l_origin && (l)->l_origin != (char *) -1 \ ? strlen ((l)->l_origin) : 0); \ } \ else \ - origin_len = (l)->l_origin == (char *) -1 \ + dst_len = (l)->l_origin == (char *) -1 \ ? 0 : strlen ((l)->l_origin); \ - \ - __len += __cnt * (MAX (origin_len, GLRO(dl_platformlen)) - 7); \ + dst_len = MAX (MAX (dst_len, GLRO(dl_platformlen)), \ + strlen (DL_DST_LIB)); \ + if (dst_len > 4) \ + __len += __cnt * (dst_len - 4); \ } \ \ __len; }) @@ -72,7 +77,7 @@ if ((l) == NULL) \ { \ const char *origin = _dl_get_origin (); \ - origin_len = (origin && origin != (char *) -1 ? strlen (origin) : 0); \ + dst_len = (origin && origin != (char *) -1 ? strlen (origin) : 0); \ } \ else #endif -- cgit v1.2.3 From 92ad15a8f1d3e65f20fda3265c04ff26a642a2d0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 15 Mar 2010 11:44:58 -0700 Subject: Implement handling of libc ABI in ELF header. --- ChangeLog | 8 ++++++++ Makerules | 16 ++++++++++++++-- csu/version.c | 8 ++++++-- elf/dl-load.c | 6 ++++-- 4 files changed, 32 insertions(+), 6 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index e8781598a9..21137d77e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-03-15 Ulrich Drepper + + * Makerules: Add rule for libc-abis.h. + * csu/version.c: Use LIBC_ABIS_STRING string if available. + * elf/dl-load.c (VALID_ELF_ABIVERSION): Check using LIBC_ABI_MAX. + (open_verify): Only check EI_ABIVERSION bytes using VALID_ELF_HEADER. + Add extra call to VALID_ELF_ABIVERSION. + 2010-03-12 Ulrich Drepper * sysdeps/unix/sysv/linux/sys/mount.h (UMOUNT_NOFOLLOW): Define. diff --git a/Makerules b/Makerules index 43fa5a701b..d5ff383770 100644 --- a/Makerules +++ b/Makerules @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2006,2007,2008,2009 Free Software Foundation, Inc. +# Copyright (C) 1991-2006,2007,2008,2009,2010 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -109,6 +109,18 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h endif # avoid-generated endif # $(versioning) = yes +ifndef avoid-generated +before-compile := $(common-objpfx)libc-abis.h $(before-compile) +libc-abis := $(firstword $(wildcard $(foreach D,$(add-ons), $(..)libc-abis)) \ + libc-abis) +$(common-objpfx)libc-abis.h: $(..)scripts/gen-libc-abis $(libc-abis) + $(SHELL) $(..)scripts/gen-libc-abis \ + $(base-machine)-$(config-vendor)-$(config-os) \ + < $(libc-abis) > $@T + $(move-if-change) $@T $@ +common-generated += $(common-objpfx)libc-abis.h +endif # avoid-generated + # Make sure the subdirectory for object files gets created. ifdef objpfx ifeq (,$(wildcard $(objpfx).)) @@ -1395,7 +1407,7 @@ $(objpfx)stubs: $(objs-for-stubs) ifneq (,$(strip $(objs-for-stubs))) (cd $(objpfx).; $(OBJDUMP) -h $(patsubst $(objpfx)%,%,$^)) | \ $(AWK) '/\.gnu\.glibc-stub\./ { \ - sub(/\.gnu\.glibc-stub\./, "", $$2); \ + sub(/\.gnu\.glibc-stub\./, "", $$2); \ stubs[$$2] = 1; } \ END { for (s in stubs) print "#define __stub_" s }' > $@T mv -f $@T $@ diff --git a/csu/version.c b/csu/version.c index db913be800..8e32f312a9 100644 --- a/csu/version.c +++ b/csu/version.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1992-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ #include "version.h" #include +#include #include static const char __libc_release[] = RELEASE; @@ -25,12 +26,15 @@ static const char __libc_version[] = VERSION; static const char banner[] = "GNU C Library "RELEASE" release version "VERSION", by Roland McGrath et al.\n\ -Copyright (C) 2009 Free Software Foundation, Inc.\n\ +Copyright (C) 2010 Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ PARTICULAR PURPOSE.\n\ Compiled by GNU CC version "__VERSION__".\n" #include "version-info.h" +#ifdef LIBC_ABIS_STRING +LIBC_ABIS_STRING +#endif #ifdef GLIBC_OLDEST_ABI "The oldest ABI supported: " GLIBC_OLDEST_ABI ".\n" #endif diff --git a/elf/dl-load.c b/elf/dl-load.c index e8c7be55f7..1cfab353d0 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1569,7 +1569,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, #ifndef VALID_ELF_HEADER # define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0) # define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV) -# define VALID_ELF_ABIVERSION(ver) (ver == 0) +# define VALID_ELF_ABIVERSION(ver) (ver < LIBC_ABI_MAX) #elif defined MORE_ELF_HEADER_DATA MORE_ELF_HEADER_DATA; #endif @@ -1655,7 +1655,9 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, /* See whether the ELF header is what we expect. */ if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected, - EI_PAD), 0)) + EI_ABIVERSION) + || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]), + 0)) { /* Something is wrong. */ const Elf32_Word *magp = (const void *) ehdr->e_ident; -- cgit v1.2.3 From 561470e061b4210385ace824cac6139bccde094c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 15 Mar 2010 11:50:59 -0700 Subject: Update copyright year. --- ChangeLog | 17 +++++++++++++++++ catgets/gencat.c | 4 ++-- debug/catchsegv.sh | 6 +++--- debug/xtrace.sh | 4 ++-- elf/ldconfig.c | 4 ++-- elf/ldd.bash.in | 6 +++--- elf/sprof.c | 6 +++--- iconv/iconv_prog.c | 6 +++--- iconv/iconvconfig.c | 32 ++++++++++++++++---------------- locale/programs/locale.c | 10 +++++----- locale/programs/localedef.c | 8 ++++---- malloc/memusage.sh | 10 +++++----- malloc/mtrace.pl | 4 ++-- nscd/nscd.c | 8 ++++---- nss/getent.c | 4 ++-- posix/getconf.c | 4 ++-- 16 files changed, 75 insertions(+), 58 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 21137d77e4..5d5df59c8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2010-03-15 Ulrich Drepper + * posix/getconf.c: Update copyright year. + * nss/getent.c: Likewise. + * iconv/iconvconfig.c: Likewise. + * iconv/iconv_prog.c: Likewise. + * elf/ldconfig.c: Likewise. + * catgets/gencat.c: Likewise. + * csu/version.c: Likewise. + * elf/ldd.bash.in: Likewise. + * elf/sprof.c (print_version): Likewise. + * locale/programs/locale.c: Likewise. + * locale/programs/localedef.c: Likewise. + * nscd/nscd.c (print_version): Likewise. + * debug/xtrace.sh: Likewise. + * malloc/memusage.sh: Likewise. + * malloc/mtrace.pl: Likewise. + * debug/catchsegv.sh: Likewise. + * Makerules: Add rule for libc-abis.h. * csu/version.c: Use LIBC_ABIS_STRING string if available. * elf/dl-load.c (VALID_ELF_ABIVERSION): Check using LIBC_ABI_MAX. diff --git a/catgets/gencat.c b/catgets/gencat.c index e9a371fd5b..32a81cab35 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1996-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -247,7 +247,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } diff --git a/debug/catchsegv.sh b/debug/catchsegv.sh index 5a91d21137..d78fec5e63 100755 --- a/debug/catchsegv.sh +++ b/debug/catchsegv.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1998,1999,2001,2003,2004,2006,2007,2008,2009 +# Copyright (C) 1998,1999,2001,2003,2004,2006,2007,2008,2009,2010 # Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Ulrich Drepper , 1998. @@ -40,7 +40,7 @@ if test $# -eq 0; then ;; --v | --ve | --ver | --vers | --versi | --versio | --version) echo 'catchsegv (GNU libc) @VERSION@' - echo 'Copyright (C) 2009 Free Software Foundation, Inc. + echo 'Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Ulrich Drepper.' @@ -97,7 +97,7 @@ if test -s "$segv_output"; then echo "$line" fi ;; - *) echo "$line" + *) echo "$line" ;; esac done) diff --git a/debug/xtrace.sh b/debug/xtrace.sh index 8ef507ef38..3cf9b0c0f4 100755 --- a/debug/xtrace.sh +++ b/debug/xtrace.sh @@ -1,5 +1,5 @@ #! @BASH@ -# Copyright (C) 1999, 2001-2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001-2008, 2009, 2010 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Ulrich Drepper , 1999. @@ -66,7 +66,7 @@ do_version() { printf $"Copyright (C) %s Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -" "2009" +" "2010" printf $"Written by %s. " "Ulrich Drepper" exit 0 diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 78a0f0c2a8..efa67253f5 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1999-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1999. @@ -317,7 +317,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Andreas Jaeger"); } diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in index 1bbefe2ff0..00ab15f76d 100644 --- a/elf/ldd.bash.in +++ b/elf/ldd.bash.in @@ -1,5 +1,5 @@ #! @BASH@ -# Copyright (C) 1996-2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2008, 2009, 2010 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -39,7 +39,7 @@ while test $# -gt 0; do printf $"Copyright (C) %s Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -" "2009" +" "2010" printf $"Written by %s and %s. " "Roland McGrath" "Ulrich Drepper" exit 0 @@ -160,7 +160,7 @@ warning: you do not have execution permission for" "\`$file'" >&2 for rtld in ${RTLDLIST}; do if test -x $rtld; then verify_out=`${rtld} --verify "$file"` - ret=$? + ret=$? case $ret in [02]) RTLD=${rtld}; break;; esac diff --git a/elf/sprof.c b/elf/sprof.c index 96d854fb70..a2cc974bba 100644 --- a/elf/sprof.c +++ b/elf/sprof.c @@ -1,5 +1,5 @@ /* Read and display shared object profiling data. - Copyright (C) 1997-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -261,7 +261,7 @@ main (int argc, char *argv[]) { /* We need exactly two non-option parameter. */ argp_help (&argp, stdout, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, - program_invocation_short_name); + program_invocation_short_name); exit (1); } @@ -388,7 +388,7 @@ Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ "), - "2009"); + "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index 3bcb9b464e..7354f68715 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -1,5 +1,5 @@ /* Convert text in given files from the specified from-set to the to-set. - Copyright (C) 1998-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1998-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -424,7 +424,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -501,7 +501,7 @@ process_block (iconv_t cd, char *addr, size_t len, FILE **output, if (n != (size_t) -1) { /* All the input test is processed. For state-dependent - character sets we have to flush the state now. */ + character sets we have to flush the state now. */ outptr = outbuf; outlen = OUTBUF_SIZE; n = iconv (cd, NULL, NULL, &outptr, &outlen); diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c index 1d95e89a84..e4d5b3a89b 100644 --- a/iconv/iconvconfig.c +++ b/iconv/iconvconfig.c @@ -1,5 +1,5 @@ /* Generate fastloading iconv module configuration files. - Copyright (C) 2000-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2000-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2000. @@ -396,7 +396,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -993,24 +993,24 @@ next_prime (uint32_t seed) stoff ??? String table hoff 8*hsize Array of tuples - string table offset - module index + string table offset + module index moff ??? Array of tuples - canonical name offset - from-internal module dir name offset - from-internal module name off - to-internal module dir name offset - to-internal module name offset - offset into other conversion table + canonical name offset + from-internal module dir name offset + from-internal module name off + to-internal module dir name offset + to-internal module name offset + offset into other conversion table ooff ??? One or more of - number of steps/modules - one or more of tuple - canonical name offset for output - module dir name offset - module name offset - (following last entry with step count 0) + number of steps/modules + one or more of tuple + canonical name offset for output + module dir name offset + module name offset + (following last entry with step count 0) */ static struct hash_entry *hash_table; diff --git a/locale/programs/locale.c b/locale/programs/locale.c index 77262b7d1c..a3602cf118 100644 --- a/locale/programs/locale.c +++ b/locale/programs/locale.c @@ -1,5 +1,5 @@ /* Implementation of the locale program according to POSIX 9945-2. - Copyright (C) 1995-1997, 1999-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1995-1997, 1999-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -144,7 +144,7 @@ struct category #define DEFINE_CATEGORY(category, name, items, postload) \ static struct cat_item category##_desc[] = \ { \ - NO_PAREN items \ + NO_PAREN items \ }; #include "categories.def" @@ -294,7 +294,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -539,7 +539,7 @@ write_locales (void) because a) we are only interested in the first two fields b) these fields must be usable as file names and so must - not be that long */ + not be that long */ char buf[BUFSIZ]; char *alias; char *value; @@ -886,7 +886,7 @@ show_info (const char *name) while (cnt > 1) { printf ("%d;", *val == '\177' ? -1 : *val); - --cnt; + --cnt; ++val; } diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c index c8eebc7e5c..4cb0d862ca 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1995-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -365,8 +365,8 @@ more_help (int key, const char *text, void *input) /* We print some extra information. */ if (asprintf (&cp, gettext ("\ System's directory for character maps : %s\n\ - repertoire maps: %s\n\ - locale path : %s\n\ + repertoire maps: %s\n\ + locale path : %s\n\ %s"), CHARMAP_PATH, REPERTOIREMAP_PATH, LOCALE_PATH, gettext ("\ For bug reporting instructions, please see:\n\ @@ -388,7 +388,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } diff --git a/malloc/memusage.sh b/malloc/memusage.sh index 9fab0a3b8b..ec34486b55 100755 --- a/malloc/memusage.sh +++ b/malloc/memusage.sh @@ -1,5 +1,5 @@ #! @BASH@ -# Copyright (C) 1999-2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1999-2008, 2009, 2010 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Ulrich Drepper , 1999. @@ -73,7 +73,7 @@ do_version() { printf $"Copyright (C) %s Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -" "2009" +" "2010" printf $"Written by %s. " "Ulrich Drepper" exit 0 @@ -99,9 +99,9 @@ while test $# -gt 0; do ;; --us | --usa | --usag | --usage) echo $"Syntax: memusage [--data=FILE] [--progname=NAME] [--png=FILE] [--unbuffered] - [--buffer=SIZE] [--no-timer] [--time-based] [--total] - [--title=STRING] [--x-size=SIZE] [--y-size=SIZE] - PROGRAM [PROGRAMOPTION]..." + [--buffer=SIZE] [--no-timer] [--time-based] [--total] + [--title=STRING] [--x-size=SIZE] [--y-size=SIZE] + PROGRAM [PROGRAMOPTION]..." exit 0 ;; -n | --pr | --pro | --prog | --progn | --progna | --prognam | --progname) diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl index 1c13ae0370..82318dca58 100644 --- a/malloc/mtrace.pl +++ b/malloc/mtrace.pl @@ -1,7 +1,7 @@ #! @PERL@ eval "exec @PERL@ -S $0 $@" if 0; -# Copyright (C) 1997-2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1997-2008, 2009, 2010 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Ulrich Drepper , 1997. # Based on the mtrace.awk script. @@ -45,7 +45,7 @@ arglist: while (@ARGV) { $ARGV[0] eq "--vers" || $ARGV[0] eq "--versi" || $ARGV[0] eq "--versio" || $ARGV[0] eq "--version") { print "mtrace (GNU $PACKAGE) $VERSION\n"; - print "Copyright (C) 2009 Free Software Foundation, Inc.\n"; + print "Copyright (C) 2010 Free Software Foundation, Inc.\n"; print "This is free software; see the source for copying conditions. There is NO\n"; print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; print "Written by Ulrich Drepper \n"; diff --git a/nscd/nscd.c b/nscd/nscd.c index b9035f2131..7e70f2b116 100644 --- a/nscd/nscd.c +++ b/nscd/nscd.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998-2008, 2009 Free Software Foundation, Inc. +/* Copyright (c) 1998-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1998. @@ -246,7 +246,7 @@ main (int argc, char **argv) openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON); if (write_pid (_PATH_NSCDPID) < 0) - dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno)); + dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno)); if (!init_logfile ()) dbg_log (_("Could not create log file")); @@ -430,7 +430,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk and Ulrich Drepper"); } @@ -511,7 +511,7 @@ check_pid (const char *file) the PID is the same as the current process' since tha latter can mean we re-exec. */ if ((n != 1 || kill (pid, 0) == 0) && pid != getpid ()) - return 1; + return 1; } return 0; diff --git a/nss/getent.c b/nss/getent.c index d70a8da0f4..69eea25a68 100644 --- a/nss/getent.c +++ b/nss/getent.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998-2008, 2009 Free Software Foundation, Inc. +/* Copyright (c) 1998-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1998. @@ -83,7 +83,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk"); } diff --git a/posix/getconf.c b/posix/getconf.c index d9d90e44f7..25f4307bea 100644 --- a/posix/getconf.c +++ b/posix/getconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 1995-2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 1995-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -1105,7 +1105,7 @@ main (int argc, char *argv[]) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2009"); +"), "2010"); printf (gettext ("Written by %s.\n"), "Roland McGrath"); return 0; } -- cgit v1.2.3 From d8c47894ca28d5c5cf396aa271c579d41f21c1d4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 16 Mar 2010 23:34:59 -0700 Subject: Extended ELF ABI version handling only for Linux. If the OSABI is generic we should not allow the ABI version to be nonzero. Move all the new functionality into Linux-specific files. --- ChangeLog | 10 ++++++++++ elf/dl-load.c | 8 +++++--- sysdeps/unix/sysv/linux/ldsodefs.h | 9 +++++---- 3 files changed, 20 insertions(+), 7 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index ed27976ad6..a8eba156a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2010-03-16 Ulrich Drepper + * elf/dl-load.c (VALID_ELF_ABIVERSION): Add additional osabi parameter. + Not used here. + (open_verify): Modify for extended VALID_ELF_ABIVERSION macro + interface. + * sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Add + additional osabi parameter. Only acceept nonzero ABI versions if osabi + is Linux. + Fix includes. + (expected2): Don't explicitly initialize EI_ABIVERSION byte. + * sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Update definition to follow generic code. diff --git a/elf/dl-load.c b/elf/dl-load.c index 1cfab353d0..756816f25f 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1569,7 +1569,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, #ifndef VALID_ELF_HEADER # define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0) # define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV) -# define VALID_ELF_ABIVERSION(ver) (ver < LIBC_ABI_MAX) +# define VALID_ELF_ABIVERSION(osabi,ver) (ver == 0) #elif defined MORE_ELF_HEADER_DATA MORE_ELF_HEADER_DATA; #endif @@ -1656,7 +1656,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, /* See whether the ELF header is what we expect. */ if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected, EI_ABIVERSION) - || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]), + || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI], + ehdr->e_ident[EI_ABIVERSION]), 0)) { /* Something is wrong. */ @@ -1697,7 +1698,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, allowed here. */ else if (!VALID_ELF_OSABI (ehdr->e_ident[EI_OSABI])) errstring = N_("ELF file OS ABI invalid"); - else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION])) + else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI], + ehdr->e_ident[EI_ABIVERSION])) errstring = N_("ELF file ABI version invalid"); else /* Otherwise we don't know what went wrong. */ diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h index 438c9e0c8d..5d5b1b4c06 100644 --- a/sysdeps/unix/sysv/linux/ldsodefs.h +++ b/sysdeps/unix/sysv/linux/ldsodefs.h @@ -1,5 +1,5 @@ /* Run-time dynamic linker data structures for loaded ELF shared objects. - Copyright (C) 2001, 2002, 2003, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2006, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ #ifndef _LDSODEFS_H +#include #include /* Get the real definitions. */ @@ -58,7 +59,8 @@ extern void _dl_non_dynamic_init (void) internal_function; || memcmp (hdr, expected2, size) == 0) #define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV \ || osabi == ELFOSABI_LINUX) -#define VALID_ELF_ABIVERSION(ver) (ver < LIBC_ABI_MAX) +#define VALID_ELF_ABIVERSION(osabi,ver) \ + (ver == 0 || (osabi == ELFOSABI_LINUX && ver < LIBC_ABI_MAX)) #define MORE_ELF_HEADER_DATA \ static const unsigned char expected2[EI_PAD] = \ { \ @@ -69,8 +71,7 @@ extern void _dl_non_dynamic_init (void) internal_function; [EI_CLASS] = ELFW(CLASS), \ [EI_DATA] = byteorder, \ [EI_VERSION] = EV_CURRENT, \ - [EI_OSABI] = ELFOSABI_LINUX, \ - [EI_ABIVERSION] = 0 \ + [EI_OSABI] = ELFOSABI_LINUX \ } #endif /* ldsodefs.h */ -- cgit v1.2.3 From 04f2902d9fadb2b8221162247412fb2c4667d95e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 18 Mar 2010 13:15:27 -0700 Subject: Future safety in checking ELF header. If we should use further fields in the e_ident array in the ELF header of files we want zero to mean the default. Enforce zero for now so that non-optional features indicated by nonzero values are not go unnoticed when using an old dynamic linker. --- ChangeLog | 6 ++++++ elf/dl-load.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 92b6a914b5..9ff497dcf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-03-18 Ulrich Drepper + + * elf/dl-load.c (open_verify): Extend expected to the full size of the + e_ident array. When loading, check that the fields in e_ident we don't + know are zero to allow future extensions. + 2010-03-18 H.J. Lu * sysdeps/i386/i686/multiarch/memcmp-ssse3.S: Update %xmm3 diff --git a/elf/dl-load.c b/elf/dl-load.c index 756816f25f..d8f9131dd6 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1573,7 +1573,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, #elif defined MORE_ELF_HEADER_DATA MORE_ELF_HEADER_DATA; #endif - static const unsigned char expected[EI_PAD] = + static const unsigned char expected[EI_NIDENT] = { [EI_MAG0] = ELFMAG0, [EI_MAG1] = ELFMAG1, @@ -1657,7 +1657,10 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected, EI_ABIVERSION) || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI], - ehdr->e_ident[EI_ABIVERSION]), + ehdr->e_ident[EI_ABIVERSION]) + || memcmp (&ehdr->e_ident[EI_PAD], + &expected[EI_PAD], + EI_NIDENT - EI_PAD) != 0, 0)) { /* Something is wrong. */ @@ -1701,6 +1704,9 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI], ehdr->e_ident[EI_ABIVERSION])) errstring = N_("ELF file ABI version invalid"); + else if (memcmp (&ehdr->e_ident[EI_PAD], &expected[EI_PAD], + EI_NIDENT - EI_PAD) != 0) + errstring = N_("nonzero padding in e_ident"); else /* Otherwise we don't know what went wrong. */ errstring = N_("internal error"); -- cgit v1.2.3 From 4ad43b62d6b893e73d5af72565f23c064b9c59b5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 24 Mar 2010 10:14:22 -0700 Subject: Fix handling of STB_GNU_UNIQUE in LD_TRACE_PRELINKING --- ChangeLog | 15 +++++++++++++++ elf/dl-deps.c | 9 +++++++-- elf/dl-lookup.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- include/link.h | 6 +++++- 4 files changed, 79 insertions(+), 5 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 6bf4fdc377..9a2b2ca64c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-03-23 Jakub Jelinek + + * elf/dl-lookup.c (do_lookup_x): If tab->entries is NULL, + but tab->size != 0, just unlock and goto success, without + allocating anything or entering anything into the hash table. + (_dl_debug_bindings): Temporarily set tab->entries to NULL + around do_lookup_x in undef_map->l_local_scope[0]. If + undef_map->l_symbolic_in_local_scope, lookup also in + symbolic_searchlist of following libraries in l_local_scope + that have DT_SYMBOLIC set. + * elf/dl-deps.c (_dl_map_object_deps): Compute + l_symbolic_in_local_scope. + * include/link.h (struct link_map): Add l_symbolic_in_local_scope + bitfield. + 2010-03-24 Ulrich Drepper [BZ #11410] diff --git a/elf/dl-deps.c b/elf/dl-deps.c index 34c6024efa..a58de5c985 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -1,5 +1,5 @@ /* Load the dependencies of a mapped object. - Copyright (C) 1996-2003, 2004, 2005, 2006, 2007 + Copyright (C) 1996-2003, 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -554,7 +554,12 @@ Filters not supported with LD_TRACE_PRELINKING")); cnt = _dl_build_local_scope (l_initfini, l); assert (cnt <= nlist); for (j = 0; j < cnt; j++) - l_initfini[j]->l_reserved = 0; + { + l_initfini[j]->l_reserved = 0; + if (j && __builtin_expect (l_initfini[j]->l_info[DT_SYMBOLIC] + != NULL, 0)) + l->l_symbolic_in_local_scope = true; + } l->l_local_scope[0] = (struct r_scope_elem *) malloc (sizeof (struct r_scope_elem) diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index 763ec16fa4..78c8669e30 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -1,5 +1,6 @@ /* Look up a symbol in the loaded objects. - Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1995-2005, 2006, 2007, 2009, 2010 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -414,6 +415,20 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, assert (!RTLD_CHECK_FOREIGN_CALL); #endif +#ifdef SHARED + /* If tab->entries is NULL, but tab->size is not, it means + this is the second, conflict finding, lookup for + LD_TRACE_PRELINKING in _dl_debug_bindings. Don't + allocate anything and don't enter anything into the + hash table. */ + if (__builtin_expect (tab->size, 0)) + { + assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK); + __rtld_lock_unlock_recursive (tab->lock); + goto success; + } +#endif + #define INITIAL_NUNIQUE_SYM_TABLE 31 size = INITIAL_NUNIQUE_SYM_TABLE; entries = calloc (sizeof (struct unique_sym), size); @@ -917,13 +932,48 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map, { const uint_fast32_t new_hash = dl_new_hash (undef_name); unsigned long int old_hash = 0xffffffff; + struct unique_sym *saved_entries + = GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries; + GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries = NULL; do_lookup_x (undef_name, new_hash, &old_hash, *ref, &val, undef_map->l_local_scope[0], 0, version, 0, NULL, type_class, undef_map); - if (val.s != value->s || val.m != value->m) conflict = 1; + else if (__builtin_expect (undef_map->l_symbolic_in_local_scope, 0) + && val.s + && __builtin_expect (ELFW(ST_BIND) (val.s->st_info), + STB_GLOBAL) == STB_GNU_UNIQUE) + { + /* If it is STB_GNU_UNIQUE and undef_map's l_local_scope + contains any DT_SYMBOLIC libraries, unfortunately there + can be conflicts even if the above is equal. As symbol + resolution goes from the last library to the first and + if a STB_GNU_UNIQUE symbol is found in some late DT_SYMBOLIC + library, it would be the one that is looked up. */ + struct sym_val val2 = { NULL, NULL }; + size_t n; + struct r_scope_elem *scope = undef_map->l_local_scope[0]; + + for (n = 0; n < scope->r_nlist; n++) + if (scope->r_list[n] == val.m) + break; + + for (n++; n < scope->r_nlist; n++) + if (scope->r_list[n]->l_info[DT_SYMBOLIC] != NULL + && do_lookup_x (undef_name, new_hash, &old_hash, *ref, + &val2, + &scope->r_list[n]->l_symbolic_searchlist, + 0, version, 0, NULL, type_class, + undef_map) > 0) + { + conflict = 1; + val = val2; + break; + } + } + GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries = saved_entries; } if (value->s) diff --git a/include/link.h b/include/link.h index 26c67438f0..9d1fc1a8fe 100644 --- a/include/link.h +++ b/include/link.h @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1995-2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -188,6 +188,10 @@ struct link_map unsigned int l_contiguous:1; /* Nonzero if inter-segment holes are mprotected or if no holes are present at all. */ + unsigned int l_symbolic_in_local_scope:1; /* Nonzero if l_local_scope + during LD_TRACE_PRELINKING=1 + contains any DT_SYMBOLIC + libraries. */ /* Collected information about own RPATH directories. */ struct r_search_path_struct l_rpath_dirs; -- cgit v1.2.3 From b1c1949e60e7c61bcd9f40f712d07494596491b2 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 26 Mar 2010 09:16:21 -0700 Subject: Don't take the address of a void object. GCC 4.5 warns about "extern void _end; &end;". Use char[] instead, as that also doesn't fall foul of a target's .sdata optimizations. Signed-off-by: Richard Henderson --- ChangeLog | 7 +++++++ csu/gmon-start.c | 4 ++-- elf/dl-sysdep.c | 6 +++--- sysdeps/unix/sysv/linux/dl-sysdep.c | 8 ++++---- 4 files changed, 16 insertions(+), 9 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 8117882671..72cbef6681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-03-26 Richard Henderson + + * csu/gmon-start.c (ENTRY_POINT, etext): Declare as char[], not void. + * elf/dl-sysdep.c (_end): Likewise. + * sysdeps/unix/sysv/dl-sysdep.c (frob_brk): Likewise with locally + declared _end, and associated variables. + 2010-03-26 Ulrich Drepper * sysdeps/posix/getaddrinfo.c (gaih_inet): Don't assume success always diff --git a/csu/gmon-start.c b/csu/gmon-start.c index d11c9b9532..7d585e135f 100644 --- a/csu/gmon-start.c +++ b/csu/gmon-start.c @@ -31,9 +31,9 @@ #ifdef ENTRY_POINT_DECL ENTRY_POINT_DECL(extern) #else -extern void ENTRY_POINT; +extern char ENTRY_POINT[]; #endif -extern void etext; +extern char etext[]; #ifndef TEXT_START # ifdef ENTRY_POINT_DECL diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c index 5507e57b96..160503dac5 100644 --- a/elf/dl-sysdep.c +++ b/elf/dl-sysdep.c @@ -47,7 +47,7 @@ #endif extern char **_environ attribute_hidden; -extern void _end attribute_hidden; +extern char _end[] attribute_hidden; /* Protect SUID program against misuse of file descriptors. */ extern void __libc_check_standard_fds (void); @@ -226,14 +226,14 @@ _dl_sysdep_start (void **start_argptr, if (GLRO(dl_platform) != NULL) GLRO(dl_platformlen) = strlen (GLRO(dl_platform)); - if (__sbrk (0) == &_end) + if (__sbrk (0) == _end) /* The dynamic linker was run as a program, and so the initial break starts just after our bss, at &_end. The malloc in dl-minimal.c will consume the rest of this page, so tell the kernel to move the break up that far. When the user program examines its break, it will see this new value and not clobber our data. */ __sbrk (GLRO(dl_pagesize) - - ((&_end - (void *) 0) & (GLRO(dl_pagesize) - 1))); + - ((_end - (char *) 0) & (GLRO(dl_pagesize) - 1))); /* If this is a SUID program we make sure that FDs 0, 1, and 2 are allocated. If necessary we are doing it ourself. If it is not diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index 08ae9aa86d..34e8808928 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -47,12 +47,12 @@ frob_brk (void) Later Linux kernels have changed this behavior so that the initial break value is rounded up to the page boundary before we start. */ - extern void *__curbrk attribute_hidden; - extern void _end attribute_hidden; - void *const endpage = (void *) 0 + (((__curbrk - (void *) 0) + extern char *__curbrk attribute_hidden; + extern char _end[] attribute_hidden; + char *const endpage = (void *) 0 + (((__curbrk - (char *) 0) + GLRO(dl_pagesize) - 1) & -GLRO(dl_pagesize)); - if (__builtin_expect (__curbrk >= &_end && __curbrk < endpage, 0)) + if (__builtin_expect (__curbrk >= _end && __curbrk < endpage, 0)) __brk (endpage); #endif } -- cgit v1.2.3 From bc58236c652761240fbe52f946f4a5efdd503fab Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 29 Mar 2010 15:13:53 -0700 Subject: Handle platforms without aux vector --- ChangeLog | 7 +++++++ elf/rtld.c | 6 +++--- sysdeps/mach/hurd/dl-sysdep.c | 7 ++++--- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 4587248b6d..5b70500d5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-03-28 Thomas Schwinge + + * sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): Adapt to auxv + changes in the generic code. + * elf/rtld.c (dl_main): Conditionalize the code that dereferences auxv + to [HAVE_AUX_VECTOR]. + 2010-03-27 Ulrich Drepper * sysdeps/unix/sysv/linux/getpagesize.c (__getpagesize): If diff --git a/elf/rtld.c b/elf/rtld.c index 3afb997f85..3c414461e9 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -928,8 +928,6 @@ dl_main (const ElfW(Phdr) *phdr, if (*user_entry == (ElfW(Addr)) ENTRY_POINT) { - ElfW(auxv_t) *av; - /* Ho ho. We are not the program interpreter! We are the program itself! This means someone ran ld.so as a command. Well, that might be convenient to do sometimes. We support it by @@ -1086,9 +1084,10 @@ of this helper program; chances are you did not intend to run this program.\n\ main_map->l_name = (char *) ""; *user_entry = main_map->l_entry; +#ifdef HAVE_AUX_VECTOR /* Adjust the on-stack auxiliary vector so that it looks like the binary was executed directly. */ - for (av = auxv; av->a_type != AT_NULL; av++) + for (ElfW(auxv_t) *av = auxv; av->a_type != AT_NULL; av++) switch (av->a_type) { case AT_PHDR: @@ -1101,6 +1100,7 @@ of this helper program; chances are you did not intend to run this program.\n\ av->a_un.a_val = *user_entry; break; } +#endif } else { diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 2440682903..f87b6e07dc 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -1,5 +1,5 @@ /* Operating system support for run-time dynamic linker. Hurd version. - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -116,7 +116,8 @@ static void fmh(void) { ElfW(Addr) _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent, - ElfW(Addr) *user_entry)) + ElfW(Addr) *user_entry, + ElfW(auxv_t) *auxv))) { void go (intptr_t *argdata) { @@ -197,7 +198,7 @@ unfmh(); /* XXX */ up and leave us to transfer control to USER_ENTRY. */ (*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr, _dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)), - &_dl_hurd_data->user_entry); + &_dl_hurd_data->user_entry, NULLy); /* The call above might screw a few things up. -- cgit v1.2.3 From 4bc2bcba67e870778fb9397f29435ee1b66bebf3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 5 Apr 2010 11:26:43 -0700 Subject: Fix aux cache handling in ldconfig with chroot. --- ChangeLog | 6 ++++++ elf/ldconfig.c | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 26b95e3382..866ec65f97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-05 Ulrich Drepper + + [BZ #11149] + * elf/ldconfig.c (main): Respect chroot setting when looking for + the aux cache. + 2010-04-04 Ulrich Drepper [BZ #11043] diff --git a/elf/ldconfig.c b/elf/ldconfig.c index efa67253f5..b9f1cc2d1b 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -1305,11 +1305,9 @@ main (int argc, char **argv) p ? (*p = '\0', cache_file) : "/"); if (canon == NULL) - { - error (EXIT_FAILURE, errno, - _("Can't open cache file directory %s\n"), - p ? cache_file : "/"); - } + error (EXIT_FAILURE, errno, + _("Can't open cache file directory %s\n"), + p ? cache_file : "/"); if (p) ++p; @@ -1346,8 +1344,17 @@ main (int argc, char **argv) add_system_dir (LIBDIR); } + char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE; + if (opt_chroot) + { + aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); + if (aux_cache_file == NULL) + error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), + _PATH_LDCONFIG_AUX_CACHE); + } + if (! opt_ignore_aux_cache) - load_aux_cache (_PATH_LDCONFIG_AUX_CACHE); + load_aux_cache (aux_cache_file); else init_aux_cache (); @@ -1356,7 +1363,7 @@ main (int argc, char **argv) if (opt_build_cache) { save_cache (cache_file); - save_aux_cache (_PATH_LDCONFIG_AUX_CACHE); + save_aux_cache (aux_cache_file); } return 0; -- cgit v1.2.3 From 4dd019e3a1c68e2988ac35a97c95a59cd307eb05 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 5 Apr 2010 19:44:16 -0700 Subject: elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast. --- ChangeLog | 4 ++++ elf/rtld.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index ef6c9def3c..7485ec5429 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-04-05 Roland McGrath + + * elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast. + 2010-04-05 Ulrich Drepper * po/nl.po: Update from translation team. diff --git a/elf/rtld.c b/elf/rtld.c index 3c414461e9..e26b2b9e1b 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1091,7 +1091,7 @@ of this helper program; chances are you did not intend to run this program.\n\ switch (av->a_type) { case AT_PHDR: - av->a_un.a_val = phdr; + av->a_un.a_val = (uintptr_t) phdr; break; case AT_PHNUM: av->a_un.a_val = phnum; -- cgit v1.2.3 From afd46a4c7d49c6c7697591f931f20c745df46e49 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 5 Apr 2010 20:14:43 -0700 Subject: elf/elf.h (ELFOSABI_ARM_AEABI): Define. --- ChangeLog | 4 ++++ elf/elf.h | 1 + 2 files changed, 5 insertions(+) (limited to 'elf') diff --git a/ChangeLog b/ChangeLog index 71c3f01284..6803147f89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ * elf/rtld.c (dl_main) [HAVE_AUX_VECTOR]: Add a cast. +2010-03-30 Joseph Myers + + * elf/elf.h (ELFOSABI_ARM_AEABI): Define. + 2010-04-05 Ulrich Drepper * po/nl.po: Update from translation team. diff --git a/elf/elf.h b/elf/elf.h index f41a02649e..1efe359119 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -150,6 +150,7 @@ typedef struct #define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ #define ELFOSABI_MODESTO 11 /* Novell Modesto. */ #define ELFOSABI_OPENBSD 12 /* OpenBSD. */ +#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ #define ELFOSABI_ARM 97 /* ARM */ #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ -- cgit v1.2.3