Resync with upstream master

Dropped upstreamed patches and adjusted others to apply to latest
upstream.
This commit is contained in:
Siddhesh Poyarekar 2013-06-04 22:23:45 +05:30
parent 1cb6060f99
commit 3cd9b9ce3d
13 changed files with 77 additions and 1237 deletions

View File

@ -4,9 +4,9 @@
diff -Nrup a/csu/elf-init.c b/csu/elf-init.c diff -Nrup a/csu/elf-init.c b/csu/elf-init.c
--- a/csu/elf-init.c 2012-06-05 07:42:49.000000000 -0600 --- a/csu/elf-init.c 2012-06-05 07:42:49.000000000 -0600
+++ b/csu/elf-init.c 2012-06-07 12:15:21.570319597 -0600 +++ b/csu/elf-init.c 2012-06-07 12:15:21.570319597 -0600
@@ -63,6 +63,23 @@ extern void (*__init_array_end []) (int, @@ -62,6 +62,23 @@ extern void _fini (void);
extern void (*__fini_array_start []) (void) attribute_hidden; programs, this module will come from libc_nonshared.a and differs from
extern void (*__fini_array_end []) (void) attribute_hidden; the libc.a module in that it doesn't call the preinit array. */
+#if defined HAVE_VISIBILITY_ATTRIBUTE \ +#if defined HAVE_VISIBILITY_ATTRIBUTE \
+ && (defined SHARED || defined LIBC_NONSHARED) + && (defined SHARED || defined LIBC_NONSHARED)
@ -26,5 +26,5 @@ diff -Nrup a/csu/elf-init.c b/csu/elf-init.c
+hidden_undef (__fini_array_start) +hidden_undef (__fini_array_start)
+hidden_undef (__fini_array_end) +hidden_undef (__fini_array_end)
/* These function symbols are provided for the .init/.fini section entry void
points automagically by the linker. */ __libc_csu_init (int argc, char **argv, char **envp)

View File

@ -1,147 +0,0 @@
From c1b97d6d896b1f22fdf5d28471ef7859ec840a57 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Wed, 1 Sep 2010 17:26:15 +0200
Subject: [PATCH] Fix handling of collating symbols in regexps
[BZ #11561]
* posix/regcomp.c (parse_bracket_exp): When looking up collating
elements compare against the byte sequence of it, not its name.
---
ChangeLog | 4 +++
posix/regcomp.c | 72 ++++++++++++++++++++----------------------------------
2 files changed, 31 insertions(+), 45 deletions(-)
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -2772,40 +2772,29 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
/* Local function for parse_bracket_exp used in _LIBC environement.
Seek the collating symbol entry correspondings to NAME.
- Return the index of the symbol in the SYMB_TABLE. */
+ Return the index of the symbol in the SYMB_TABLE,
+ or -1 if not found. */
auto inline int32_t
__attribute ((always_inline))
- seek_collating_symbol_entry (name, name_len)
- const unsigned char *name;
- size_t name_len;
+ seek_collating_symbol_entry (const unsigned char *name, size_t name_len)
{
- int32_t hash = elem_hash ((const char *) name, name_len);
- int32_t elem = hash % table_size;
- if (symb_table[2 * elem] != 0)
- {
- int32_t second = hash % (table_size - 2) + 1;
-
- do
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- /* Compare the length of the name. */
- && name_len == extra[symb_table[2 * elem + 1]]
- /* Compare the name. */
- && memcmp (name, &extra[symb_table[2 * elem + 1] + 1],
- name_len) == 0)
- {
- /* Yep, this is the entry. */
- break;
- }
+ int32_t elem;
- /* Next entry. */
- elem += second;
- }
- while (symb_table[2 * elem] != 0);
- }
- return elem;
+ for (elem = 0; elem < table_size; elem++)
+ if (symb_table[2 * elem] != 0)
+ {
+ int32_t idx = symb_table[2 * elem + 1];
+ /* Skip the name of collating element name. */
+ idx += 1 + extra[idx];
+ if (/* Compare the length of the name. */
+ name_len == extra[idx]
+ /* Compare the name. */
+ && memcmp (name, &extra[idx + 1], name_len) == 0)
+ /* Yep, this is the entry. */
+ return elem;
+ }
+ return -1;
}
/* Local function for parse_bracket_exp used in _LIBC environment.
@@ -2814,8 +2803,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
auto inline unsigned int
__attribute ((always_inline))
- lookup_collation_sequence_value (br_elem)
- bracket_elem_t *br_elem;
+ lookup_collation_sequence_value (bracket_elem_t *br_elem)
{
if (br_elem->type == SB_CHAR)
{
@@ -2843,7 +2831,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
int32_t elem, idx;
elem = seek_collating_symbol_entry (br_elem->opr.name,
sym_name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
@@ -2861,7 +2849,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
/* Return the collation sequence value. */
return *(unsigned int *) (extra + idx);
}
- else if (symb_table[2 * elem] == 0 && sym_name_len == 1)
+ else if (sym_name_len == 1)
{
/* No valid character. Match it as a single byte
character. */
@@ -2883,11 +2871,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
auto inline reg_errcode_t
__attribute ((always_inline))
- build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem)
- re_charset_t *mbcset;
- int *range_alloc;
- bitset_t sbcset;
- bracket_elem_t *start_elem, *end_elem;
+ build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc,
+ bracket_elem_t *start_elem, bracket_elem_t *end_elem)
{
unsigned int ch;
uint32_t start_collseq;
@@ -2966,25 +2951,22 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
auto inline reg_errcode_t
__attribute ((always_inline))
- build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name)
- re_charset_t *mbcset;
- int *coll_sym_alloc;
- bitset_t sbcset;
- const unsigned char *name;
+ build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
+ int *coll_sym_alloc, const unsigned char *name)
{
int32_t elem, idx;
size_t name_len = strlen ((const char *) name);
if (nrules != 0)
{
elem = seek_collating_symbol_entry (name, name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
/* Skip the name of collating element name. */
idx += 1 + extra[idx];
}
- else if (symb_table[2 * elem] == 0 && name_len == 1)
+ else if (name_len == 1)
{
/* No valid character, treat it as a normal
character. */

View File

@ -5,7 +5,7 @@ diff -Nrup a/stdio-common/Makefile b/stdio-common/Makefile
bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \ bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \ scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \ bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
- bug25 tst-printf-round - bug25 tst-printf-round bug26
+ bug25 tst-printf-round bug23-2 bug23-3 + bug25 tst-printf-round bug23-2 bug23-3
test-srcs = tst-unbputc tst-printf test-srcs = tst-unbputc tst-printf
@ -45165,9 +45165,9 @@ diff -Nrup a/stdio-common/bug23-3.c b/stdio-common/bug23-3.c
+#include "../test-skeleton.c" +#include "../test-skeleton.c"
+ +
diff -Nrup a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c diff -Nrup a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
--- a/stdio-common/vfprintf.c 2012-09-14 14:31:29.000000000 -0600 --- a/stdio-common/vfprintf.c 2013-06-04 16:40:55.000000000 +0530
+++ b/stdio-common/vfprintf.c 2012-09-14 14:41:27.891840141 -0600 +++ b/stdio-common/vfprintf.c 2013-06-04 21:17:10.648403112 +0530
@@ -243,6 +243,12 @@ vfprintf (FILE *s, const CHAR_T *format, @@ -263,6 +263,12 @@ vfprintf (FILE *s, const CHAR_T *format,
/* For the argument descriptions, which may be allocated on the heap. */ /* For the argument descriptions, which may be allocated on the heap. */
void *args_malloced = NULL; void *args_malloced = NULL;
@ -45180,7 +45180,7 @@ diff -Nrup a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
/* This table maps a character into a number representing a /* This table maps a character into a number representing a
class. In each step there is a destination label for each class. In each step there is a destination label for each
class. */ class. */
@@ -1685,8 +1691,8 @@ do_positional: @@ -1672,8 +1678,8 @@ do_positional:
size_t nspecs = 0; size_t nspecs = 0;
/* A more or less arbitrary start value. */ /* A more or less arbitrary start value. */
size_t nspecs_size = 32 * sizeof (struct printf_spec); size_t nspecs_size = 32 * sizeof (struct printf_spec);
@ -45190,7 +45190,7 @@ diff -Nrup a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
/* The number of arguments the format string requests. This will /* The number of arguments the format string requests. This will
determine the size of the array needed to store the argument determine the size of the array needed to store the argument
attributes. */ attributes. */
@@ -1727,10 +1733,25 @@ do_positional: @@ -1715,10 +1721,25 @@ do_positional:
{ {
/* Extend the array of format specifiers. */ /* Extend the array of format specifiers. */
struct printf_spec *old = specs; struct printf_spec *old = specs;
@ -45218,12 +45218,12 @@ diff -Nrup a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
} }
/* Parse the format specifier. */ /* Parse the format specifier. */
@@ -2045,6 +2066,8 @@ do_positional: @@ -2039,6 +2060,8 @@ do_positional:
} }
all_done: all_done:
+ if (specs_malloced) + if (specs_malloced)
+ free (specs); + free (specs);
free (args_malloced); if (__glibc_unlikely (args_malloced != NULL))
free (workstart); free (args_malloced);
/* Unlock the stream. */ if (__glibc_unlikely (workstart != NULL))

View File

@ -1,61 +0,0 @@
diff -Nrup a/nis/yp_xdr.c b/nis/yp_xdr.c
--- a/nis/yp_xdr.c 2012-12-24 22:02:13.000000000 -0500
+++ b/nis/yp_xdr.c 2013-04-17 15:26:50.168999686 -0400
@@ -32,6 +32,14 @@
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
+/* The specification suggests 1024 as a maximum length of all fields,
+ but current linux systems usually don't use any limits. So, to stay
+ as much compatible as possible with recent linux systems we choose
+ limits large enough to avoid problems. */
+
+#define XDRMAXNAME 1024
+#define XDRMAXRECORD 16 * 1024 * 1024
+
bool_t
xdr_ypstat (XDR *xdrs, ypstat *objp)
{
@@ -49,21 +57,21 @@ libnsl_hidden_def (xdr_ypxfrstat)
bool_t
xdr_domainname (XDR *xdrs, domainname *objp)
{
- return xdr_string (xdrs, objp, YPMAXDOMAIN);
+ return xdr_string (xdrs, objp, XDRMAXNAME);
}
libnsl_hidden_def (xdr_domainname)
bool_t
xdr_mapname (XDR *xdrs, mapname *objp)
{
- return xdr_string (xdrs, objp, YPMAXMAP);
+ return xdr_string (xdrs, objp, XDRMAXNAME);
}
libnsl_hidden_def (xdr_mapname)
bool_t
xdr_peername (XDR *xdrs, peername *objp)
{
- return xdr_string (xdrs, objp, YPMAXPEER);
+ return xdr_string (xdrs, objp, XDRMAXNAME);
}
libnsl_hidden_def (xdr_peername)
@@ -71,7 +79,7 @@ bool_t
xdr_keydat (XDR *xdrs, keydat *objp)
{
return xdr_bytes (xdrs, (char **) &objp->keydat_val,
- (u_int *) &objp->keydat_len, YPMAXRECORD);
+ (u_int *) &objp->keydat_len, XDRMAXRECORD);
}
libnsl_hidden_def (xdr_keydat)
@@ -79,7 +87,7 @@ bool_t
xdr_valdat (XDR *xdrs, valdat *objp)
{
return xdr_bytes (xdrs, (char **) &objp->valdat_val,
- (u_int *) &objp->valdat_len, YPMAXRECORD);
+ (u_int *) &objp->valdat_len, XDRMAXRECORD);
}
libnsl_hidden_def (xdr_valdat)

View File

@ -1,95 +0,0 @@
#
# Red Hat BZ:
# https://bugzilla.redhat.com/show_bug.cgi?id=905184
#
# Sourcware BZ:
# http://sourceware.org/bugzilla/show_bug.cgi?id=15006
#
# Upstream submission:
# http://www.sourceware.org/ml/libc-alpha/2013-02/msg00120.html
#
# ChangeLog
#
# 2013-02-07 Carlos O'Donell <carlos@redhat.com>
#
# * sysdeps/generic/ldconfig.h: Define FLAG_ARM_LIBSF.
# * elf/cache.c (print_entry): Add FLAG_ARM_LIBSF support.
#
# ports/ChangeLog.arm
#
# 2013-02-07 Carlos O'Donell <carlos@redhat.com>
#
# * sysdeps/unix/sysv/linux/arm/dl-cache.h
# [__ARM_PCS_VFP] (_dl_cache_check_flags): Allow plain FLAG_ELF_LIBC6.
# [!__ARM_PCS_VFP] (_dl_cache_check_flags): Likewise.
# * sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file):
# Set FLAG_ARM_LIBSF for soft-float ABI otherwise just FLAG_ELF_LIBC6.
#
diff --git a/elf/cache.c b/elf/cache.c
index 9901952..699550b 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -100,6 +100,10 @@ print_entry (const char *lib, int flag, unsigned int osversion,
case FLAG_AARCH64_LIB64:
fputs (",AArch64", stdout);
break;
+ /* Uses the ARM soft-float ABI. */
+ case FLAG_ARM_LIBSF:
+ fputs (",soft-float", stdout);
+ break;
case 0:
break;
default:
diff --git a/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h b/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h
index acc4f28..504feca 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h
@@ -18,12 +18,17 @@
#include <ldconfig.h>
+/* In order to support the transition from unmarked objects
+ to marked objects we must treat unmarked objects as
+ compatible with either FLAG_ARM_LIBHF or FLAG_ARM_LIBSF. */
#ifdef __ARM_PCS_VFP
# define _dl_cache_check_flags(flags) \
- ((flags) == (FLAG_ARM_LIBHF | FLAG_ELF_LIBC6))
+ ((flags) == (FLAG_ARM_LIBHF | FLAG_ELF_LIBC6) \
+ || (flags) == FLAG_ELF_LIBC6)
#else
# define _dl_cache_check_flags(flags) \
- ((flags) == FLAG_ELF_LIBC6)
+ ((flags) == (FLAG_ARM_LIBSF | FLAG_ELF_LIBC6) \
+ || (flags) == FLAG_ELF_LIBC6)
#endif
#include_next <dl-cache.h>
diff --git a/ports/sysdeps/unix/sysv/linux/arm/readelflib.c b/ports/sysdeps/unix/sysv/linux/arm/readelflib.c
index 81e5ccb..3efb613 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/readelflib.c
+++ b/ports/sysdeps/unix/sysv/linux/arm/readelflib.c
@@ -46,6 +46,12 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
*flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
else if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_SOFT)
+ *flag = FLAG_ARM_LIBSF|FLAG_ELF_LIBC6;
+ else
+ /* We must assume the unmarked objects are compatible
+ with all ABI variants. Such objects may have been
+ generated in a transitional period when the ABI
+ tags were not added to all objects. */
*flag = FLAG_ELF_LIBC6;
}
}
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index 57a9a46..91190aa 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -36,6 +36,7 @@
#define FLAG_X8664_LIBX32 0x0800
#define FLAG_ARM_LIBHF 0x0900
#define FLAG_AARCH64_LIB64 0x0a00
+#define FLAG_ARM_LIBSF 0x0b00
/* Name of auxiliary cache. */
#define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"

View File

@ -1,147 +0,0 @@
#
# Backported from upstream.
#
# 2013-02-12 Andreas Schwab <schwab@suse.de>
#
# [BZ #15078]
# * posix/regexec.c (extend_buffers): Add parameter min_len.
# (check_matching): Pass minimum needed length.
# (clean_state_log_if_needed): Likewise.
# (get_subexp): Likewise.
# * posix/Makefile (tests): Add bug-regex34.
# (bug-regex34-ENV): Define.
# * posix/bug-regex34.c: New file.
#
--- glibc-2.17-c758a686/posix/Makefile 2012-12-24 22:02:13.000000000 -0500
+++ glibc-2.17-c758a686/posix/Makefile 2013-03-17 15:30:13.121068666 -0400
@@ -86,7 +86,7 @@
tst-rfc3484-3 \
tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
- bug-getopt5 tst-getopt_long1
+ bug-getopt5 tst-getopt_long1 bug-regex34
xtests := bug-ga2
ifeq (yes,$(build-shared))
test-srcs := globtest
@@ -195,6 +195,7 @@
bug-regex30-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex32-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex33-ENV = LOCPATH=$(common-objpfx)localedata
+bug-regex34-ENV = LOCPATH=$(common-objpfx)localedata
tst-rxspencer-ARGS = --utf8 rxspencer/tests
tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
tst-pcre-ARGS = PCRE.tests
diff --git a/posix/bug-regex34.c b/posix/bug-regex34.c
new file mode 100644
index 0000000..bb3b613
--- /dev/null
+++ b/posix/bug-regex34.c
@@ -0,0 +1,46 @@
+/* Test re_search with multi-byte characters in UTF-8.
+ Copyright (C) 2013 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define _GNU_SOURCE 1
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <regex.h>
+
+static int
+do_test (void)
+{
+ struct re_pattern_buffer r;
+ /* ကျွန်ုပ်x */
+ const char *s = "\xe1\x80\x80\xe1\x80\xbb\xe1\x80\xbd\xe1\x80\x94\xe1\x80\xba\xe1\x80\xaf\xe1\x80\x95\xe1\x80\xbax";
+
+ if (setlocale (LC_ALL, "en_US.UTF-8") == NULL)
+ {
+ puts ("setlocale failed");
+ return 1;
+ }
+ memset (&r, 0, sizeof (r));
+
+ re_compile_pattern ("[^x]x", 5, &r);
+ /* This was triggering a buffer overflow. */
+ re_search (&r, s, strlen (s), 0, strlen (s), 0);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/regexec.c b/posix/regexec.c
index 7f2de85..5ca2bf6 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -197,7 +197,7 @@ static int group_nodes_into_DFAstates (const re_dfa_t *dfa,
static int check_node_accept (const re_match_context_t *mctx,
const re_token_t *node, int idx)
internal_function;
-static reg_errcode_t extend_buffers (re_match_context_t *mctx)
+static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len)
internal_function;
/* Entry point for POSIX code. */
@@ -1160,7 +1160,7 @@ check_matching (re_match_context_t *mctx, int fl_longest_match,
|| (BE (next_char_idx >= mctx->input.valid_len, 0)
&& mctx->input.valid_len < mctx->input.len))
{
- err = extend_buffers (mctx);
+ err = extend_buffers (mctx, next_char_idx + 1);
if (BE (err != REG_NOERROR, 0))
{
assert (err == REG_ESPACE);
@@ -1738,7 +1738,7 @@ clean_state_log_if_needed (re_match_context_t *mctx, int next_state_log_idx)
&& mctx->input.valid_len < mctx->input.len))
{
reg_errcode_t err;
- err = extend_buffers (mctx);
+ err = extend_buffers (mctx, next_state_log_idx + 1);
if (BE (err != REG_NOERROR, 0))
return err;
}
@@ -2792,7 +2792,7 @@ get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
if (bkref_str_off >= mctx->input.len)
break;
- err = extend_buffers (mctx);
+ err = extend_buffers (mctx, bkref_str_off + 1);
if (BE (err != REG_NOERROR, 0))
return err;
@@ -4102,7 +4102,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
static reg_errcode_t
internal_function __attribute_warn_unused_result__
-extend_buffers (re_match_context_t *mctx)
+extend_buffers (re_match_context_t *mctx, int min_len)
{
reg_errcode_t ret;
re_string_t *pstr = &mctx->input;
@@ -4111,8 +4111,10 @@ extend_buffers (re_match_context_t *mctx)
if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0))
return REG_ESPACE;
- /* Double the lengthes of the buffers. */
- ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2));
+ /* Double the lengthes of the buffers, but allocate at least MIN_LEN. */
+ ret = re_string_realloc_buffers (pstr,
+ MAX (min_len,
+ MIN (pstr->len, pstr->bufs_len * 2)));
if (BE (ret != REG_NOERROR, 0))
return ret;

View File

@ -24,9 +24,9 @@
diff -urN glibc-2.17-c758a686/string/Makefile tmp/glibc-2.17-c758a686/string/Makefile diff -urN glibc-2.17-c758a686/string/Makefile tmp/glibc-2.17-c758a686/string/Makefile
--- glibc-2.17-c758a686/string/Makefile 2013-02-27 18:07:34.618968703 -0500 --- glibc-2.17-c758a686/string/Makefile 2013-02-27 18:07:34.618968703 -0500
+++ tmp/glibc-2.17-c758a686/string/Makefile 2013-02-27 18:08:16.075796160 -0500 +++ tmp/glibc-2.17-c758a686/string/Makefile 2013-02-27 18:08:16.075796160 -0500
@@ -78,6 +78,14 @@ @@ -72,6 +72,14 @@ CFLAGS-stratcliff.c = -fno-builtin
CFLAGS-bug-strstr1.c = -fno-builtin CFLAGS-test-ffs.c = -fno-builtin
CFLAGS-bug-strcasestr1.c = -fno-builtin CFLAGS-tst-inlcall.c = -fno-builtin
+# Disable any optimization which might result in function calls to the very +# Disable any optimization which might result in function calls to the very
+# same functions we are trying to compile, thus creating an infinite loop. +# same functions we are trying to compile, thus creating an infinite loop.
@ -58,3 +58,4 @@ diff -urN glibc-2.17-c758a686/elf/Makefile tmp/glibc-2.17-c758a686/elf/Makefile
+ +
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names)))) test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
generated += $(addsuffix .so,$(strip $(modules-names))) generated += $(addsuffix .so,$(strip $(modules-names)))

View File

@ -1,55 +0,0 @@
commit 7a86be6e5f18ba99b25d75c555ce56fe1fcea325
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Mar 28 11:45:47 2013 +0530
Don't add input group during initgroups_dyn in hesiod
Fixes BZ #15304.
The *initgroups_dyn functions are called with a group argument. This
group gid is usually skipped while populating the grouplist since the
caller adds that group id in advance.
The hesiod initgroups_dyn implementation however adds the group gid to
the list if it does not already exist. While it works fine for the
usual initgroups, it breaks nscd since it calls initgroups_dyn with -1
as the gid (to have all groups included).
diff --git a/hesiod/nss_hesiod/hesiod-grp.c b/hesiod/nss_hesiod/hesiod-grp.c
index c2ae166..b11952f 100644
--- a/hesiod/nss_hesiod/hesiod-grp.c
+++ b/hesiod/nss_hesiod/hesiod-grp.c
@@ -191,33 +191,6 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
return errno == ENOENT ? NSS_STATUS_NOTFOUND : NSS_STATUS_UNAVAIL;
}
- if (!internal_gid_in_list (groups, group, *start))
- {
- if (__builtin_expect (*start == *size, 0))
- {
- /* Need a bigger buffer. */
- gid_t *newgroups;
- long int newsize;
-
- if (limit > 0 && *size == limit)
- /* We reached the maximum. */
- goto done;
-
- if (limit <= 0)
- newsize = 2 * *size;
- else
- newsize = MIN (limit, 2 * *size);
-
- newgroups = realloc (groups, newsize * sizeof (*groups));
- if (newgroups == NULL)
- goto done;
- *groupsp = groups = newgroups;
- *size = newsize;
- }
-
- groups[(*start)++] = group;
- }
-
save_errno = errno;
p = *list;

View File

@ -1,80 +0,0 @@
2013-05-03 Carlos O'Donell <carlos at redhat.com>
* intl/dcigettext.c (DCIGETTEXT): Skip translating if _nl_find_msg returns -1.
(_nl_find_msg): Return -1 if recursive call returned -1. If newmem is null
return -1.
* intl/loadmsgcat.c (_nl_load_domain): If _nl_find_msg returns -1 abort
loading the domain.
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 110307b..f4aa215 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -638,6 +638,11 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
retval = _nl_find_msg (domain->successor[cnt], binding,
msgid1, 1, &retlen);
+ /* Resource problems are not fatal, instead we return no
+ translation. */
+ if (__builtin_expect (retval == (char *) -1, 0))
+ goto no_translation;
+
if (retval != NULL)
{
domain = domain->successor[cnt];
@@ -941,6 +946,11 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
nullentry =
_nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
+ /* Resource problems are fatal. If we continue onwards we will
+ only attempt to calloc a new conv_tab and fail later. */
+ if (__builtin_expect (nullentry == (char *) -1, 0))
+ return (char *) -1;
+
if (nullentry != NULL)
{
const char *charsetstr;
@@ -1170,10 +1180,14 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
freemem_size = INITIAL_BLOCK_SIZE;
newmem = (transmem_block_t *) malloc (freemem_size);
# ifdef _LIBC
- /* Add the block to the list of blocks we have to free
- at some point. */
- newmem->next = transmem_list;
- transmem_list = newmem;
+ if (newmem != NULL)
+ {
+ /* Add the block to the list of blocks we have to free
+ at some point. */
+ newmem->next = transmem_list;
+ transmem_list = newmem;
+ }
+ /* Fall through and return -1. */
# endif
}
if (__builtin_expect (newmem == NULL, 0))
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index e4b7b38..ac90ed1 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -1237,7 +1237,7 @@ _nl_load_domain (domain_file, domainbinding)
default:
/* This is an invalid revision. */
invalid:
- /* This is an invalid .mo file. */
+ /* This is an invalid .mo file or we ran out of resources. */
free (domain->malloced);
#ifdef HAVE_MMAP
if (use_mmap)
@@ -1257,6 +1257,11 @@ _nl_load_domain (domain_file, domainbinding)
/* Get the header entry and look for a plural specification. */
nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
+ if (__builtin_expect (nullentry == (char *) -1, 0))
+ {
+ __libc_rwlock_fini (domain->conversions_lock);
+ goto invalid;
+ }
EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
out:

View File

@ -1,560 +0,0 @@
diff --git a/elf/Makefile b/elf/Makefile
index c01ca9e..6f40414 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -145,7 +145,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-audit1 tst-audit2 tst-audit8 \
tst-stackguard1 tst-addr1 tst-thrlock \
tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
- tst-initorder tst-initorder2 tst-relsort1
+ tst-initorder tst-initorder2 tst-relsort1 tst-null-argv
# reldep9
test-srcs = tst-pathopt
selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
@@ -208,7 +208,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-initorder2a tst-initorder2b tst-initorder2c \
tst-initorder2d \
tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
- tst-array5dep
+ tst-array5dep tst-null-argv-lib
ifeq (yesyes,$(have-fpie)$(build-shared))
modules-names += tst-piemod1
tests += tst-pie1
@@ -494,7 +494,9 @@ $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera
$(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
$(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
$(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
+$(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
+tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
LDFLAGS-nodel2mod3.so = $(no-as-needed)
LDFLAGS-reldepmod5.so = $(no-as-needed)
LDFLAGS-reldep6mod1.so = $(no-as-needed)
diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c
index d63086d..11e3cd8 100644
--- a/elf/dl-conflict.c
+++ b/elf/dl-conflict.c
@@ -33,8 +33,7 @@ _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
{
#if ! ELF_MACHINE_NO_RELA
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
- _dl_debug_printf ("\nconflict processing: %s\n",
- l->l_name[0] ? l->l_name : rtld_progname);
+ _dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
{
/* Do the conflict relocation of the object and library GOT and other
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index cd1c236..1c36f50 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -310,8 +310,7 @@ _dl_map_object_deps (struct link_map *map,
_dl_debug_printf ("load auxiliary object=%s"
" requested by file=%s\n",
name,
- l->l_name[0]
- ? l->l_name : rtld_progname);
+ DSO_FILENAME (l->l_name));
/* We must be prepared that the addressed shared
object is not available. */
@@ -337,8 +336,7 @@ _dl_map_object_deps (struct link_map *map,
_dl_debug_printf ("load filtered object=%s"
" requested by file=%s\n",
name,
- l->l_name[0]
- ? l->l_name : rtld_progname);
+ DSO_FILENAME (l->l_name));
/* For filter objects the dependency must be available. */
bool malloced;
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 7987845..8257c17 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -119,7 +119,7 @@ _dl_signal_error (int errcode, const char *objname, const char *occation,
/* Lossage while resolving the program's own symbols is always fatal. */
char buffer[1024];
_dl_fatal_printf ("%s: %s: %s%s%s%s%s\n",
- rtld_progname ?: "<program name unknown>",
+ RTLD_PROGNAME,
occation ?: N_("error while loading shared libraries"),
objname, *objname ? ": " : "",
errstring, errcode ? ": " : "",
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index c5d1674..6b245f0 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -237,7 +237,7 @@ _dl_fini (void)
if (__builtin_expect (GLRO(dl_debug_mask)
& DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
- l->l_name[0] ? l->l_name : rtld_progname,
+ DSO_FILENAME (l->l_name),
ns);
/* First see whether an array is given. */
diff --git a/elf/dl-init.c b/elf/dl-init.c
index fe4d2a0..a657eb6 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -54,7 +54,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
/* Print a debug message if wanted. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling init: %s\n\n",
- l->l_name[0] ? l->l_name : rtld_progname);
+ DSO_FILENAME (l->l_name));
/* Now run the local constructors. There are two forms of them:
- the one named by DT_INIT
@@ -110,8 +110,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling preinit: %s\n\n",
- main_map->l_name[0]
- ? main_map->l_name : rtld_progname);
+ DSO_FILENAME (main_map->l_name));
addrs = (ElfW(Addr) *) (preinit_array->d_un.d_ptr + main_map->l_addr);
for (cnt = 0; cnt < i; ++cnt)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index dd182c9..757b6ec 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1651,7 +1651,7 @@ print_search_path (struct r_search_path_elem **list,
if (name != NULL)
_dl_debug_printf_c ("\t\t(%s from file %s)\n", what,
- name[0] ? name : rtld_progname);
+ DSO_FILENAME (name));
else
_dl_debug_printf_c ("\t\t(%s)\n", what);
}
@@ -2124,8 +2124,7 @@ _dl_map_object (struct link_map *loader, const char *name,
_dl_debug_printf ((mode & __RTLD_CALLMAP) == 0
? "\nfile=%s [%lu]; needed by %s [%lu]\n"
: "\nfile=%s [%lu]; dynamically loaded by %s [%lu]\n",
- name, nsid, loader->l_name[0]
- ? loader->l_name : rtld_progname, loader->l_ns);
+ name, nsid, DSO_FILENAME (loader->l_name), loader->l_ns);
#ifdef SHARED
/* Give the auditing libraries a chance to change the name before we
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 68f8dac..39f463e 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -112,8 +112,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
/* Print some debugging info if wanted. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0))
_dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
- undef_name,
- map->l_name[0] ? map->l_name : rtld_progname,
+ undef_name, DSO_FILENAME (map->l_name),
map->l_ns);
/* If the hash table is empty there is nothing to do here. */
@@ -667,10 +666,9 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
_dl_debug_printf ("\
\nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
- map->l_name[0] ? map->l_name : rtld_progname,
+ DSO_FILENAME (map->l_name),
map->l_ns,
- undef_map->l_name[0]
- ? undef_map->l_name : rtld_progname,
+ DSO_FILENAME (undef_map->l_name),
undef_map->l_ns);
}
else
@@ -751,9 +749,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
const char *reference_name = undef_map ? undef_map->l_name : NULL;
/* XXX We cannot translate the message. */
- _dl_signal_cerror (0, (reference_name[0]
- ? reference_name
- : (rtld_progname ?: "<main program>")),
+ _dl_signal_cerror (0, DSO_FILENAME (reference_name),
N_("relocation error"),
make_string ("symbol ", undef_name, ", version ",
version->name,
@@ -780,9 +776,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
? version->name : "");
/* XXX We cannot translate the message. */
- _dl_signal_cerror (0, (reference_name[0]
- ? reference_name
- : (rtld_progname ?: "<main program>")),
+ _dl_signal_cerror (0, DSO_FILENAME (reference_name),
N_("symbol lookup error"),
make_string (undefined_msg, undef_name,
versionstr, versionname));
@@ -912,11 +906,9 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
{
_dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
- (reference_name[0]
- ? reference_name
- : (rtld_progname ?: "<main program>")),
+ DSO_FILENAME (reference_name),
undef_map->l_ns,
- value->m->l_name[0] ? value->m->l_name : rtld_progname,
+ DSO_FILENAME (value->m->l_name),
value->m->l_ns,
protected ? "protected" : "normal", undef_name);
if (version)
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 92fae7f..0f054bf 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -733,7 +733,7 @@ void
_dl_show_scope (struct link_map *l, int from)
{
_dl_debug_printf ("object=%s [%lu]\n",
- *l->l_name ? l->l_name : rtld_progname, l->l_ns);
+ DSO_FILENAME (l->l_name), l->l_ns);
if (l->l_scope != NULL)
for (int scope_cnt = from; l->l_scope[scope_cnt] != NULL; ++scope_cnt)
{
@@ -744,7 +744,7 @@ _dl_show_scope (struct link_map *l, int from)
_dl_debug_printf_c (" %s",
l->l_scope[scope_cnt]->r_list[cnt]->l_name);
else
- _dl_debug_printf_c (" %s", rtld_progname);
+ _dl_debug_printf_c (" %s", RTLD_PROGNAME);
_dl_debug_printf_c ("\n");
}
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 73d98f8..5c54310 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -185,8 +185,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
_dl_debug_printf ("\nrelocation processing: %s%s\n",
- l->l_name[0] ? l->l_name : rtld_progname,
- lazy ? " (lazy)" : "");
+ DSO_FILENAME (l->l_name), lazy ? " (lazy)" : "");
/* DT_TEXTREL is now in level 2 and might phase out at some time.
But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make
@@ -276,7 +275,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
errstring = N_("%s: no PLTREL found in object %s\n");
fatal:
_dl_fatal_printf (errstring,
- rtld_progname ?: "<program name unknown>",
+ RTLD_PROGNAME,
l->l_name);
}
diff --git a/elf/dl-version.c b/elf/dl-version.c
index c02baa0..62be4ae 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -85,7 +85,7 @@ match_symbol (const char *name, Lmid_t ns, ElfW(Word) hash, const char *string,
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS, 0))
_dl_debug_printf ("\
checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
- string, map->l_name[0] ? map->l_name : rtld_progname,
+ string, DSO_FILENAME (map->l_name),
map->l_ns, name, ns);
if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0))
@@ -162,7 +162,7 @@ no version information available (required by ", name, ")");
name, ")");
result = 1;
call_cerror:
- _dl_signal_cerror (0, map->l_name[0] ? map->l_name : rtld_progname,
+ _dl_signal_cerror (0, DSO_FILENAME (map->l_name),
N_("version lookup error"), errstring);
return result;
}
@@ -210,7 +210,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
&buf[sizeof (buf) - 1], 10, 0),
" of Verneed record\n");
call_error:
- _dl_signal_error (errval, *map->l_name ? map->l_name : rtld_progname,
+ _dl_signal_error (errval, DSO_FILENAME (map->l_name),
NULL, errstring);
}
@@ -234,8 +234,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
while (1)
{
/* Match the symbol. */
- result |= match_symbol ((*map->l_name
- ? map->l_name : rtld_progname),
+ result |= match_symbol (DSO_FILENAME (map->l_name),
map->l_ns, aux->vna_hash,
strtab + aux->vna_name,
needed->l_real, verbose,
diff --git a/elf/rtld.c b/elf/rtld.c
index 23238ad..91da88c 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1840,10 +1840,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (_dl_name_match_p (GLRO(dl_trace_prelink), l))
GLRO(dl_trace_prelink_map) = l;
_dl_printf ("\t%s => %s (0x%0*Zx, 0x%0*Zx)",
- l->l_libname->name[0] ? l->l_libname->name
- : rtld_progname ?: "<main program>",
- l->l_name[0] ? l->l_name
- : rtld_progname ?: "<main program>",
+ DSO_FILENAME (l->l_libname->name),
+ DSO_FILENAME (l->l_name),
(int) sizeof l->l_map_start * 2,
(size_t) l->l_map_start,
(int) sizeof l->l_addr * 2,
@@ -2000,8 +1998,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
first = 0;
}
- _dl_printf ("\t%s:\n",
- map->l_name[0] ? map->l_name : rtld_progname);
+ _dl_printf ("\t%s:\n", DSO_FILENAME (map->l_name));
while (1)
{
@@ -2324,7 +2321,7 @@ print_unresolved (int errcode __attribute__ ((unused)), const char *objname,
const char *errstring)
{
if (objname[0] == '\0')
- objname = rtld_progname ?: "<main program>";
+ objname = RTLD_PROGNAME;
_dl_error_printf ("%s (%s)\n", errstring, objname);
}
@@ -2334,7 +2331,7 @@ static void
print_missing_version (int errcode __attribute__ ((unused)),
const char *objname, const char *errstring)
{
- _dl_error_printf ("%s: %s: %s\n", rtld_progname ?: "<program name unknown>",
+ _dl_error_printf ("%s: %s: %s\n", RTLD_PROGNAME,
objname, errstring);
}
diff --git a/elf/tst-null-argv-lib.c b/elf/tst-null-argv-lib.c
new file mode 100644
index 0000000..e754299
--- /dev/null
+++ b/elf/tst-null-argv-lib.c
@@ -0,0 +1,24 @@
+/* Verify that program does not crash when LD_DEBUG is set and the program name
+ is not available. This is the library.
+ Copyright (C) 2013 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+void
+foo (void)
+{
+ return;
+}
diff --git a/elf/tst-null-argv.c b/elf/tst-null-argv.c
new file mode 100644
index 0000000..dc242e4
--- /dev/null
+++ b/elf/tst-null-argv.c
@@ -0,0 +1,35 @@
+/* Verify that program does not crash when LD_DEBUG is set and the program name
+ is not available.
+ Copyright (C) 2013 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+extern void foo (void);
+
+int
+do_test (int argc, char **argv)
+{
+ argv[0] = argv[1];
+ argc--;
+
+ /* This should result in a symbol lookup, causing a volley of debug output
+ when LD_DEBUG=symbols. */
+ foo ();
+
+ return 0;
+}
+
+#include <test-skeleton.c>
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index c7a20ba..82ab578 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -127,6 +127,11 @@ typedef struct link_map *lookup_t;
| ((PROT_WRITE | PROT_EXEC) << (PF_W | PF_X) * 4) \
| ((PROT_READ | PROT_WRITE | PROT_EXEC) << ((PF_R | PF_W | PF_X) * 4)))
+/* The filename itself, or the main program name, if available. */
+#define DSO_FILENAME(name) ((name)[0] ? (name) \
+ : (rtld_progname ?: "<main program>"))
+
+#define RTLD_PROGNAME (rtld_progname ?: "<program name unknown>")
/* For the version handling we need an array with only names and their
hash values. */
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 0b4c467..b6fc805 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -464,8 +464,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
MIN (sym->st_size, refsym->st_size));
@@ -610,8 +609,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
MIN (sym->st_size, refsym->st_size));
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index bd42fdf..c75c173 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -510,8 +510,7 @@ __process_machine_rela (struct link_map *map,
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr, (char *) finaladdr, MIN (sym->st_size,
refsym->st_size));
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index 14ade21..059fdaf 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -734,8 +734,7 @@ elf_machine_rela (struct link_map *map,
_dl_error_printf ("%s: Symbol `%s' has different size" \
" in shared object," \
" consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (char *) value,
MIN (sym->st_size, refsym->st_size));
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 544f843..aa8f1a5 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -383,8 +383,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
strtab = (const char *) D_PTR(map,l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
MIN (sym->st_size, refsym->st_size));
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index 0504eb6..32f7a2c 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -361,8 +361,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
strtab = (const char *) D_PTR (map,l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
MIN (sym->st_size, refsym->st_size));
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 25cd52a..da7b9c1 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -336,8 +336,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
MIN (sym->st_size, refsym->st_size));
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 71e120f..30f9246 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -411,8 +411,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
MIN (sym->st_size, refsym->st_size));
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index d6d20c7..3bce5d1 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -436,8 +436,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ RTLD_PROGNAME, strtab + refsym->st_name);
}
memcpy (reloc_addr_arg, (void *) value,
MIN (sym->st_size, refsym->st_size));
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 4768c69..116fed1 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -430,9 +430,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
# endif
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
- _dl_error_printf (fmt,
- rtld_progname ?: "<program name unknown>",
- strtab + refsym->st_name);
+ _dl_error_printf (fmt, RTLD_PROGNAME, strtab + refsym->st_name);
}
break;
# ifndef RESOLVE_CONFLICT_FIND_MAP

View File

@ -1,41 +1,42 @@
diff -rup c/sysdeps/ieee754/dbl-64/slowexp.c d/sysdeps/ieee754/dbl-64/slowexp.c diff -rup c/sysdeps/ieee754/dbl-64/slowexp.c d/sysdeps/ieee754/dbl-64/slowexp.c
--- c/sysdeps/ieee754/dbl-64/slowexp.c 2012-05-20 19:47:38.000000000 -0600 --- c/sysdeps/ieee754/dbl-64/slowexp.c 2013-06-04 16:40:55.000000000 +0530
+++ d/sysdeps/ieee754/dbl-64/slowexp.c 2012-05-21 10:02:51.693957300 -0600 +++ d/sysdeps/ieee754/dbl-64/slowexp.c 2013-06-04 21:02:49.377439607 +0530
@@ -30,6 +30,8 @@ @@ -29,6 +29,8 @@
#include "mpa.h" /**************************************************************************/
#include <math_private.h> #include <math_private.h>
+#include <stap-probe.h> +#include <stap-probe.h>
+ +
#ifndef SECTION #ifndef USE_LONG_DOUBLE_FOR_MP
# define SECTION # include "mpa.h"
#endif void __mpexp (mp_no *x, mp_no *y, int p);
@@ -60,12 +62,21 @@ __slowexp(double x) { @@ -60,13 +62,22 @@ __slowexp (double x)
__sub(&mpy,&mpcor,&mpz,p); __mp_dbl (&mpw, &w, p);
__mp_dbl(&mpw, &w, p); __mp_dbl (&mpz, &z, p);
__mp_dbl(&mpz, &z, p); if (w == z)
- if (w == z) return w; - return w;
+ if (w == z) { + {
+ /* Track how often we get to the slow exp code plus + /* Track how often we get to the slow exp code plus
+ its input/output values. */ + its input/output values. */
+ LIBC_PROBE (slowexp_p6, 2, &x, &w); + LIBC_PROBE (slowexp_p6, 2, &x, &w);
+ return w; + return w;
+ } + }
else { /* if calculating is not exactly */ else
p = 32; {
__dbl_mp(x,&mpx,p); p = 32;
__mpexp(&mpx, &mpy, p); __dbl_mp (x, &mpx, p);
__mp_dbl(&mpy, &res, p); __mpexp (&mpx, &mpy, p);
__mp_dbl (&mpy, &res, p);
+ +
+ /* Track how often we get to the uber-slow exp code plus + /* Track how often we get to the uber-slow exp code plus
+ its input/output values. */ + its input/output values. */
+ LIBC_PROBE (slowexp_p32, 2, &x, &res); + LIBC_PROBE (slowexp_p32, 2, &x, &res);
return res; return res;
} }
} #else
diff -rup c/sysdeps/ieee754/dbl-64/slowpow.c d/sysdeps/ieee754/dbl-64/slowpow.c diff -rup c/sysdeps/ieee754/dbl-64/slowpow.c d/sysdeps/ieee754/dbl-64/slowpow.c
--- c/sysdeps/ieee754/dbl-64/slowpow.c 2012-05-20 19:47:38.000000000 -0600 --- c/sysdeps/ieee754/dbl-64/slowpow.c 2013-06-04 16:40:55.000000000 +0530
+++ d/sysdeps/ieee754/dbl-64/slowpow.c 2012-05-21 10:02:51.694957291 -0600 +++ d/sysdeps/ieee754/dbl-64/slowpow.c 2013-06-04 21:05:21.776433149 +0530
@@ -34,6 +34,8 @@ @@ -34,6 +34,8 @@
#include "mpa.h" #include "mpa.h"
#include <math_private.h> #include <math_private.h>
@ -45,28 +46,28 @@ diff -rup c/sysdeps/ieee754/dbl-64/slowpow.c d/sysdeps/ieee754/dbl-64/slowpow.c
#ifndef SECTION #ifndef SECTION
# define SECTION # define SECTION
#endif #endif
@@ -65,7 +67,12 @@ __slowpow(double x, double y, double z) @@ -97,7 +99,12 @@ __slowpow (double x, double y, double z)
__mp_dbl(&mpr, &res, p); __sub (&mpp, &eps, &mpr1, p);
__sub(&mpp,&eps,&mpr1,p); /* pp -eps =r1 */ __mp_dbl (&mpr1, &res1, p);
__mp_dbl(&mpr1, &res1, p); /* converting into double precision */ if (res == res1)
- if (res == res1) return res; - return res;
+ if (res == res1) { + {
+ /* Track how often we get to the slow pow code plus + /* Track how often we get to the slow pow code plus
+ its input/output values. */ + its input/output values. */
+ LIBC_PROBE (slowpow_p6, 4, &x, &y, &z, &res); + LIBC_PROBE (slowpow_p6, 4, &x, &y, &z, &res);
+ return res; + return res;
+ } + }
p = 32; /* if we get here result wasn't calculated exactly, continue */ /* If we don't, then we repeat using a higher precision. 768 bits of
__dbl_mp(x,&mpx,p); /* for more exact calculation */ precision ought to be enough for anybody. */
@@ -75,5 +82,10 @@ __slowpow(double x, double y, double z) @@ -109,5 +116,10 @@ __slowpow (double x, double y, double z)
__mul(&mpy,&mpz,&mpw,p); /* y*z =w */ __mul (&mpy, &mpz, &mpw, p);
__mpexp(&mpw, &mpp, p); /* e^w=pp */ __mpexp (&mpw, &mpp, p);
__mp_dbl(&mpp, &res, p); /* converting into double precision */ __mp_dbl (&mpp, &res, p);
+ +
+ /* Track how often we get to the uber-slow pow code plus + /* Track how often we get to the uber-slow pow code plus
+ its input/output values. */ + its input/output values. */
+ LIBC_PROBE (slowpow_p32, 4, &x, &y, &z, &res); + LIBC_PROBE (slowpow_p32, 4, &x, &y, &z, &res);
+ +
return res; return res;
} }

View File

@ -1,5 +1,5 @@
%define glibcsrcdir glibc-2.17-c758a686 %define glibcsrcdir glibc-2.17-757-g96df079
%define glibcversion 2.17 %define glibcversion 2.17.90
### glibc.spec.in follows: ### glibc.spec.in follows:
%define run_glibc_tests 1 %define run_glibc_tests 1
%define auxarches athlon alphaev6 %define auxarches athlon alphaev6
@ -27,7 +27,7 @@
Summary: The GNU libc libraries Summary: The GNU libc libraries
Name: glibc Name: glibc
Version: %{glibcversion} Version: %{glibcversion}
Release: 9%{?dist} Release: 1%{?dist}
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries. # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
# Things that are linked directly into dynamically linked programs # Things that are linked directly into dynamically linked programs
# and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@ -63,7 +63,6 @@ Source1: %{glibcsrcdir}-releng.tar.gz
# change this. # change this.
Patch0001: %{name}-fedora-nscd.patch Patch0001: %{name}-fedora-nscd.patch
Patch0002: %{name}-fedora-regcomp-sw11561.patch
Patch0003: %{name}-fedora-ldd.patch Patch0003: %{name}-fedora-ldd.patch
Patch0004: %{name}-fedora-ppc-unwind.patch Patch0004: %{name}-fedora-ppc-unwind.patch
@ -108,17 +107,11 @@ Patch0034: %{name}-fedora-elf-init-hidden_undef.patch
# Needs to be sent upstream # Needs to be sent upstream
Patch0035: %{name}-rh911307.patch Patch0035: %{name}-rh911307.patch
Patch0036: %{name}-rh892777.patch
Patch0037: %{name}-rh952799.patch Patch0037: %{name}-rh952799.patch
Patch0038: %{name}-rh959034.patch
# #
# Patches from upstream # Patches from upstream
# #
# Upstream BZ 15078
Patch2029: %{name}-rh905877.patch
Patch1030: %{name}-rh921760.patch
# #
# Patches submitted, but not yet approved upstream. # Patches submitted, but not yet approved upstream.
@ -147,12 +140,6 @@ Patch2026: %{name}-rh841787.patch
# Upstream BZ 14185 # Upstream BZ 14185
Patch2027: %{name}-rh819430.patch Patch2027: %{name}-rh819430.patch
# Upstream BZ 15006
Patch2028: %{name}-rh905184.patch
# Upstream BZ 15465
Patch2039: %{name}-rh961238.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: glibc-profile < 2.4 Obsoletes: glibc-profile < 2.4
Obsoletes: nss_db Obsoletes: nss_db
@ -377,7 +364,6 @@ package or when debugging this package.
%setup -q -n %{glibcsrcdir} -b1 %setup -q -n %{glibcsrcdir} -b1
%patch0001 -p1 %patch0001 -p1
%patch0002 -p1
%patch0003 -p1 %patch0003 -p1
%patch0004 -p1 %patch0004 -p1
%patch0005 -p1 %patch0005 -p1
@ -410,14 +396,8 @@ package or when debugging this package.
%patch0032 -p1 %patch0032 -p1
%patch0033 -p1 %patch0033 -p1
%patch0034 -p1 %patch0034 -p1
%patch2028 -p1
%patch0035 -p1 %patch0035 -p1
%patch0036 -p1
%patch0037 -p1 %patch0037 -p1
%patch2029 -p1
%patch1030 -p1
%patch0038 -p1
%patch2039 -p1
# On powerpc32, hp timing is only available in power4/power6 # On powerpc32, hp timing is only available in power4/power6
# libs, not in base, so pre-power4 dynamic linker is incompatible # libs, not in base, so pre-power4 dynamic linker is incompatible
@ -1217,6 +1197,9 @@ rm -f *.filelist*
%endif %endif
%changelog %changelog
* Tue Jun 4 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.17.90-1
- Resync with upstream master.
* Tue May 14 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.17-9 * Tue May 14 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.17-9
- Avoid crashing in LD_DEBUG when program name is unavailable (#961238). - Avoid crashing in LD_DEBUG when program name is unavailable (#961238).

View File

@ -1,2 +1,2 @@
a0eee6c5a6ed680b723f2247576d4232 glibc-2.17-c758a686-releng.tar.gz caa90cd9da8f21559e2d548b91ce55a3 glibc-2.17-757-g96df079.tar.gz
d91ac2e9667310fa815c2316d542567e glibc-2.17-c758a686.tar.gz f95967f50dfad07b8afe06f7358a80c9 glibc-2.17-757-g96df079-releng.tar.gz