mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-09 05:59:27 +08:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
943515f05c | ||
|
|
54a051b62c | ||
|
|
996cf2ef07 | ||
|
|
fbd64d7ff2 | ||
|
|
21afa712db | ||
|
|
ad05c6671f | ||
|
|
1f636cc82b | ||
|
|
e283e1d04c |
@@ -1,3 +1,57 @@
|
||||
2011-05-30 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12454]
|
||||
* elf/dl-deps.c (_dl_map_object_deps): Run initializer sorting only
|
||||
when there are multiple maps.
|
||||
* elf/dl-fini.c (_dl_sort_fini): Check for list of one.
|
||||
(_dl_fini): Remove test here.
|
||||
|
||||
* elf/rtld.c (dl_main): Don't allow the loader to load itself.
|
||||
|
||||
2011-02-06 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
[BZ #12653]
|
||||
* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: Only protect
|
||||
MEMCPY_CHK with USE_AS_BCOPY ifdef check.
|
||||
* sysdeps/i386/i686/multiarch/memcpy-ssse3.S: Likewise.
|
||||
* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
|
||||
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
|
||||
|
||||
2010-09-28 Andreas Schwab <schwab@redhat.com>
|
||||
Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12489]
|
||||
* elf/rtld.c (dl_main): Move setting of GLRO(dl_init_all_dirs)
|
||||
before performing relro protection. At old place add assertion
|
||||
to make sure nothing changed.
|
||||
|
||||
2011-02-16 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
|
||||
(INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int)
|
||||
cast from r3.
|
||||
* sysdeps/wordsize-64/Makefile: New file. Add tst-writev to
|
||||
'tests' variable.
|
||||
* sysdeps/wordsize-64/tst-writev.c: New file.
|
||||
|
||||
2011-02-15 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds
|
||||
-mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and
|
||||
insns in _dl_start to prevent a TOC reference before relocs are
|
||||
resolved.
|
||||
|
||||
2011-02-02 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* elf/dl-runtime.c (_dl_call_pltexit): Pass correct address of the
|
||||
function to the callback.
|
||||
Patch partly by Jiri Olsa <jolsa@redhat.com>.
|
||||
|
||||
2011-02-02 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* shadow/sgetspent.c: Check return value of __sgetspent_r instead
|
||||
of errno.
|
||||
|
||||
2011-01-19 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #11724]
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
GNU C Library NEWS -- history of user-visible changes. 2011-1-19
|
||||
GNU C Library NEWS -- history of user-visible changes. 2011-5-30
|
||||
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
|
||||
Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
|
||||
using `glibc' in the "product" field.
|
||||
|
||||
Version 2.1
|
||||
|
||||
* The following bugs are resolved with this release:
|
||||
|
||||
11724
|
||||
|
||||
Version 2.13
|
||||
|
||||
* The following bugs are resolved with this release:
|
||||
@@ -19,7 +13,7 @@ Version 2.13
|
||||
11655, 11701, 11840, 11856, 11883, 11903, 11904, 11968, 11979, 12005,
|
||||
12037, 12067, 12077, 12078, 12092, 12093, 12107, 12108, 12113, 12140,
|
||||
12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348, 12378,
|
||||
12394, 12397
|
||||
12394, 12397, 12489, 12653, 12454
|
||||
|
||||
* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
|
||||
|
||||
|
||||
+47
-44
@@ -613,61 +613,64 @@ Filters not supported with LD_TRACE_PRELINKING"));
|
||||
map->l_searchlist.r_list[i]->l_reserved = 0;
|
||||
}
|
||||
|
||||
/* Now determine the order in which the initialization has to happen. */
|
||||
/* Sort the initializer list to take dependencies into account. The binary
|
||||
itself will always be initialize last. */
|
||||
memcpy (l_initfini, map->l_searchlist.r_list,
|
||||
nlist * sizeof (struct link_map *));
|
||||
|
||||
/* We can skip looking for the binary itself which is at the front
|
||||
of the search list. */
|
||||
assert (nlist > 1);
|
||||
i = 1;
|
||||
bool seen[nlist];
|
||||
memset (seen, false, nlist * sizeof (seen[0]));
|
||||
while (1)
|
||||
if (__builtin_expect (nlist > 1, 1))
|
||||
{
|
||||
/* Keep track of which object we looked at this round. */
|
||||
seen[i] = true;
|
||||
struct link_map *thisp = l_initfini[i];
|
||||
|
||||
/* Find the last object in the list for which the current one is
|
||||
a dependency and move the current object behind the object
|
||||
with the dependency. */
|
||||
unsigned int k = nlist - 1;
|
||||
while (k > i)
|
||||
/* We can skip looking for the binary itself which is at the front
|
||||
of the search list. */
|
||||
i = 1;
|
||||
bool seen[nlist];
|
||||
memset (seen, false, nlist * sizeof (seen[0]));
|
||||
while (1)
|
||||
{
|
||||
struct link_map **runp = l_initfini[k]->l_initfini;
|
||||
if (runp != NULL)
|
||||
/* Look through the dependencies of the object. */
|
||||
while (*runp != NULL)
|
||||
if (__builtin_expect (*runp++ == thisp, 0))
|
||||
{
|
||||
/* Move the current object to the back past the last
|
||||
object with it as the dependency. */
|
||||
memmove (&l_initfini[i], &l_initfini[i + 1],
|
||||
(k - i) * sizeof (l_initfini[0]));
|
||||
l_initfini[k] = thisp;
|
||||
/* Keep track of which object we looked at this round. */
|
||||
seen[i] = true;
|
||||
struct link_map *thisp = l_initfini[i];
|
||||
|
||||
if (seen[i + 1])
|
||||
/* Find the last object in the list for which the current one is
|
||||
a dependency and move the current object behind the object
|
||||
with the dependency. */
|
||||
unsigned int k = nlist - 1;
|
||||
while (k > i)
|
||||
{
|
||||
struct link_map **runp = l_initfini[k]->l_initfini;
|
||||
if (runp != NULL)
|
||||
/* Look through the dependencies of the object. */
|
||||
while (*runp != NULL)
|
||||
if (__builtin_expect (*runp++ == thisp, 0))
|
||||
{
|
||||
++i;
|
||||
goto next_clear;
|
||||
/* Move the current object to the back past the last
|
||||
object with it as the dependency. */
|
||||
memmove (&l_initfini[i], &l_initfini[i + 1],
|
||||
(k - i) * sizeof (l_initfini[0]));
|
||||
l_initfini[k] = thisp;
|
||||
|
||||
if (seen[i + 1])
|
||||
{
|
||||
++i;
|
||||
goto next_clear;
|
||||
}
|
||||
|
||||
memmove (&seen[i], &seen[i + 1],
|
||||
(k - i) * sizeof (seen[0]));
|
||||
seen[k] = true;
|
||||
|
||||
goto next;
|
||||
}
|
||||
|
||||
memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
|
||||
seen[k] = true;
|
||||
--k;
|
||||
}
|
||||
|
||||
goto next;
|
||||
}
|
||||
if (++i == nlist)
|
||||
break;
|
||||
next_clear:
|
||||
memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
|
||||
|
||||
--k;
|
||||
next:;
|
||||
}
|
||||
|
||||
if (++i == nlist)
|
||||
break;
|
||||
next_clear:
|
||||
memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
|
||||
|
||||
next:;
|
||||
}
|
||||
|
||||
/* Terminate the list of dependencies. */
|
||||
|
||||
+6
-4
@@ -33,9 +33,12 @@ internal_function
|
||||
_dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps,
|
||||
char *used, Lmid_t ns)
|
||||
{
|
||||
/* A list of one element need not be sorted. */
|
||||
if (nmaps == 1)
|
||||
return;
|
||||
|
||||
/* We can skip looking for the binary itself which is at the front
|
||||
of the search list for the main namespace. */
|
||||
assert (nmaps > 1);
|
||||
unsigned int i = ns == LM_ID_BASE;
|
||||
bool seen[nmaps];
|
||||
memset (seen, false, nmaps * sizeof (seen[0]));
|
||||
@@ -195,9 +198,8 @@ _dl_fini (void)
|
||||
assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
|
||||
nmaps = i;
|
||||
|
||||
if (nmaps > 1)
|
||||
/* Now we have to do the sorting. */
|
||||
_dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
|
||||
/* Now we have to do the sorting. */
|
||||
_dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
|
||||
|
||||
/* We do not rely on the linked list of loaded object anymore from
|
||||
this point on. We have our own list here (maps). The various
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/* On-demand PLT fixup for shared objects.
|
||||
Copyright (C) 1995-2009, 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2009, 2010, 2011 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
|
||||
@@ -446,6 +446,7 @@ _dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_arg,
|
||||
|
||||
/* Set up the sym parameter. */
|
||||
ElfW(Sym) sym = *defsym;
|
||||
sym.st_value = DL_FIXUP_VALUE_ADDR (reloc_result->addr);
|
||||
|
||||
/* Get the symbol name. */
|
||||
const char *strtab = (const void *) D_PTR (reloc_result->bound,
|
||||
|
||||
+7
-4
@@ -1,5 +1,5 @@
|
||||
/* Run time dynamic linker.
|
||||
Copyright (C) 1995-2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2010, 2011 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
|
||||
@@ -2179,6 +2179,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
we need it in the memory handling later. */
|
||||
GLRO(dl_initial_searchlist) = *GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist;
|
||||
|
||||
/* Remember the last search directory added at startup, now that
|
||||
malloc will no longer be the one from dl-minimal.c. */
|
||||
GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
|
||||
|
||||
if (prelinked)
|
||||
{
|
||||
if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL)
|
||||
@@ -2298,9 +2302,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
lossage);
|
||||
}
|
||||
|
||||
/* Remember the last search directory added at startup, now that
|
||||
malloc will no longer be the one from dl-minimal.c. */
|
||||
GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
|
||||
/* Make sure no new search directories have been added. */
|
||||
assert (GLRO(dl_init_all_dirs) == GL(dl_all_dirs));
|
||||
|
||||
if (! prelinked && rtld_multiple_ref)
|
||||
{
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997, 2011 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
|
||||
@@ -49,8 +49,8 @@ sgetspent (const char *string)
|
||||
}
|
||||
|
||||
while (buffer != NULL
|
||||
&& __sgetspent_r (string, &resbuf, buffer, buffer_size, &result) != 0
|
||||
&& errno == ERANGE)
|
||||
&& (__sgetspent_r (string, &resbuf, buffer, buffer_size, &result)
|
||||
== ERANGE))
|
||||
{
|
||||
char *new_buf;
|
||||
buffer_size += BUFLEN_SPWD;
|
||||
|
||||
@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
|
||||
#endif
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
||||
|
||||
@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
|
||||
#endif
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
ifeq ($(subdir),elf)
|
||||
# Prevent the use of VSX registers and insns in _dl_start, which under -O3
|
||||
# optimization may require a TOC reference before relocations are resolved.
|
||||
CFLAGS-rtld.c += -mno-vsx
|
||||
endif
|
||||
@@ -172,7 +172,7 @@
|
||||
: "r9", "r10", "r11", "r12", \
|
||||
"cr0", "ctr", "lr", "memory"); \
|
||||
err = (long int) r0; \
|
||||
(int) r3; \
|
||||
r3; \
|
||||
})
|
||||
|
||||
#undef INLINE_SYSCALL
|
||||
@@ -219,7 +219,7 @@
|
||||
: "r9", "r10", "r11", "r12", \
|
||||
"cr0", "ctr", "memory"); \
|
||||
err = r0; \
|
||||
(int) r3; \
|
||||
r3; \
|
||||
})
|
||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
ifeq ($(subdir),misc)
|
||||
tests += tst-writev
|
||||
|
||||
# Time enough for a large writev syscall to complete.
|
||||
tst-writev-ENV = TIMEOUTFACTOR="10"
|
||||
endif
|
||||
@@ -0,0 +1,107 @@
|
||||
/* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ryan S. Arnold <rsa@us.ibm.com>, 2011.
|
||||
|
||||
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, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <paths.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
|
||||
/* The purpose of this test is to verify that the INTERNAL_[V]SYSCALL_NCS
|
||||
macros on 64-bit platforms don't cast the return type to (int) which would
|
||||
erroneously sign extend the return value should the high bit of the bottom
|
||||
half of the word be '1'. */
|
||||
|
||||
#if 0
|
||||
/* Used to test the non power-of-2 code path. */
|
||||
#undef IOV_MAX
|
||||
#define IOV_MAX 1000
|
||||
#endif
|
||||
|
||||
/* writev() should report that it has written EXPECTED number of bytes. */
|
||||
#define EXPECTED ((size_t) INT32_MAX + 1)
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
struct iovec iv[IOV_MAX];
|
||||
/* POSIX doesn't guarantee that IOV_MAX is pow of 2 but we're optimistic. */
|
||||
size_t bufsz = EXPECTED / IOV_MAX;
|
||||
size_t bufrem = EXPECTED % IOV_MAX;
|
||||
|
||||
/* If there's a remainder then IOV_MAX probably isn't a power of 2 and we
|
||||
need to make bufsz bigger so that the last iovec, iv[IOV_MAX-1], is free
|
||||
for the remainder. */
|
||||
if (bufrem)
|
||||
{
|
||||
bufsz = bufsz + 1;
|
||||
bufrem = EXPECTED - (bufsz * (IOV_MAX - 1));
|
||||
}
|
||||
|
||||
/* We writev to /dev/null since we're just testing writev's return value. */
|
||||
int fd = open (_PATH_DEVNULL, O_WRONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
printf ("Unable to open /dev/null for writing.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
iv[0].iov_base = malloc (bufsz);
|
||||
if (iv[0].iov_base == NULL)
|
||||
{
|
||||
printf ("malloc (%zu) failed.\n", bufsz);
|
||||
close (fd);
|
||||
return -1;
|
||||
}
|
||||
iv[0].iov_len = bufsz;
|
||||
|
||||
/* We optimistically presume that there isn't a remainder and set all iovec
|
||||
instances to the same base and len as the first instance. */
|
||||
for (int i = 1; i < IOV_MAX; i++)
|
||||
{
|
||||
/* We don't care what the data is so reuse the allocation from iv[0]; */
|
||||
iv[i].iov_base = iv[0].iov_base;
|
||||
iv[i].iov_len = iv[0].iov_len;
|
||||
}
|
||||
|
||||
/* If there is a remainder then we correct the last iov_len. */
|
||||
if (bufrem)
|
||||
iv[IOV_MAX - 1].iov_len = bufrem;
|
||||
|
||||
/* Write junk to /dev/null with the writev syscall in order to get a return
|
||||
of INT32_MAX+1 bytes to verify that the INTERNAL_SYSCALL wrappers aren't
|
||||
mangling the result if the signbit of a 32-bit number is set. */
|
||||
ssize_t ret = writev (fd, iv, IOV_MAX);
|
||||
|
||||
free (iv[0].iov_base);
|
||||
close (fd);
|
||||
|
||||
if (ret != (ssize_t) EXPECTED)
|
||||
{
|
||||
printf ("writev() return value: %zd != EXPECTED: %zd\n", ret, EXPECTED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
@@ -49,7 +49,7 @@
|
||||
ud2
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
cmpq %rdx, %rcx
|
||||
jb HIDDEN_JUMPTARGET (__chk_fail)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
ud2
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
cmpq %rdx, %rcx
|
||||
jb HIDDEN_JUMPTARGET (__chk_fail)
|
||||
|
||||
Reference in New Issue
Block a user