- Resync with upstream sources.
This commit is contained in:
parent
9b14d89a52
commit
f7dfce46ed
|
@ -13,3 +13,6 @@ glibc-2.14-394-g8f3b1ff
|
|||
/glibc-ports-2.15-8a70b2d.tar.gz
|
||||
/glibc-2.15-0ea698a.tar.gz
|
||||
/glibc-ports-2.15-ad8ae7d.tar.gz
|
||||
/glibc-2.15.90-8b728fa3.tar.gz
|
||||
/glibc-ports-2.15.90-4645e97.tar.gz
|
||||
/glibc-2.15.90-8b728fa3-fedora.tar.gz
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
diff -rup c/config.h.in d/config.h.in
|
||||
--- c/config.h.in 2012-05-07 09:35:44.844234866 -0600
|
||||
+++ d/config.h.in 2012-05-07 11:53:43.461629793 -0600
|
||||
@@ -230,4 +230,7 @@
|
||||
|
||||
#define HAVE_REGEX 1
|
||||
|
||||
+/* The ARM hard-float ABI is being used. */
|
||||
+#undef HAVE_ARM_PCS_VFP
|
||||
+
|
||||
#endif
|
|
@ -1,42 +0,0 @@
|
|||
diff --git a/sysdeps/arm/configure.in b/sysdeps/arm/configure.in
|
||||
index 706add2..f00b798 100644
|
||||
--- a/sysdeps/arm/configure.in
|
||||
+++ b/sysdeps/arm/configure.in
|
||||
@@ -49,3 +49,20 @@ EOF
|
||||
if test $libc_cv_asm_cfi_directive_sections != yes; then
|
||||
AC_MSG_ERROR([need .cfi_sections in this configuration])
|
||||
fi
|
||||
+
|
||||
+# We check to see if the compiler and flags are
|
||||
+# selecting the hard-float ABI and if they are then
|
||||
+# we set libc_cv_arm_pcs_vfp to yes which causes
|
||||
+# HAVE_ARM_PCS_VFP to be defined in config.h and
|
||||
+# in include/libc-symbols.h and thus available to
|
||||
+# shlib-versions to select the appropriate name for
|
||||
+# the dynamic linker via %ifdef.
|
||||
+AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI],
|
||||
+ [libc_cv_arm_pcs_vfp],
|
||||
+ [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP
|
||||
+ yes
|
||||
+ #endif
|
||||
+ ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
|
||||
+if test $libc_cv_arm_pcs_vfp = yes; then
|
||||
+ AC_DEFINE(HAVE_ARM_PCS_VFP)
|
||||
+fi
|
||||
|
||||
diff -rup c/sysdeps/arm/shlib-versions d/sysdeps/arm/shlib-versions
|
||||
--- c/sysdeps/arm/shlib-versions 2012-01-08 22:47:04.000000000 -0700
|
||||
+++ d/sysdeps/arm/shlib-versions 2012-05-07 11:57:07.739567660 -0600
|
||||
@@ -1,4 +1,10 @@
|
||||
arm.*-.*-linux-gnueabi.* DEFAULT GLIBC_2.4
|
||||
|
||||
-arm.*-.*-linux-gnueabi.* ld=ld-linux.so.3
|
||||
+%ifdef HAVE_ARM_PCS_VFP
|
||||
+# The EABI-derived hard-float ABI uses a new dynamic linker.
|
||||
+arm.*-.*-linux-gnueabi.* ld=ld-linux-armhf.so.3
|
||||
+%else
|
||||
+# The EABI-derived soft-float ABI continues to use ld-linux.so.3.
|
||||
+arm.*-.*-linux-gnueabi.* ld=ld-linux.so.3
|
||||
+%endif
|
||||
arm.*-.*-linux.* ld=ld-linux.so.2
|
||||
|
1702
glibc-fedora.patch
1702
glibc-fedora.patch
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
diff -Nrup a/elf/dl-close.c b/elf/dl-close.c
|
||||
--- a/elf/dl-close.c 2012-01-25 21:49:58.892869984 -0700
|
||||
+++ b/elf/dl-close.c 2012-01-25 21:50:22.283882509 -0700
|
||||
@@ -32,6 +32,7 @@
|
||||
diff -Nrup c/elf/dl-close.c d/elf/dl-close.c
|
||||
--- c/elf/dl-close.c 2012-05-21 00:08:02.410897531 -0600
|
||||
+++ d/elf/dl-close.c 2012-05-21 00:08:40.874716006 -0600
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <tls.h>
|
||||
|
@ -9,7 +9,7 @@ diff -Nrup a/elf/dl-close.c b/elf/dl-close.c
|
|||
|
||||
|
||||
/* Type of the constructor functions. */
|
||||
@@ -469,6 +470,7 @@ _dl_close_worker (struct link_map *map)
|
||||
@@ -468,6 +469,7 @@ _dl_close_worker (struct link_map *map)
|
||||
struct r_debug *r = _dl_debug_initialize (0, nsid);
|
||||
r->r_state = RT_DELETE;
|
||||
_dl_debug_state ();
|
||||
|
@ -17,7 +17,7 @@ diff -Nrup a/elf/dl-close.c b/elf/dl-close.c
|
|||
|
||||
if (unload_global)
|
||||
{
|
||||
@@ -738,6 +740,7 @@ _dl_close_worker (struct link_map *map)
|
||||
@@ -737,6 +739,7 @@ _dl_close_worker (struct link_map *map)
|
||||
/* Notify the debugger those objects are finalized and gone. */
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
|
@ -25,10 +25,10 @@ diff -Nrup a/elf/dl-close.c b/elf/dl-close.c
|
|||
|
||||
/* Recheck if we need to retry, release the lock. */
|
||||
out:
|
||||
diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
||||
--- a/elf/dl-load.c 2012-01-25 21:49:58.895869986 -0700
|
||||
+++ b/elf/dl-load.c 2012-01-25 21:50:22.288882511 -0700
|
||||
@@ -36,6 +36,7 @@
|
||||
diff -Nrup c/elf/dl-load.c d/elf/dl-load.c
|
||||
--- c/elf/dl-load.c 2012-05-21 00:08:02.219898432 -0600
|
||||
+++ d/elf/dl-load.c 2012-05-21 00:08:40.876715997 -0600
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stackinfo.h>
|
||||
#include <caller.h>
|
||||
#include <sysdep.h>
|
||||
|
@ -36,7 +36,7 @@ diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
|||
|
||||
#include <dl-dst.h>
|
||||
|
||||
@@ -881,7 +882,7 @@ _dl_init_paths (const char *llp)
|
||||
@@ -880,7 +881,7 @@ _dl_init_paths (const char *llp)
|
||||
static void
|
||||
__attribute__ ((noreturn, noinline))
|
||||
lose (int code, int fd, const char *name, char *realname, struct link_map *l,
|
||||
|
@ -45,7 +45,7 @@ diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
|||
{
|
||||
/* The file might already be closed. */
|
||||
if (fd != -1)
|
||||
@@ -895,6 +896,7 @@ lose (int code, int fd, const char *name
|
||||
@@ -894,6 +895,7 @@ lose (int code, int fd, const char *name
|
||||
{
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
|
@ -53,7 +53,7 @@ diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
|||
}
|
||||
|
||||
_dl_signal_error (code, name, NULL, msg);
|
||||
@@ -933,7 +935,7 @@ _dl_map_object_from_fd (const char *name
|
||||
@@ -932,7 +934,7 @@ _dl_map_object_from_fd (const char *name
|
||||
errval = errno;
|
||||
call_lose:
|
||||
lose (errval, fd, name, realname, l, errstring,
|
||||
|
@ -62,7 +62,7 @@ diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
|||
}
|
||||
|
||||
/* Look again to see if the real name matched another already loaded. */
|
||||
@@ -1040,6 +1042,7 @@ _dl_map_object_from_fd (const char *name
|
||||
@@ -1039,6 +1041,7 @@ _dl_map_object_from_fd (const char *name
|
||||
linking has not been used before. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
|
@ -70,7 +70,7 @@ diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
|||
make_consistent = true;
|
||||
}
|
||||
else
|
||||
@@ -1735,7 +1738,7 @@ open_verify (const char *name, struct fi
|
||||
@@ -1734,7 +1737,7 @@ open_verify (const char *name, struct fi
|
||||
name = strdupa (realname);
|
||||
free (realname);
|
||||
}
|
||||
|
@ -79,10 +79,10 @@ diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
|||
}
|
||||
|
||||
/* See whether the ELF header is what we expect. */
|
||||
diff -Nrup a/elf/dl-open.c b/elf/dl-open.c
|
||||
--- a/elf/dl-open.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/elf/dl-open.c 2012-01-25 21:50:22.291882514 -0700
|
||||
@@ -33,6 +33,7 @@
|
||||
diff -Nrup c/elf/dl-open.c d/elf/dl-open.c
|
||||
--- c/elf/dl-open.c 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/elf/dl-open.c 2012-05-21 00:11:29.229920776 -0600
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <caller.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <tls.h>
|
||||
|
@ -90,7 +90,7 @@ diff -Nrup a/elf/dl-open.c b/elf/dl-open.c
|
|||
|
||||
#include <dl-dst.h>
|
||||
|
||||
@@ -292,6 +293,7 @@ dl_open_worker (void *a)
|
||||
@@ -291,6 +292,7 @@ dl_open_worker (void *a)
|
||||
struct r_debug *r = _dl_debug_initialize (0, args->nsid);
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
|
@ -98,26 +98,27 @@ diff -Nrup a/elf/dl-open.c b/elf/dl-open.c
|
|||
|
||||
/* Print scope information. */
|
||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
|
||||
@@ -308,10 +310,18 @@ dl_open_worker (void *a)
|
||||
struct link_map *l = new;
|
||||
while (l->l_next)
|
||||
l = l->l_next;
|
||||
@@ -376,10 +378,19 @@ dl_open_worker (void *a)
|
||||
}
|
||||
}
|
||||
|
||||
+ int relocation_in_progress = 0;
|
||||
while (1)
|
||||
+
|
||||
for (size_t i = nmaps; i-- > 0; )
|
||||
{
|
||||
if (! l->l_real->l_relocated)
|
||||
{
|
||||
+ if (! relocation_in_progress)
|
||||
+ {
|
||||
+ /* Notify the debugger that relocations are about to happen. */
|
||||
+ LIBC_PROBE (rtld_reloc_start, 2, args->nsid, r);
|
||||
+ relocation_in_progress = 1;
|
||||
+ }
|
||||
l = maps[i];
|
||||
|
||||
+ if (! relocation_in_progress)
|
||||
+ {
|
||||
+ /* Notify the debugger that relocations are about to happen. */
|
||||
+ LIBC_PROBE (rtld_reloc_start, 2, args->nsid, r);
|
||||
+ relocation_in_progress = 1;
|
||||
+ }
|
||||
+
|
||||
#ifdef SHARED
|
||||
if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
|
||||
{
|
||||
@@ -481,6 +491,10 @@ cannot load any more object with static
|
||||
if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
|
||||
{
|
||||
@@ -544,6 +555,10 @@ cannot load any more object with static
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,10 +129,10 @@ diff -Nrup a/elf/dl-open.c b/elf/dl-open.c
|
|||
/* Run the initializer functions of new objects. */
|
||||
_dl_init (new, args->argc, args->argv, args->env);
|
||||
|
||||
diff -Nrup a/elf/rtld.c b/elf/rtld.c
|
||||
--- a/elf/rtld.c 2012-01-25 21:49:58.898869987 -0700
|
||||
+++ b/elf/rtld.c 2012-01-25 21:53:42.262987201 -0700
|
||||
@@ -40,6 +40,7 @@
|
||||
diff -Nrup c/elf/rtld.c d/elf/rtld.c
|
||||
--- c/elf/rtld.c 2012-05-21 00:08:02.415897505 -0600
|
||||
+++ d/elf/rtld.c 2012-05-21 00:08:40.917715803 -0600
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <dl-osinfo.h>
|
||||
#include <dl-procinfo.h>
|
||||
#include <tls.h>
|
||||
|
@ -139,7 +140,7 @@ diff -Nrup a/elf/rtld.c b/elf/rtld.c
|
|||
#include <stackinfo.h>
|
||||
|
||||
#include <assert.h>
|
||||
@@ -1670,6 +1671,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
@@ -1681,6 +1682,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
/* We start adding objects. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
|
@ -147,7 +148,7 @@ diff -Nrup a/elf/rtld.c b/elf/rtld.c
|
|||
|
||||
/* Auditing checkpoint: we are ready to signal that the initial map
|
||||
is being constructed. */
|
||||
@@ -2382,6 +2384,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
@@ -2398,6 +2400,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
r = _dl_debug_initialize (0, LM_ID_BASE);
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/localedata/locales/ca_ES b/localedata/locales/ca_ES
|
||||
index cd83bcc..3c14340 100644
|
||||
--- a/localedata/locales/ca_ES
|
||||
+++ b/localedata/locales/ca_ES
|
||||
@@ -138,6 +138,8 @@ t_fmt_ampm ""
|
||||
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
|
||||
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
|
||||
<U0025><U005A><U0020><U0025><U0059>"
|
||||
+first_weekday 2
|
||||
+first_workday 2
|
||||
END LC_TIME
|
||||
|
||||
LC_PAPER
|
|
@ -1,13 +0,0 @@
|
|||
diff -rup a/localedata/locales/ru_UA b/localedata/locales/ru_UA
|
||||
--- a/localedata/locales/ru_UA 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/localedata/locales/ru_UA 2012-02-09 22:57:29.698433625 -0700
|
||||
@@ -141,6 +141,8 @@ t_fmt_ampm ""
|
||||
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
|
||||
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
|
||||
<U0025><U005A><U0020><U0025><U0059>"
|
||||
+first_weekday 2
|
||||
+first_workday 2
|
||||
END LC_TIME
|
||||
|
||||
LC_PAPER
|
||||
Only in b/localedata/locales: uk_UA.rej
|
|
@ -1,40 +0,0 @@
|
|||
* malloc/arena.c (arena_get2): Avoid unnecessarily
|
||||
retrieving #cpus from /proc.
|
||||
* malloc/malloc.c (mALLOPt): Clamp arena_test based on
|
||||
the value of arena_max.
|
||||
|
||||
commit 41b81892f11fe1353123e892158b53de73863d62
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Tue Jan 31 14:42:34 2012 -0500
|
||||
|
||||
Handle ARENA_TEST correctly
|
||||
|
||||
diff --git a/malloc/arena.c b/malloc/arena.c
|
||||
index d3cf4b9..b1c9469 100644
|
||||
--- a/malloc/arena.c
|
||||
+++ b/malloc/arena.c
|
||||
@@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
|
||||
{
|
||||
if (mp_.arena_max != 0)
|
||||
narenas_limit = mp_.arena_max;
|
||||
- else
|
||||
+ else if (narenas > mp_.arena_test)
|
||||
{
|
||||
int n = __get_nprocs ();
|
||||
|
||||
@@ -842,7 +842,14 @@ arena_get2(mstate a_tsd, size_t size)
|
||||
}
|
||||
repeat:;
|
||||
size_t n = narenas;
|
||||
- if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
|
||||
+ /* NB: the following depends on the fact that (size_t)0 - 1 is a
|
||||
+ very large number and that the underflow is OK. If arena_max
|
||||
+ is set the value of arena_test is irrelevant. If arena_test
|
||||
+ is set but narenas is not yet larger or equal to arena_test
|
||||
+ narenas_limit is 0. There is no possibility for narenas to
|
||||
+ be too big for the test to always fail since there is not
|
||||
+ enough address space to create that many arenas. */
|
||||
+ if (__builtin_expect (n <= narenas_limit - 1, 0))
|
||||
{
|
||||
if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
|
||||
goto repeat;
|
|
@ -1,10 +1,10 @@
|
|||
diff -rup a/time/sys/time.h b/time/sys/time.h
|
||||
--- a/time/sys/time.h 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/time/sys/time.h 2012-01-26 11:16:44.309112430 -0700
|
||||
@@ -78,7 +78,7 @@ extern int gettimeofday (struct timeval
|
||||
diff -rup c/time/sys/time.h d/time/sys/time.h
|
||||
--- c/time/sys/time.h 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/time/sys/time.h 2012-05-21 00:14:17.033127079 -0600
|
||||
@@ -77,7 +77,7 @@ extern int gettimeofday (struct timeval
|
||||
This call is restricted to the super-user. */
|
||||
extern int settimeofday (__const struct timeval *__tv,
|
||||
__const struct timezone *__tz)
|
||||
extern int settimeofday (const struct timeval *__tv,
|
||||
const struct timezone *__tz)
|
||||
- __THROW __nonnull ((1));
|
||||
+ __THROW;
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
commit 1f393a11f65dcaa1952bdcaf0317a65a5f8aff9d
|
||||
Author: Marek Polacek <polacek@redhat.com>
|
||||
Date: Wed Feb 29 15:28:38 2012 +0100
|
||||
|
||||
Always set l_used for vDSO.
|
||||
|
||||
2012-02-29 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
[BZ #13706]
|
||||
* elf/rtld.c (dl_main): Always set l_used to 1 for vDSO.
|
||||
* elf/Makefile: Add rules to run tst-unused-dep.out.
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index 8234ba7..25ffc57 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -1203,3 +1203,14 @@ $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
|
||||
$(objpfx)tst-relsort1mod2.so: $(libm)
|
||||
$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
|
||||
$(objpfx)tst-relsort1mod2.so
|
||||
+
|
||||
+tests: $(objpfx)tst-unused-dep.out
|
||||
+
|
||||
+$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
|
||||
+ LD_TRACE_LOADED_OBJECTS=1 \
|
||||
+ LD_DEBUG=unused \
|
||||
+ LD_PRELOAD= \
|
||||
+ $(elf-objpfx)${rtld-installed-name} \
|
||||
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
|
||||
+ $< > $@
|
||||
+ cmp $@ /dev/null > /dev/null
|
||||
diff --git a/elf/rtld.c b/elf/rtld.c
|
||||
index 2e4f97f..3e15447 100644
|
||||
--- a/elf/rtld.c
|
||||
+++ b/elf/rtld.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Run time dynamic linker.
|
||||
- Copyright (C) 1995-2010, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1995-2012 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
|
||||
@@ -1375,6 +1375,9 @@ of this helper program; chances are you did not intend to run this program.\n\
|
||||
_dl_setup_hash (l);
|
||||
l->l_relocated = 1;
|
||||
|
||||
+ /* The vDSO is always used. */
|
||||
+ l->l_used = 1;
|
||||
+
|
||||
/* Initialize l_local_scope to contain just this map. This allows
|
||||
the use of dl_lookup_symbol_x to resolve symbols within the vdso.
|
||||
So we create a single entry list pointing to l_real as its only
|
|
@ -1,18 +0,0 @@
|
|||
diff -rup a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c
|
||||
--- a/sysdeps/ieee754/dbl-64/w_exp.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/ieee754/dbl-64/w_exp.c 2012-02-24 10:32:52.769230965 -0700
|
||||
@@ -32,12 +32,12 @@ __exp (double x)
|
||||
if (__builtin_expect (x > o_threshold, 0))
|
||||
{
|
||||
if (_LIB_VERSION != _IEEE_)
|
||||
- return __kernel_standard_f (x, x, 6);
|
||||
+ return __kernel_standard (x, x, 6);
|
||||
}
|
||||
else if (__builtin_expect (x < u_threshold, 0))
|
||||
{
|
||||
if (_LIB_VERSION != _IEEE_)
|
||||
- return __kernel_standard_f (x, x, 7);
|
||||
+ return __kernel_standard (x, x, 7);
|
||||
}
|
||||
|
||||
return __ieee754_exp (x);
|
|
@ -1,6 +1,6 @@
|
|||
diff -Nrup a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
|
||||
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2012-01-01 20:52:51.546347249 -0700
|
||||
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2012-01-01 20:57:21.880320786 -0700
|
||||
diff -Nrup c/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S d/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
|
||||
--- c/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2012-05-20 23:58:20.732670548 -0600
|
||||
+++ d/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2012-05-20 23:58:52.667518135 -0600
|
||||
@@ -137,7 +137,6 @@ __pthread_cond_wait:
|
||||
cmpl $PI_BIT, %eax
|
||||
jne 18f
|
||||
|
@ -109,10 +109,10 @@ diff -Nrup a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/s
|
|||
.long .LcallUR-.LSTARTCODE
|
||||
.long .LENDCODE-.LcallUR
|
||||
.long 0
|
||||
diff -Nrup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
|
||||
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2012-01-01 20:52:51.550347247 -0700
|
||||
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2012-01-01 20:57:21.883320786 -0700
|
||||
@@ -137,14 +137,11 @@ __pthread_cond_wait:
|
||||
diff -Nrup c/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S d/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
|
||||
--- c/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2012-05-20 23:58:20.736670528 -0600
|
||||
+++ d/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2012-05-21 00:01:39.870720001 -0600
|
||||
@@ -136,14 +136,11 @@ __pthread_cond_wait:
|
||||
cmpl $PI_BIT, %eax
|
||||
jne 61f
|
||||
|
||||
|
@ -127,11 +127,10 @@ diff -Nrup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysd
|
|||
#ifdef __ASSUME_REQUEUE_PI
|
||||
jmp 62f
|
||||
#else
|
||||
@@ -331,70 +328,6 @@ __pthread_cond_wait:
|
||||
|
||||
@@ -331,69 +328,6 @@ __pthread_cond_wait:
|
||||
13: movq %r10, %rax
|
||||
jmp 14b
|
||||
-
|
||||
|
||||
-91:
|
||||
-.LcleanupSTART2:
|
||||
- /* FUTEX_WAIT_REQUEUE_PI returned EAGAIN. We need to
|
||||
|
@ -152,7 +151,7 @@ diff -Nrup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysd
|
|||
-#if cond_lock != 0
|
||||
- addq $cond_lock, %rdi
|
||||
-#endif
|
||||
- cmpq $-1, dep_mutex-cond_lock(%rdi)
|
||||
- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
|
||||
- movl $LLL_PRIVATE, %eax
|
||||
- movl $LLL_SHARED, %esi
|
||||
- cmovne %eax, %esi
|
||||
|
@ -178,7 +177,7 @@ diff -Nrup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysd
|
|||
-#if cond_lock != 0
|
||||
- addq $cond_lock, %rdi
|
||||
-#endif
|
||||
- cmpq $-1, dep_mutex-cond_lock(%rdi)
|
||||
- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
|
||||
- movl $LLL_PRIVATE, %eax
|
||||
- movl $LLL_SHARED, %esi
|
||||
- cmovne %eax, %esi
|
||||
|
@ -190,7 +189,7 @@ diff -Nrup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysd
|
|||
-93:
|
||||
- /* Set the rest of SYS_futex args for FUTEX_WAIT_REQUEUE_PI. */
|
||||
- xorq %r10, %r10
|
||||
- movq dep_mutex(%rdi), %r8
|
||||
- mov dep_mutex(%rdi), %R8_LP
|
||||
- leaq cond_futex(%rdi), %rdi
|
||||
- jmp 90b
|
||||
-.LcleanupEND2:
|
||||
|
@ -198,7 +197,7 @@ diff -Nrup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysd
|
|||
.size __pthread_cond_wait, .-__pthread_cond_wait
|
||||
versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
|
||||
GLIBC_2_3_2)
|
||||
@@ -547,15 +480,11 @@ __condvar_cleanup1:
|
||||
@@ -546,15 +480,11 @@ __condvar_cleanup1:
|
||||
.uleb128 .LcleanupSTART-.LSTARTCODE
|
||||
.uleb128 .LcleanupEND-.LcleanupSTART
|
||||
.uleb128 __condvar_cleanup1-.LSTARTCODE
|
||||
|
|
|
@ -21,101 +21,3 @@ diff -rup a/fedora/nscd.service b/fedora/nscd.service
|
|||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
diff -rup a/nscd/nscd.c b/nscd/nscd.c
|
||||
--- a/nscd/nscd.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/nscd/nscd.c 2012-02-03 13:07:50.509740586 -0700
|
||||
@@ -72,7 +72,12 @@ thread_info_t thread_info;
|
||||
int do_shutdown;
|
||||
int disabled_passwd;
|
||||
int disabled_group;
|
||||
-int go_background = 1;
|
||||
+
|
||||
+/* Default is to daemonize. Set to 1 to run in foreground in
|
||||
+ debugging mode, or negative to run in foreground but otherwise
|
||||
+ behave like a daemon, i.e., detach from terminal and use
|
||||
+ syslog. */
|
||||
+static int run_in_foreground = 0;
|
||||
|
||||
static const char *conffile = _PATH_NSCDCONF;
|
||||
|
||||
@@ -104,6 +109,8 @@ static const struct argp_option options[
|
||||
N_("Read configuration data from NAME") },
|
||||
{ "debug", 'd', NULL, 0,
|
||||
N_("Do not fork and display messages on the current tty") },
|
||||
+ { "foreground", 'F', NULL, 0,
|
||||
+ N_("Do not fork, but otherwise behave like a deamon") },
|
||||
{ "nthreads", 't', N_("NUMBER"), 0, N_("Start NUMBER threads") },
|
||||
{ "shutdown", 'K', NULL, 0, N_("Shut the server down") },
|
||||
{ "statistics", 'g', NULL, 0, N_("Print current configuration statistics") },
|
||||
@@ -174,16 +181,22 @@ main (int argc, char **argv)
|
||||
/* Determine page size. */
|
||||
pagesize_m1 = getpagesize () - 1;
|
||||
|
||||
- /* Behave like a daemon. */
|
||||
- if (go_background)
|
||||
+ if (run_in_foreground <= 0)
|
||||
{
|
||||
int i;
|
||||
+ pid_t pid;
|
||||
|
||||
- pid_t pid = fork ();
|
||||
- if (pid == -1)
|
||||
- error (EXIT_FAILURE, errno, _("cannot fork"));
|
||||
- if (pid != 0)
|
||||
- exit (0);
|
||||
+ /* Behave like a daemon. */
|
||||
+ if (!run_in_foreground)
|
||||
+ {
|
||||
+ pid = fork ();
|
||||
+ if (pid == -1)
|
||||
+ error (EXIT_FAILURE, errno, _("cannot fork"));
|
||||
+ if (pid != 0)
|
||||
+ exit (0);
|
||||
+ }
|
||||
+ else
|
||||
+ fprintf (stderr, _("further output sent to syslog\n"));
|
||||
|
||||
int nullfd = open (_PATH_DEVNULL, O_RDWR);
|
||||
if (nullfd != -1)
|
||||
@@ -234,11 +247,14 @@ main (int argc, char **argv)
|
||||
for (i = min_close_fd; i < getdtablesize (); i++)
|
||||
close (i);
|
||||
|
||||
- pid = fork ();
|
||||
- if (pid == -1)
|
||||
- error (EXIT_FAILURE, errno, _("cannot fork"));
|
||||
- if (pid != 0)
|
||||
- exit (0);
|
||||
+ if (!run_in_foreground)
|
||||
+ {
|
||||
+ pid = fork ();
|
||||
+ if (pid == -1)
|
||||
+ error (EXIT_FAILURE, errno, _("cannot fork"));
|
||||
+ if (pid != 0)
|
||||
+ exit (0);
|
||||
+ }
|
||||
|
||||
setsid ();
|
||||
|
||||
@@ -260,7 +276,7 @@ main (int argc, char **argv)
|
||||
signal (SIGTSTP, SIG_IGN);
|
||||
}
|
||||
else
|
||||
- /* In foreground mode we are not paranoid. */
|
||||
+ /* In debug mode we are not paranoid. */
|
||||
paranoia = 0;
|
||||
|
||||
signal (SIGINT, termination_handler);
|
||||
@@ -309,7 +325,11 @@ parse_opt (int key, char *arg, struct ar
|
||||
{
|
||||
case 'd':
|
||||
++debug_level;
|
||||
- go_background = 0;
|
||||
+ run_in_foreground = 1;
|
||||
+ break;
|
||||
+
|
||||
+ case 'F':
|
||||
+ run_in_foreground = -1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
diff -rup a/sysdeps/powerpc/powerpc64/Makefile b/sysdeps/powerpc/powerpc64/Makefile
|
||||
--- a/sysdeps/powerpc/powerpc64/Makefile 2012-02-01 09:34:07.018768021 -0700
|
||||
+++ b/sysdeps/powerpc/powerpc64/Makefile 2012-02-01 09:35:28.813356195 -0700
|
||||
@@ -31,7 +31,7 @@ elide-routines.os += hp-timing
|
||||
ifneq ($(elf),no)
|
||||
# The initfini generation code doesn't work in the presence of -fPIC, so
|
||||
# we use -fpic instead which is much better.
|
||||
-CFLAGS-initfini.s += -fpic -O1
|
||||
+CFLAGS-initfini.s += -fpic -O1 -fno-inline
|
||||
endif
|
||||
CFLAGS-libc-start.c += -fno-asynchronous-unwind-tables
|
||||
endif
|
|
@ -1,144 +0,0 @@
|
|||
commit 3e1aa84e7f9f38815f5db9cd7654b1a9497cf6e4
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Fri Jan 20 22:39:54 2012 -0500
|
||||
|
||||
Do not cache negative results in nscd if these are transient
|
||||
|
||||
diff --git a/nscd/aicache.c b/nscd/aicache.c
|
||||
index aaaf80d..e1f1244 100644
|
||||
--- a/nscd/aicache.c
|
||||
+++ b/nscd/aicache.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Cache handling for host lookup.
|
||||
- Copyright (C) 2004-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2004-2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
|
||||
|
||||
@@ -514,8 +514,9 @@ next_nip:
|
||||
if (fd != -1)
|
||||
TEMP_FAILURE_RETRY (send (fd, ¬found, total, MSG_NOSIGNAL));
|
||||
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (__builtin_expect (db->negtimeout == 0, 0))
|
||||
+ /* If we have a transient error or cannot permanently store the
|
||||
+ result, so be it. */
|
||||
+ if (rc4 == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
{
|
||||
/* Mark the old entry as obsolete. */
|
||||
if (dh != NULL)
|
||||
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
|
||||
index e9607c6..a698f36 100644
|
||||
--- a/nscd/grpcache.c
|
||||
+++ b/nscd/grpcache.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Cache handling for group lookup.
|
||||
- Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1998-2008, 2009, 2011, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -120,8 +120,9 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
||||
else
|
||||
written = total;
|
||||
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (db->negtimeout == 0)
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
{
|
||||
/* Mark the old entry as obsolete. */
|
||||
if (dh != NULL)
|
||||
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
|
||||
index 4d68ade..c72feaa 100644
|
||||
--- a/nscd/hstcache.c
|
||||
+++ b/nscd/hstcache.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Cache handling for host lookup.
|
||||
- Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1998-2008, 2009, 2011, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -141,8 +141,9 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
|
||||
MSG_NOSIGNAL)) != total)
|
||||
all_written = false;
|
||||
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (__builtin_expect (db->negtimeout == 0, 0))
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
{
|
||||
/* Mark the old entry as obsolete. */
|
||||
if (dh != NULL)
|
||||
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
|
||||
index 4ac9942..2019991 100644
|
||||
--- a/nscd/initgrcache.c
|
||||
+++ b/nscd/initgrcache.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Cache handling for host lookup.
|
||||
- Copyright (C) 2004-2006, 2008, 2009, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2004-2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
|
||||
|
||||
@@ -202,8 +202,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
|
||||
written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
MSG_NOSIGNAL));
|
||||
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (__builtin_expect (db->negtimeout == 0, 0))
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (all_tryagain || __builtin_expect (db->negtimeout == 0, 0))
|
||||
{
|
||||
/* Mark the old entry as obsolete. */
|
||||
if (dh != NULL)
|
||||
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
|
||||
index 49e130c..e2ba09d 100644
|
||||
--- a/nscd/pwdcache.c
|
||||
+++ b/nscd/pwdcache.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Cache handling for passwd lookup.
|
||||
- Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1998-2008, 2009, 2011, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -124,8 +124,9 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
||||
written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
MSG_NOSIGNAL));
|
||||
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (__builtin_expect (db->negtimeout == 0, 0))
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
{
|
||||
/* Mark the old entry as obsolete. */
|
||||
if (dh != NULL)
|
||||
diff --git a/nscd/servicescache.c b/nscd/servicescache.c
|
||||
index d3d5dce..a6337e3 100644
|
||||
--- a/nscd/servicescache.c
|
||||
+++ b/nscd/servicescache.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Cache handling for services lookup.
|
||||
- Copyright (C) 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@drepper.com>, 2007.
|
||||
|
||||
@@ -108,8 +108,9 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
|
||||
written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
MSG_NOSIGNAL));
|
||||
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (__builtin_expect (db->negtimeout == 0, 0))
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
{
|
||||
/* Mark the old entry as obsolete. */
|
||||
if (dh != NULL)
|
|
@ -1,131 +0,0 @@
|
|||
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
|
||||
index a70d66d..ad6ab35 100644
|
||||
--- a/nis/nss_compat/compat-initgroups.c
|
||||
+++ b/nis/nss_compat/compat-initgroups.c
|
||||
@@ -296,6 +296,8 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
|
||||
if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroups,
|
||||
limit, errnop) == NSS_STATUS_SUCCESS)
|
||||
{
|
||||
+ status = NSS_STATUS_NOTFOUND;
|
||||
+
|
||||
/* If there is no blacklist we can trust the underlying
|
||||
initgroups implementation. */
|
||||
if (ent->blacklist.current <= 1)
|
||||
@@ -308,6 +310,7 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
|
||||
overwrite the pointer with one to a bigger buffer. */
|
||||
char *tmpbuf = buffer;
|
||||
size_t tmplen = buflen;
|
||||
+ bool use_malloc = false;
|
||||
|
||||
for (int i = 0; i < mystart; i++)
|
||||
{
|
||||
@@ -315,21 +318,36 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
|
||||
tmpbuf, tmplen, errnop))
|
||||
== NSS_STATUS_TRYAGAIN
|
||||
&& *errnop == ERANGE)
|
||||
- if (tmpbuf == buffer)
|
||||
- {
|
||||
- tmplen *= 2;
|
||||
- tmpbuf = __alloca (tmplen);
|
||||
- }
|
||||
- else
|
||||
- tmpbuf = extend_alloca (tmpbuf, tmplen, 2 * tmplen);
|
||||
+ {
|
||||
+ if (__libc_use_alloca (tmplen * 2))
|
||||
+ {
|
||||
+ if (tmpbuf == buffer)
|
||||
+ {
|
||||
+ tmplen *= 2;
|
||||
+ tmpbuf = __alloca (tmplen);
|
||||
+ }
|
||||
+ else
|
||||
+ tmpbuf = extend_alloca (tmpbuf, tmplen, tmplen * 2);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ tmplen *= 2;
|
||||
+ char *newbuf = realloc (use_malloc ? tmpbuf : NULL, tmplen);
|
||||
+
|
||||
+ if (newbuf == NULL)
|
||||
+ {
|
||||
+ status = NSS_STATUS_TRYAGAIN;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ use_malloc = true;
|
||||
+ tmpbuf = newbuf;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (__builtin_expect (status != NSS_STATUS_NOTFOUND, 1))
|
||||
{
|
||||
if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
|
||||
- {
|
||||
- free (mygroups);
|
||||
- return status;
|
||||
- }
|
||||
+ goto done;
|
||||
|
||||
if (!in_blacklist (grpbuf.gr_name,
|
||||
strlen (grpbuf.gr_name), ent)
|
||||
@@ -347,11 +365,17 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ status = NSS_STATUS_NOTFOUND;
|
||||
+
|
||||
+ done:
|
||||
+ if (use_malloc)
|
||||
+ free (tmpbuf);
|
||||
}
|
||||
|
||||
free (mygroups);
|
||||
|
||||
- return NSS_STATUS_NOTFOUND;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
free (mygroups);
|
||||
@@ -508,6 +532,7 @@ _nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
|
||||
char *tmpbuf;
|
||||
enum nss_status status;
|
||||
ent_t intern = { true, false, false, NULL, {NULL, 0, 0} };
|
||||
+ bool use_malloc = false;
|
||||
|
||||
status = internal_setgrent (&intern);
|
||||
if (status != NSS_STATUS_SUCCESS)
|
||||
@@ -521,13 +546,32 @@ _nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
|
||||
user, group, start, size,
|
||||
groupsp, limit, errnop))
|
||||
== NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
|
||||
- tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
|
||||
+ if (__libc_use_alloca (buflen * 2))
|
||||
+ tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
|
||||
+ else
|
||||
+ {
|
||||
+ buflen *= 2;
|
||||
+ char *newbuf = realloc (use_malloc ? tmpbuf : NULL, buflen);
|
||||
+ if (newbuf == NULL)
|
||||
+ {
|
||||
+ status = NSS_STATUS_TRYAGAIN;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ use_malloc = true;
|
||||
+ tmpbuf = newbuf;
|
||||
+ }
|
||||
}
|
||||
while (status == NSS_STATUS_SUCCESS);
|
||||
|
||||
+ status = NSS_STATUS_SUCCESS;
|
||||
+
|
||||
+ done:
|
||||
+ if (use_malloc)
|
||||
+ free (tmpbuf);
|
||||
+
|
||||
internal_endgrent (&intern);
|
||||
|
||||
- return NSS_STATUS_SUCCESS;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
--- a/stdio-common/vfprintf.c 2012-03-07 12:16:21.000000000 -0700
|
||||
+++ b/stdio-common/vfprintf.c 2012-03-07 12:00:28.006630851 -0700
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 1991-2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 1991-2011, 2012 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
|
||||
@@ -12,9 +12,8 @@
|
||||
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. */
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
@@ -823,7 +822,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
\
|
||||
if (function_done < 0) \
|
||||
{ \
|
||||
- /* Error in print handler. */ \
|
||||
+ /* Error in print handler; up to handler to set errno. */ \
|
||||
done = -1; \
|
||||
goto all_done; \
|
||||
} \
|
||||
@@ -877,7 +876,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
\
|
||||
if (function_done < 0) \
|
||||
{ \
|
||||
- /* Error in print handler. */ \
|
||||
+ /* Error in print handler; up to handler to set errno. */ \
|
||||
done = -1; \
|
||||
goto all_done; \
|
||||
} \
|
||||
@@ -1118,7 +1117,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
&mbstate); \
|
||||
if (len == (size_t) -1) \
|
||||
{ \
|
||||
- /* Something went wron gduring the conversion. Bail out. */ \
|
||||
+ /* Something went wrong during the conversion. Bail out. */ \
|
||||
done = -1; \
|
||||
goto all_done; \
|
||||
} \
|
||||
@@ -1574,6 +1606,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
if (spec == L_('\0'))
|
||||
{
|
||||
/* The format string ended before the specifier is complete. */
|
||||
+ __set_errno (EINVAL);
|
||||
done = -1;
|
||||
goto all_done;
|
||||
}
|
||||
@@ -1671,29 +1704,34 @@ do_positional:
|
||||
|
||||
/* Determine the number of arguments the format string consumes. */
|
||||
nargs = MAX (nargs, max_ref_arg);
|
||||
- bytes_per_arg = sizeof (*args_value) + sizeof (*args_size)
|
||||
- + sizeof (*args_type);
|
||||
+ /* Calculate total size needed to represent a single argument across
|
||||
+ all three argument-related arrays. */
|
||||
+ bytes_per_arg = (sizeof (*args_value) + sizeof (*args_size)
|
||||
+ + sizeof (*args_type));
|
||||
|
||||
/* Check for potential integer overflow. */
|
||||
- if (nargs > SIZE_MAX / bytes_per_arg)
|
||||
+ if (__builtin_expect (nargs > SIZE_MAX / bytes_per_arg, 0))
|
||||
{
|
||||
- done = -1;
|
||||
- goto all_done;
|
||||
+ __set_errno (ERANGE);
|
||||
+ done = -1;
|
||||
+ goto all_done;
|
||||
}
|
||||
|
||||
- /* Allocate memory for the argument descriptions. */
|
||||
+ /* Allocate memory for all three argument arrays. */
|
||||
if (__libc_use_alloca (nargs * bytes_per_arg))
|
||||
- args_value = alloca (nargs * bytes_per_arg);
|
||||
+ args_value = alloca (nargs * bytes_per_arg);
|
||||
else
|
||||
{
|
||||
- args_value = args_malloced = malloc (nargs * bytes_per_arg);
|
||||
- if (args_value == NULL)
|
||||
- {
|
||||
- done = -1;
|
||||
- goto all_done;
|
||||
- }
|
||||
+ args_value = args_malloced = malloc (nargs * bytes_per_arg);
|
||||
+ if (args_value == NULL)
|
||||
+ {
|
||||
+ done = -1;
|
||||
+ goto all_done;
|
||||
+ }
|
||||
}
|
||||
|
||||
+ /* Set up the remaining two arrays to each point past the end of the
|
||||
+ prior array, since space for all three has been allocated now. */
|
||||
args_size = &args_value[nargs].pa_int;
|
||||
args_type = &args_size[nargs];
|
||||
memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0',
|
||||
@@ -1912,6 +1950,7 @@ do_positional:
|
||||
about # of chars. */
|
||||
if (function_done < 0)
|
||||
{
|
||||
+ /* Function has set errno. */
|
||||
done = -1;
|
||||
goto all_done;
|
||||
}
|
||||
@@ -1946,6 +1985,7 @@ do_positional:
|
||||
of chars. */
|
||||
if (function_done < 0)
|
||||
{
|
||||
+ /* Function has set errno. */
|
||||
done = -1;
|
||||
goto all_done;
|
||||
}
|
|
@ -1,240 +0,0 @@
|
|||
From libc-alpha-return-25252-listarch-libc-alpha=sources dot redhat dot com at sourceware dot org Thu Feb 16 16:21:17 2012
|
||||
Return-Path: <libc-alpha-return-25252-listarch-libc-alpha=sources dot redhat dot com at sourceware dot org>
|
||||
Delivered-To: listarch-libc-alpha at sources dot redhat dot com
|
||||
Received: (qmail 5187 invoked by alias); 16 Feb 2012 16:21:14 -0000
|
||||
Delivered-To: moderator for libc-alpha at sourceware dot org
|
||||
Received: (qmail 2174 invoked by uid 22791); 16 Feb 2012 16:17:18 -0000
|
||||
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0
|
||||
tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,TW_TV,TW_VB,TW_VF,T_RP_MATCHES_RCVD
|
||||
X-Spam-Check-By: sourceware.org
|
||||
Date: Thu, 16 Feb 2012 08:16:13 -0800
|
||||
From: Kees Cook <kees at outflux dot net>
|
||||
To: "Ryan S dot Arnold" <ryan dot arnold at gmail dot com>
|
||||
Cc: libc-alpha at sourceware dot org, Paul Eggert <eggert at cs dot ucla dot edu>,
|
||||
Roland McGrath <roland at hack dot frob dot com>,
|
||||
Andreas Schwab <schwab at linux-m68k dot org>
|
||||
Subject: Re: [PATCH] vfprintf: validate nargs and maybe allocate from heap
|
||||
Message-ID: <20120216161613.GZ20420@outflux.net>
|
||||
References: <20120206062537.GM4979@outflux.net>
|
||||
<20120207000509 dot GP4989 at outflux dot net>
|
||||
<20120210192457 dot GF20420 at outflux dot net>
|
||||
<CAAKybw8AgkGsKAx=kvX4Tsi74f+HtuVnatTCB0VfsHi7vVFi1Q at mail dot gmail dot com>
|
||||
<20120214223048 dot GM20420 at outflux dot net>
|
||||
<CAAKybw_HS+cav+YcDw3ns7UXu6_xA7EHPrkiB87P+OGwEB0PVQ at mail dot gmail dot com>
|
||||
<20120214224543 dot GN20420 at outflux dot net>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
In-Reply-To: <20120214224543 dot GN20420 at outflux dot net>
|
||||
X-MIMEDefang-Filter: outflux$Revision: 1.316 $
|
||||
X-HELO: www.outflux.net
|
||||
Mailing-List: contact libc-alpha-help at sourceware dot org; run by ezmlm
|
||||
Precedence: bulk
|
||||
List-Id: <libc-alpha.sourceware.org>
|
||||
List-Subscribe: <mailto:libc-alpha-subscribe at sourceware dot org>
|
||||
List-Archive: <http://sourceware.org/ml/libc-alpha/>
|
||||
List-Post: <mailto:libc-alpha at sourceware dot org>
|
||||
List-Help: <mailto:libc-alpha-help at sourceware dot org>, <http://sourceware dot org/ml/#faqs>
|
||||
Sender: libc-alpha-owner at sourceware dot org
|
||||
Delivered-To: mailing list libc-alpha at sourceware dot org
|
||||
|
||||
The nargs value can overflow when doing allocations, allowing arbitrary
|
||||
memory writes via format strings, bypassing _FORTIFY_SOURCE:
|
||||
http://www.phrack.org/issues.html?issue=67&id=9
|
||||
|
||||
This checks for nargs overflow and possibly allocates from heap instead of
|
||||
stack, and adds a regression test for the situation.
|
||||
|
||||
I have FSF assignment via Google. (Sent from @outflux since that's how I'm
|
||||
subscribed here, but CL shows @chromium.org as part of my Google work.)
|
||||
|
||||
This version disables the useless test on non-32-bit platforms.
|
||||
|
||||
2012-02-16 Kees Cook <keescook@chromium.org>
|
||||
|
||||
[BZ #13656]
|
||||
* stdio-common/vfprintf.c (vfprintf): Check for nargs overflow and
|
||||
possibly allocate from heap instead of stack.
|
||||
* stdio-common/bug-vfprintf-nargs.c: New file.
|
||||
* stdio-common/Makefile (tests): Add nargs overflow test.
|
||||
|
||||
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
|
||||
index a847b28..080badc 100644
|
||||
--- a/stdio-common/Makefile
|
||||
+++ b/stdio-common/Makefile
|
||||
@@ -59,7 +59,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
|
||||
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
|
||||
tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
|
||||
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
|
||||
|
||||
test-srcs = tst-unbputc tst-printf
|
||||
|
||||
diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c
|
||||
new file mode 100644
|
||||
index 0000000..13c66c0
|
||||
--- /dev/null
|
||||
+++ b/stdio-common/bug-vfprintf-nargs.c
|
||||
@@ -0,0 +1,78 @@
|
||||
+/* Test for vfprintf nargs allocation overflow (BZ #13656).
|
||||
+ Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+ Contributed by Kees Cook <keescook@chromium.org>, 2012.
|
||||
+
|
||||
+ 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 <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdint.h>
|
||||
+#include <unistd.h>
|
||||
+#include <inttypes.h>
|
||||
+#include <string.h>
|
||||
+#include <signal.h>
|
||||
+
|
||||
+static int
|
||||
+format_failed (const char *fmt, const char *expected)
|
||||
+{
|
||||
+ char output[80];
|
||||
+
|
||||
+ printf ("%s : ", fmt);
|
||||
+
|
||||
+ memset (output, 0, sizeof output);
|
||||
+ /* Having sprintf itself detect a failure is good. */
|
||||
+ if (sprintf (output, fmt, 1, 2, 3, "test") > 0
|
||||
+ && strcmp (output, expected) != 0)
|
||||
+ {
|
||||
+ printf ("FAIL (output '%s' != expected '%s')\n", output, expected);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ puts ("ok");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+ char buf[64];
|
||||
+
|
||||
+ /* Regular positionals work. */
|
||||
+ if (format_failed ("%1$d", "1") != 0)
|
||||
+ rc = 1;
|
||||
+
|
||||
+ /* Regular width positionals work. */
|
||||
+ if (format_failed ("%1$*2$d", " 1") != 0)
|
||||
+ rc = 1;
|
||||
+
|
||||
+ /* Positional arguments are constructed via read_int, so nargs can only
|
||||
+ overflow on 32-bit systems. On 64-bit systems, it will attempt to
|
||||
+ allocate a giant amount of memory and possibly crash, which is the
|
||||
+ expected situation. Since the 64-bit behavior is arch-specific, only
|
||||
+ test this on 32-bit systems. */
|
||||
+ if (sizeof (long int) == 4)
|
||||
+ {
|
||||
+ sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int));
|
||||
+ if (format_failed (buf, "1 %$d") != 0)
|
||||
+ rc = 1;
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+#define TEST_FUNCTION do_test ()
|
||||
+#include "../test-skeleton.c"
|
||||
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
|
||||
index 863cd5d..022e72b 100644
|
||||
--- a/stdio-common/vfprintf.c
|
||||
+++ b/stdio-common/vfprintf.c
|
||||
@@ -235,6 +235,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
|
||||
0 if unknown. */
|
||||
int readonly_format = 0;
|
||||
|
||||
+ /* For the argument descriptions, which may be allocated on the heap. */
|
||||
+ void *args_malloced = NULL;
|
||||
+
|
||||
/* This table maps a character into a number representing a
|
||||
class. In each step there is a destination label for each
|
||||
class. */
|
||||
@@ -1647,9 +1650,10 @@ do_positional:
|
||||
determine the size of the array needed to store the argument
|
||||
attributes. */
|
||||
size_t nargs = 0;
|
||||
- int *args_type;
|
||||
- union printf_arg *args_value = NULL;
|
||||
+ size_t bytes_per_arg;
|
||||
+ union printf_arg *args_value;
|
||||
int *args_size;
|
||||
+ int *args_type;
|
||||
|
||||
/* Positional parameters refer to arguments directly. This could
|
||||
also determine the maximum number of arguments. Track the
|
||||
@@ -1698,13 +1702,33 @@ do_positional:
|
||||
|
||||
/* Determine the number of arguments the format string consumes. */
|
||||
nargs = MAX (nargs, max_ref_arg);
|
||||
+ bytes_per_arg = sizeof (*args_value) + sizeof (*args_size)
|
||||
+ + sizeof (*args_type);
|
||||
+
|
||||
+ /* Check for potential integer overflow. */
|
||||
+ if (nargs > SIZE_MAX / bytes_per_arg)
|
||||
+ {
|
||||
+ done = -1;
|
||||
+ goto all_done;
|
||||
+ }
|
||||
|
||||
/* Allocate memory for the argument descriptions. */
|
||||
- args_type = alloca (nargs * sizeof (int));
|
||||
+ if (__libc_use_alloca (nargs * bytes_per_arg))
|
||||
+ args_value = alloca (nargs * bytes_per_arg);
|
||||
+ else
|
||||
+ {
|
||||
+ args_value = args_malloced = malloc (nargs * bytes_per_arg);
|
||||
+ if (args_value == NULL)
|
||||
+ {
|
||||
+ done = -1;
|
||||
+ goto all_done;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ args_size = &args_value[nargs].pa_int;
|
||||
+ args_type = &args_size[nargs];
|
||||
memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0',
|
||||
- nargs * sizeof (int));
|
||||
- args_value = alloca (nargs * sizeof (union printf_arg));
|
||||
- args_size = alloca (nargs * sizeof (int));
|
||||
+ nargs * sizeof (*args_type));
|
||||
|
||||
/* XXX Could do sanity check here: If any element in ARGS_TYPE is
|
||||
still zero after this loop, format is invalid. For now we
|
||||
@@ -1973,8 +1997,8 @@ do_positional:
|
||||
}
|
||||
|
||||
all_done:
|
||||
- if (__builtin_expect (workstart != NULL, 0))
|
||||
- free (workstart);
|
||||
+ free (args_malloced);
|
||||
+ free (workstart);
|
||||
/* Unlock the stream. */
|
||||
_IO_funlockfile (s);
|
||||
_IO_cleanup_region_end (0);
|
||||
--
|
||||
1.7.5.4
|
||||
|
||||
--
|
||||
Kees Cook @outflux.net
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
|
||||
index 01369f6..44ad04d 100644
|
||||
--- a/resolv/nss_dns/dns-host.c
|
||||
+++ b/resolv/nss_dns/dns-host.c
|
||||
@@ -1219,7 +1219,7 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
|
||||
&first);
|
||||
if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
|
||||
|| (status == NSS_STATUS_TRYAGAIN
|
||||
- && (errno != ERANGE || *h_errnop != NO_RECOVERY)))
|
||||
+ && (*errnop != ERANGE || *h_errnop == NO_RECOVERY)))
|
||||
&& answer2 != NULL && anslen2 > 0)
|
||||
{
|
||||
enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname,
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
|
||||
2012-02-28 Jeff Law <law@redhat.com>
|
||||
|
||||
* resolv/res_query.c (__libc_res_nquerydomain): Avoid
|
||||
out of bounds read.
|
||||
|
||||
diff --git a/resolv/res_query.c b/resolv/res_query.c
|
||||
index 947c651..abccd4a 100644
|
||||
--- a/resolv/res_query.c
|
||||
+++ b/resolv/res_query.c
|
||||
@@ -556,12 +556,16 @@ __libc_res_nquerydomain(res_state statp,
|
||||
* copy without '.' if present.
|
||||
*/
|
||||
n = strlen(name);
|
||||
- if (n >= MAXDNAME) {
|
||||
+
|
||||
+ /* Decrement N prior to checking it against MAXDNAME
|
||||
+ so that we detect a wrap to SIZE_MAX and return
|
||||
+ a reasonable error. */
|
||||
+ n--;
|
||||
+ if (n >= MAXDNAME - 1) {
|
||||
RES_SET_H_ERRNO(statp, NO_RECOVERY);
|
||||
return (-1);
|
||||
}
|
||||
- n--;
|
||||
- if (n >= 0 && name[n] == '.') {
|
||||
+ if (name[n] == '.') {
|
||||
strncpy(nbuf, name, n);
|
||||
nbuf[n] = '\0';
|
||||
} else
|
|
@ -1,253 +0,0 @@
|
|||
diff -rup c/sysdeps/x86_64/fpu/multiarch/e_log.c d/sysdeps/x86_64/fpu/multiarch/e_log.c
|
||||
--- c/sysdeps/x86_64/fpu/multiarch/e_log.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/sysdeps/x86_64/fpu/multiarch/e_log.c 2012-05-11 12:53:39.491061476 -0600
|
||||
@@ -14,8 +14,7 @@ extern double __ieee754_log_fma4 (double
|
||||
|
||||
libm_ifunc (__ieee754_log,
|
||||
HAS_FMA4 ? __ieee754_log_fma4
|
||||
- : (HAS_AVX ? __ieee754_log_avx
|
||||
- : __ieee754_log_sse2));
|
||||
+ : (HAS_AVX ? __ieee754_log_avx : __ieee754_log_sse2));
|
||||
strong_alias (__ieee754_log, __log_finite)
|
||||
|
||||
# define __ieee754_log __ieee754_log_sse2
|
||||
diff -rup c/sysdeps/x86_64/fpu/multiarch/s_atan.c d/sysdeps/x86_64/fpu/multiarch/s_atan.c
|
||||
--- c/sysdeps/x86_64/fpu/multiarch/s_atan.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/sysdeps/x86_64/fpu/multiarch/s_atan.c 2012-05-11 12:53:39.491061476 -0600
|
||||
@@ -12,7 +12,8 @@ extern double __atan_fma4 (double);
|
||||
# define __atan_fma4 ((void *) 0)
|
||||
# endif
|
||||
|
||||
-libm_ifunc (atan, HAS_FMA4 ? __atan_fma4 : HAS_AVX ? __atan_avx : __atan_sse2);
|
||||
+libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 :
|
||||
+ HAS_AVX ? __atan_avx : __atan_sse2));
|
||||
|
||||
# define atan __atan_sse2
|
||||
#endif
|
||||
diff -rup c/sysdeps/x86_64/fpu/multiarch/s_sin.c d/sysdeps/x86_64/fpu/multiarch/s_sin.c
|
||||
--- c/sysdeps/x86_64/fpu/multiarch/s_sin.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/sysdeps/x86_64/fpu/multiarch/s_sin.c 2012-05-11 12:53:39.491061476 -0600
|
||||
@@ -17,10 +17,12 @@ extern double __sin_fma4 (double);
|
||||
# define __sin_fma4 ((void *) 0)
|
||||
# endif
|
||||
|
||||
-libm_ifunc (__cos, HAS_FMA4 ? __cos_fma4 : HAS_AVX ? __cos_avx : __cos_sse2);
|
||||
+libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 :
|
||||
+ HAS_AVX ? __cos_avx : __cos_sse2));
|
||||
weak_alias (__cos, cos)
|
||||
|
||||
-libm_ifunc (__sin, HAS_FMA4 ? __sin_fma4 : HAS_AVX ? __sin_avx : __sin_sse2);
|
||||
+libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 :
|
||||
+ HAS_AVX ? __sin_avx : __sin_sse2));
|
||||
weak_alias (__sin, sin)
|
||||
|
||||
# define __cos __cos_sse2
|
||||
diff -rup c/sysdeps/x86_64/fpu/multiarch/s_tan.c d/sysdeps/x86_64/fpu/multiarch/s_tan.c
|
||||
--- c/sysdeps/x86_64/fpu/multiarch/s_tan.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/sysdeps/x86_64/fpu/multiarch/s_tan.c 2012-05-11 12:53:39.491061476 -0600
|
||||
@@ -12,7 +12,8 @@ extern double __tan_fma4 (double);
|
||||
# define __tan_fma4 ((void *) 0)
|
||||
# endif
|
||||
|
||||
-libm_ifunc (tan, HAS_FMA4 ? __tan_fma4 : HAS_AVX ? __tan_avx : __tan_sse2);
|
||||
+libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 :
|
||||
+ HAS_AVX ? __tan_avx : __tan_sse2));
|
||||
|
||||
# define tan __tan_sse2
|
||||
#endif
|
||||
diff -rup c/sysdeps/x86_64/multiarch/init-arch.c d/sysdeps/x86_64/multiarch/init-arch.c
|
||||
--- c/sysdeps/x86_64/multiarch/init-arch.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/sysdeps/x86_64/multiarch/init-arch.c 2012-05-11 12:55:29.169490958 -0600
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Initialize CPU feature data.
|
||||
This file is part of the GNU C Library.
|
||||
- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -14,9 +14,8 @@
|
||||
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. */
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <atomic.h>
|
||||
#include <cpuid.h>
|
||||
@@ -144,6 +143,23 @@ __init_cpu_features (void)
|
||||
else
|
||||
kind = arch_kind_other;
|
||||
|
||||
+ if (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_AVX)
|
||||
+ {
|
||||
+ /* Determine if AVX is usable. */
|
||||
+ if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) != 0
|
||||
+ && ({ unsigned int xcrlow;
|
||||
+ unsigned int xcrhigh;
|
||||
+ asm ("xgetbv"
|
||||
+ : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
|
||||
+ (xcrlow & (bit_YMM_state | bit_XMM_state)) ==
|
||||
+ (bit_YMM_state | bit_XMM_state); }))
|
||||
+ __cpu_features.feature[index_AVX_Usable] |= bit_AVX_Usable;
|
||||
+ }
|
||||
+
|
||||
+ /* FMA4 depends on AVX support. */
|
||||
+ if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_80000001].ecx & bit_FMA4) && __cpu_features.feature[index_AVX_Usable])
|
||||
+ __cpu_features.feature[index_FMA4_Usable] |= bit_FMA4_Usable;
|
||||
+
|
||||
__cpu_features.family = family;
|
||||
__cpu_features.model = model;
|
||||
atomic_write_barrier ();
|
||||
diff -rup c/sysdeps/x86_64/multiarch/init-arch.h d/sysdeps/x86_64/multiarch/init-arch.h
|
||||
--- c/sysdeps/x86_64/multiarch/init-arch.h 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/sysdeps/x86_64/multiarch/init-arch.h 2012-05-11 12:55:29.170490953 -0600
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This file is part of the GNU C Library.
|
||||
- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@@ -12,9 +12,8 @@
|
||||
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. */
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define bit_Fast_Rep_String (1 << 0)
|
||||
#define bit_Fast_Copy_Backward (1 << 1)
|
||||
@@ -22,16 +21,24 @@
|
||||
#define bit_Prefer_SSE_for_memop (1 << 3)
|
||||
#define bit_Fast_Unaligned_Load (1 << 4)
|
||||
#define bit_Prefer_PMINUB_for_stringop (1 << 5)
|
||||
+#define bit_AVX_Usable (1 << 6)
|
||||
+#define bit_FMA4_Usable (1 << 7)
|
||||
|
||||
+/* CPUID Feature flags. */
|
||||
#define bit_SSE2 (1 << 26)
|
||||
#define bit_SSSE3 (1 << 9)
|
||||
#define bit_SSE4_1 (1 << 19)
|
||||
#define bit_SSE4_2 (1 << 20)
|
||||
+#define bit_OSXSAVE (1 << 27)
|
||||
#define bit_AVX (1 << 28)
|
||||
#define bit_POPCOUNT (1 << 23)
|
||||
#define bit_FMA (1 << 12)
|
||||
#define bit_FMA4 (1 << 16)
|
||||
|
||||
+/* XCR0 Feature flags. */
|
||||
+#define bit_XMM_state (1 << 1)
|
||||
+#define bit_YMM_state (2 << 1)
|
||||
+
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
# include <ifunc-defines.h>
|
||||
@@ -48,6 +55,8 @@
|
||||
# define index_Prefer_SSE_for_memop FEATURE_INDEX_1*FEATURE_SIZE
|
||||
# define index_Fast_Unaligned_Load FEATURE_INDEX_1*FEATURE_SIZE
|
||||
# define index_Prefer_PMINUB_for_stringop FEATURE_INDEX_1*FEATURE_SIZE
|
||||
+# define index_AVX_Usable FEATURE_INDEX_1*FEATURE_SIZE
|
||||
+# define index_FMA4_Usable FEATURE_INDEX_1*FEATURE_SIZE
|
||||
|
||||
#else /* __ASSEMBLER__ */
|
||||
|
||||
@@ -92,7 +101,7 @@ extern struct cpu_features
|
||||
|
||||
|
||||
extern void __init_cpu_features (void) attribute_hidden;
|
||||
-#define INIT_ARCH()\
|
||||
+# define INIT_ARCH() \
|
||||
do \
|
||||
if (__cpu_features.kind == arch_kind_unknown) \
|
||||
__init_cpu_features (); \
|
||||
@@ -111,37 +120,36 @@ extern const struct cpu_features *__get_
|
||||
|
||||
/* Following are the feature tests used throughout libc. */
|
||||
|
||||
+/* CPUID_* evaluates to true if the feature flag is enabled. */
|
||||
+# define CPUID_OSXSAVE HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_OSXSAVE)
|
||||
+# define CPUID_AVX HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_AVX)
|
||||
+# define CPUID_FMA4 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_80000001, ecx, bit_FMA4)
|
||||
+
|
||||
+/* HAS_* evaluates to true if we may use the feature at runtime. */
|
||||
# define HAS_SSE2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, edx, bit_SSE2)
|
||||
# define HAS_POPCOUNT HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_POPCOUNT)
|
||||
# define HAS_SSSE3 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSSE3)
|
||||
# define HAS_SSE4_1 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_1)
|
||||
# define HAS_SSE4_2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_2)
|
||||
# define HAS_FMA HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_FMA)
|
||||
-# define HAS_AVX HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_AVX)
|
||||
-# define HAS_FMA4 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_80000001, ecx, bit_FMA4)
|
||||
|
||||
# define index_Fast_Rep_String FEATURE_INDEX_1
|
||||
# define index_Fast_Copy_Backward FEATURE_INDEX_1
|
||||
# define index_Slow_BSF FEATURE_INDEX_1
|
||||
# define index_Prefer_SSE_for_memop FEATURE_INDEX_1
|
||||
# define index_Fast_Unaligned_Load FEATURE_INDEX_1
|
||||
+# define index_AVX_Usable FEATURE_INDEX_1
|
||||
+# define index_FMA4_Usable FEATURE_INDEX_1
|
||||
|
||||
-#define HAS_ARCH_FEATURE(idx, bit) \
|
||||
- ((__get_cpu_features ()->feature[idx] & (bit)) != 0)
|
||||
-
|
||||
-#define HAS_FAST_REP_STRING \
|
||||
- HAS_ARCH_FEATURE (index_Fast_Rep_String, bit_Fast_Rep_String)
|
||||
-
|
||||
-#define HAS_FAST_COPY_BACKWARD \
|
||||
- HAS_ARCH_FEATURE (index_Fast_Copy_Backward, bit_Fast_Copy_Backward)
|
||||
-
|
||||
-#define HAS_SLOW_BSF \
|
||||
- HAS_ARCH_FEATURE (index_Slow_BSF, bit_Slow_BSF)
|
||||
-
|
||||
-#define HAS_PREFER_SSE_FOR_MEMOP \
|
||||
- HAS_ARCH_FEATURE (index_Prefer_SSE_for_memop, bit_Prefer_SSE_for_memop)
|
||||
+# define HAS_ARCH_FEATURE(name) \
|
||||
+ ((__get_cpu_features ()->feature[index_##name] & (bit_##name)) != 0)
|
||||
|
||||
-#define HAS_FAST_UNALIGNED_LOAD \
|
||||
- HAS_ARCH_FEATURE (index_Fast_Unaligned_Load, bit_Fast_Unaligned_Load)
|
||||
+# define HAS_FAST_REP_STRING HAS_ARCH_FEATURE (Fast_Rep_String)
|
||||
+# define HAS_FAST_COPY_BACKWARD HAS_ARCH_FEATURE (Fast_Copy_Backward)
|
||||
+# define HAS_SLOW_BSF HAS_ARCH_FEATURE (Slow_BSF)
|
||||
+# define HAS_PREFER_SSE_FOR_MEMOP HAS_ARCH_FEATURE (Prefer_SSE_for_memop)
|
||||
+# define HAS_FAST_UNALIGNED_LOAD HAS_ARCH_FEATURE (Fast_Unaligned_Load)
|
||||
+# define HAS_AVX HAS_ARCH_FEATURE (AVX_Usable)
|
||||
+# define HAS_FMA4 HAS_ARCH_FEATURE (FMA4_Usable)
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
diff -rup c/sysdeps/x86_64/multiarch/strcmp.S d/sysdeps/x86_64/multiarch/strcmp.S
|
||||
--- c/sysdeps/x86_64/multiarch/strcmp.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/sysdeps/x86_64/multiarch/strcmp.S 2012-05-11 12:55:29.172490943 -0600
|
||||
@@ -1,5 +1,5 @@
|
||||
/* strcmp with SSE4.2
|
||||
- Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
Contributed by Intel Corporation.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -107,7 +107,7 @@ ENTRY(__strcasecmp)
|
||||
1:
|
||||
# ifdef HAVE_AVX_SUPPORT
|
||||
leaq __strcasecmp_avx(%rip), %rax
|
||||
- testl $bit_AVX, __cpu_features+CPUID_OFFSET+index_AVX(%rip)
|
||||
+ testl $bit_AVX_Usable, __cpu_features+FEATURE_OFFSET+index_AVX_Usable(%rip)
|
||||
jnz 2f
|
||||
# endif
|
||||
leaq __strcasecmp_sse42(%rip), %rax
|
||||
@@ -130,7 +130,7 @@ ENTRY(__strncasecmp)
|
||||
1:
|
||||
# ifdef HAVE_AVX_SUPPORT
|
||||
leaq __strncasecmp_avx(%rip), %rax
|
||||
- testl $bit_AVX, __cpu_features+CPUID_OFFSET+index_AVX(%rip)
|
||||
+ testl $bit_AVX_Usable, __cpu_features+FEATURE_OFFSET+index_AVX_Usable(%rip)
|
||||
jnz 2f
|
||||
# endif
|
||||
leaq __strncasecmp_sse42(%rip), %rax
|
||||
Only in d/sysdeps/x86_64/multiarch: strcmp.S.orig
|
|
@ -1,241 +0,0 @@
|
|||
commit b8dc394ddfd58bc5d0fe9ecfc970fc42b789a9df
|
||||
Author: Jeff Law <law@redhat.com>
|
||||
Date: Fri Mar 30 09:45:44 2012 -0600
|
||||
|
||||
2012-03-29 Jeff Law <law@redhat.com>
|
||||
|
||||
* crypt/md5-crypt.c (__md5_crypt_r): Avoid unbounded alloca uses
|
||||
due to long keys.
|
||||
* crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
|
||||
* crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
|
||||
|
||||
diff --git a/crypt/md5-crypt.c b/crypt/md5-crypt.c
|
||||
index ba606bb..db4ea9c 100644
|
||||
--- a/crypt/md5-crypt.c
|
||||
+++ b/crypt/md5-crypt.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* One way encryption based on MD5 sum.
|
||||
Compatible with the behavior of MD5 crypt introduced in FreeBSD 2.0.
|
||||
- Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2004, 2009
|
||||
+ Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2004, 2009, 2012
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
@@ -107,6 +107,8 @@ __md5_crypt_r (key, salt, buffer, buflen)
|
||||
char *cp;
|
||||
char *copied_key = NULL;
|
||||
char *copied_salt = NULL;
|
||||
+ char *free_key = NULL;
|
||||
+ size_t alloca_used = 0;
|
||||
|
||||
/* Find beginning of salt string. The prefix should normally always
|
||||
be present. Just in case it is not. */
|
||||
@@ -119,7 +121,17 @@ __md5_crypt_r (key, salt, buffer, buflen)
|
||||
|
||||
if ((key - (char *) 0) % __alignof__ (md5_uint32) != 0)
|
||||
{
|
||||
- char *tmp = (char *) alloca (key_len + __alignof__ (md5_uint32));
|
||||
+ char *tmp;
|
||||
+
|
||||
+ if (__libc_use_alloca (alloca_used + key_len + __alignof__ (md5_uint32)))
|
||||
+ tmp = (char *) alloca (key_len + __alignof__ (md5_uint32));
|
||||
+ else
|
||||
+ {
|
||||
+ free_key = tmp = (char *) malloc (key_len + __alignof__ (md5_uint32));
|
||||
+ if (tmp == NULL)
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
key = copied_key =
|
||||
memcpy (tmp + __alignof__ (md5_uint32)
|
||||
- (tmp - (char *) 0) % __alignof__ (md5_uint32),
|
||||
@@ -141,7 +153,10 @@ __md5_crypt_r (key, salt, buffer, buflen)
|
||||
/* Initialize libfreebl3. */
|
||||
NSSLOWInitContext *nss_ictx = NSSLOW_Init ();
|
||||
if (nss_ictx == NULL)
|
||||
- return NULL;
|
||||
+ {
|
||||
+ free (free_key);
|
||||
+ return NULL;
|
||||
+ }
|
||||
NSSLOWHASHContext *nss_ctx = NULL;
|
||||
NSSLOWHASHContext *nss_alt_ctx = NULL;
|
||||
#else
|
||||
@@ -295,6 +310,7 @@ __md5_crypt_r (key, salt, buffer, buflen)
|
||||
if (copied_salt != NULL)
|
||||
memset (copied_salt, '\0', salt_len);
|
||||
|
||||
+ free (free_key);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
diff --git a/crypt/sha256-crypt.c b/crypt/sha256-crypt.c
|
||||
index eb2585b..440933a 100644
|
||||
--- a/crypt/sha256-crypt.c
|
||||
+++ b/crypt/sha256-crypt.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* One way encryption based on SHA256 sum.
|
||||
- Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2007, 2009, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2007.
|
||||
|
||||
@@ -122,6 +122,9 @@ __sha256_crypt_r (key, salt, buffer, buflen)
|
||||
/* Default number of rounds. */
|
||||
size_t rounds = ROUNDS_DEFAULT;
|
||||
bool rounds_custom = false;
|
||||
+ size_t alloca_used = 0;
|
||||
+ char *free_key = NULL;
|
||||
+ char *free_pbytes = NULL;
|
||||
|
||||
/* Find beginning of salt string. The prefix should normally always
|
||||
be present. Just in case it is not. */
|
||||
@@ -148,7 +151,17 @@ __sha256_crypt_r (key, salt, buffer, buflen)
|
||||
|
||||
if ((key - (char *) 0) % __alignof__ (uint32_t) != 0)
|
||||
{
|
||||
- char *tmp = (char *) alloca (key_len + __alignof__ (uint32_t));
|
||||
+ char *tmp;
|
||||
+
|
||||
+ if (__libc_use_alloca (alloca_used + key_len + __alignof__ (uint32_t)))
|
||||
+ tmp = alloca_account (key_len + __alignof__ (uint32_t), alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ free_key = tmp = (char *) malloc (key_len + __alignof__ (uint32_t));
|
||||
+ if (tmp == NULL)
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
key = copied_key =
|
||||
memcpy (tmp + __alignof__ (uint32_t)
|
||||
- (tmp - (char *) 0) % __alignof__ (uint32_t),
|
||||
@@ -159,6 +172,7 @@ __sha256_crypt_r (key, salt, buffer, buflen)
|
||||
if ((salt - (char *) 0) % __alignof__ (uint32_t) != 0)
|
||||
{
|
||||
char *tmp = (char *) alloca (salt_len + __alignof__ (uint32_t));
|
||||
+ alloca_used += salt_len + __alignof__ (uint32_t);
|
||||
salt = copied_salt =
|
||||
memcpy (tmp + __alignof__ (uint32_t)
|
||||
- (tmp - (char *) 0) % __alignof__ (uint32_t),
|
||||
@@ -170,7 +184,10 @@ __sha256_crypt_r (key, salt, buffer, buflen)
|
||||
/* Initialize libfreebl3. */
|
||||
NSSLOWInitContext *nss_ictx = NSSLOW_Init ();
|
||||
if (nss_ictx == NULL)
|
||||
- return NULL;
|
||||
+ {
|
||||
+ free (free_key);
|
||||
+ return NULL;
|
||||
+ }
|
||||
NSSLOWHASHContext *nss_ctx = NULL;
|
||||
NSSLOWHASHContext *nss_alt_ctx = NULL;
|
||||
#else
|
||||
@@ -233,7 +250,18 @@ __sha256_crypt_r (key, salt, buffer, buflen)
|
||||
sha256_finish_ctx (&alt_ctx, nss_alt_ctx, temp_result);
|
||||
|
||||
/* Create byte sequence P. */
|
||||
- cp = p_bytes = alloca (key_len);
|
||||
+ if (__libc_use_alloca (alloca_used + key_len))
|
||||
+ cp = p_bytes = (char *) alloca (key_len);
|
||||
+ else
|
||||
+ {
|
||||
+ free_pbytes = cp = p_bytes = (char *)malloc (key_len);
|
||||
+ if (free_pbytes == NULL)
|
||||
+ {
|
||||
+ free (free_key);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
for (cnt = key_len; cnt >= 32; cnt -= 32)
|
||||
cp = mempcpy (cp, temp_result, 32);
|
||||
memcpy (cp, temp_result, cnt);
|
||||
@@ -361,6 +389,8 @@ __sha256_crypt_r (key, salt, buffer, buflen)
|
||||
if (copied_salt != NULL)
|
||||
memset (copied_salt, '\0', salt_len);
|
||||
|
||||
+ free (free_key);
|
||||
+ free (free_pbytes);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
diff --git a/crypt/sha512-crypt.c b/crypt/sha512-crypt.c
|
||||
index 8f8ed33..e5d9cac 100644
|
||||
--- a/crypt/sha512-crypt.c
|
||||
+++ b/crypt/sha512-crypt.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* One way encryption based on SHA512 sum.
|
||||
- Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2007, 2009, 2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2007.
|
||||
|
||||
@@ -122,6 +122,9 @@ __sha512_crypt_r (key, salt, buffer, buflen)
|
||||
/* Default number of rounds. */
|
||||
size_t rounds = ROUNDS_DEFAULT;
|
||||
bool rounds_custom = false;
|
||||
+ size_t alloca_used = 0;
|
||||
+ char *free_key = NULL;
|
||||
+ char *free_pbytes = NULL;
|
||||
|
||||
/* Find beginning of salt string. The prefix should normally always
|
||||
be present. Just in case it is not. */
|
||||
@@ -148,7 +151,17 @@ __sha512_crypt_r (key, salt, buffer, buflen)
|
||||
|
||||
if ((key - (char *) 0) % __alignof__ (uint64_t) != 0)
|
||||
{
|
||||
- char *tmp = (char *) alloca (key_len + __alignof__ (uint64_t));
|
||||
+ char *tmp;
|
||||
+
|
||||
+ if (__libc_use_alloca (alloca_used + key_len + __alignof__ (uint64_t)))
|
||||
+ tmp = alloca_account (key_len + __alignof__ (uint64_t), alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ free_key = tmp = (char *) malloc (key_len + __alignof__ (uint64_t));
|
||||
+ if (tmp == NULL)
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
key = copied_key =
|
||||
memcpy (tmp + __alignof__ (uint64_t)
|
||||
- (tmp - (char *) 0) % __alignof__ (uint64_t),
|
||||
@@ -170,7 +183,10 @@ __sha512_crypt_r (key, salt, buffer, buflen)
|
||||
/* Initialize libfreebl3. */
|
||||
NSSLOWInitContext *nss_ictx = NSSLOW_Init ();
|
||||
if (nss_ictx == NULL)
|
||||
- return NULL;
|
||||
+ {
|
||||
+ free (free_key);
|
||||
+ return NULL;
|
||||
+ }
|
||||
NSSLOWHASHContext *nss_ctx = NULL;
|
||||
NSSLOWHASHContext *nss_alt_ctx = NULL;
|
||||
#else
|
||||
@@ -233,7 +249,18 @@ __sha512_crypt_r (key, salt, buffer, buflen)
|
||||
sha512_finish_ctx (&alt_ctx, nss_alt_ctx, temp_result);
|
||||
|
||||
/* Create byte sequence P. */
|
||||
- cp = p_bytes = alloca (key_len);
|
||||
+ if (__libc_use_alloca (alloca_used + key_len))
|
||||
+ cp = p_bytes = (char *) alloca (key_len);
|
||||
+ else
|
||||
+ {
|
||||
+ free_pbytes = cp = p_bytes = (char *)malloc (key_len);
|
||||
+ if (free_pbytes == NULL)
|
||||
+ {
|
||||
+ free (free_key);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
for (cnt = key_len; cnt >= 64; cnt -= 64)
|
||||
cp = mempcpy (cp, temp_result, 64);
|
||||
memcpy (cp, temp_result, cnt);
|
||||
@@ -373,6 +400,8 @@ __sha512_crypt_r (key, salt, buffer, buflen)
|
||||
if (copied_salt != NULL)
|
||||
memset (copied_salt, '\0', salt_len);
|
||||
|
||||
+ free (free_key);
|
||||
+ free (free_pbytes);
|
||||
return buffer;
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
commit 509072a0f7f8a37bedf61a78c0cdd7783368c65a
|
||||
Author: Andreas Jaeger <aj@suse.de>
|
||||
Date: Tue May 15 20:35:53 2012 +0200
|
||||
|
||||
Avoid race in nscd
|
||||
|
||||
2012-05-15 Jeff Law <law@redhat.com>
|
||||
Andreas Jaeger <aj@suse.de>
|
||||
|
||||
[BZ #13594]
|
||||
* nscd/nscd-client.h (__nscd_acquire_maplock): New function, split
|
||||
out from...
|
||||
* nscd/nscd_helper.c (__nscd_get_map_ref): ... here.
|
||||
* nscd/nscd-client.h: Add __nscd_acquire_maplock.
|
||||
* nscd/nscd_gethst_r.c (__nscd_get_nl_timestamp): Add locking to
|
||||
code changing __hst_map_handle.map.
|
||||
|
||||
diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
|
||||
index e57a23c..325368e 100644
|
||||
--- a/nscd/nscd-client.h
|
||||
+++ b/nscd/nscd-client.h
|
||||
@@ -1,5 +1,4 @@
|
||||
-/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2011
|
||||
- Free Software Foundation, Inc.
|
||||
+/* Copyright (c) 1998-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
||||
|
||||
@@ -322,6 +321,24 @@ struct locked_map_ptr
|
||||
};
|
||||
#define libc_locked_map_ptr(class, name) class struct locked_map_ptr name
|
||||
|
||||
+/* Try acquiring lock for mapptr, returns true if it succeeds, false
|
||||
+ if not. */
|
||||
+static inline bool __nscd_acquire_maplock (volatile struct locked_map_ptr *mapptr)
|
||||
+{
|
||||
+ int cnt = 0;
|
||||
+ while (__builtin_expect (atomic_compare_and_exchange_val_acq (&mapptr->lock,
|
||||
+ 1, 0) != 0, 0))
|
||||
+ {
|
||||
+ // XXX Best number of rounds?
|
||||
+ if (__builtin_expect (++cnt > 5, 0))
|
||||
+ return false;
|
||||
+
|
||||
+ atomic_delay ();
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
|
||||
/* Open socket connection to nscd server. */
|
||||
extern int __nscd_open_socket (const char *key, size_t keylen,
|
||||
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
|
||||
index c1661f8..d64ad2e 100644
|
||||
--- a/nscd/nscd_gethst_r.c
|
||||
+++ b/nscd/nscd_gethst_r.c
|
||||
@@ -1,5 +1,4 @@
|
||||
-/* Copyright (C) 1998-2005, 2006, 2007, 2008, 2009, 2011
|
||||
- Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -100,9 +99,18 @@ libc_freeres_fn (hst_map_free)
|
||||
uint32_t
|
||||
__nscd_get_nl_timestamp (void)
|
||||
{
|
||||
+ uint32_t retval;
|
||||
if (__nss_not_use_nscd_hosts != 0)
|
||||
return 0;
|
||||
|
||||
+ /* __nscd_get_mapping can change hst_map_handle.mapped to NO_MAPPING.
|
||||
+ However, __nscd_get_mapping assumes the prior value was not NO_MAPPING.
|
||||
+ Thus we have to acquire the lock to prevent this thread from changing
|
||||
+ hst_map_handle.mapped to NO_MAPPING while another thread is inside
|
||||
+ __nscd_get_mapping. */
|
||||
+ if (!__nscd_acquire_maplock (&__hst_map_handle))
|
||||
+ return 0;
|
||||
+
|
||||
struct mapped_database *map = __hst_map_handle.mapped;
|
||||
|
||||
if (map == NULL
|
||||
@@ -112,9 +120,14 @@ __nscd_get_nl_timestamp (void)
|
||||
map = __nscd_get_mapping (GETFDHST, "hosts", &__hst_map_handle.mapped);
|
||||
|
||||
if (map == NO_MAPPING)
|
||||
- return 0;
|
||||
+ retval = 0;
|
||||
+ else
|
||||
+ retval = map->head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP];
|
||||
+
|
||||
+ /* Release the lock. */
|
||||
+ __hst_map_handle.lock = 0;
|
||||
|
||||
- return map->head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP];
|
||||
+ return retval;
|
||||
}
|
||||
|
||||
|
||||
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
|
||||
index 92558b6..96fb93d 100644
|
||||
--- a/nscd/nscd_helper.c
|
||||
+++ b/nscd/nscd_helper.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 1998-2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@@ -419,7 +419,6 @@ __nscd_get_mapping (request_type type, const char *key,
|
||||
return result;
|
||||
}
|
||||
|
||||
-
|
||||
struct mapped_database *
|
||||
__nscd_get_map_ref (request_type type, const char *name,
|
||||
volatile struct locked_map_ptr *mapptr, int *gc_cyclep)
|
||||
@@ -428,16 +427,8 @@ __nscd_get_map_ref (request_type type, const char *name,
|
||||
if (cur == NO_MAPPING)
|
||||
return cur;
|
||||
|
||||
- int cnt = 0;
|
||||
- while (__builtin_expect (atomic_compare_and_exchange_val_acq (&mapptr->lock,
|
||||
- 1, 0) != 0, 0))
|
||||
- {
|
||||
- // XXX Best number of rounds?
|
||||
- if (__builtin_expect (++cnt > 5, 0))
|
||||
- return NO_MAPPING;
|
||||
-
|
||||
- atomic_delay ();
|
||||
- }
|
||||
+ if (!__nscd_acquire_maplock (mapptr))
|
||||
+ return NO_MAPPING;
|
||||
|
||||
cur = mapptr->mapped;
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/nss/getnssent.c b/nss/getnssent.c
|
||||
index 014b376..bbcfeb8 100644
|
||||
--- a/nss/getnssent.c
|
||||
+++ b/nss/getnssent.c
|
||||
@@ -32,7 +32,7 @@ __nss_getent (getent_r_function func, void **resbuf, char **buffer,
|
||||
*buffer = malloc (*buffer_size);
|
||||
}
|
||||
|
||||
- while (buffer != NULL
|
||||
+ while (*buffer != NULL
|
||||
&& func (resbuf, *buffer, *buffer_size, &result, h_errnop) == ERANGE
|
||||
&& (h_errnop == NULL || *h_errnop == NETDB_INTERNAL))
|
||||
{
|
|
@ -1,411 +0,0 @@
|
|||
diff -Nrup j1/sysdeps/unix/sysv/linux/arm/Makefile j2/sysdeps/unix/sysv/linux/arm/Makefile
|
||||
--- j1/sysdeps/unix/sysv/linux/arm/Makefile 2012-01-08 22:47:04.000000000 -0700
|
||||
+++ j2/sysdeps/unix/sysv/linux/arm/Makefile 2012-04-30 14:02:33.999589709 -0600
|
||||
@@ -20,3 +20,7 @@ endif
|
||||
ifeq ($(subdir),resource)
|
||||
sysdep_routines += oldgetrlimit64
|
||||
endif
|
||||
+
|
||||
+ifeq ($(subdir),stdlib)
|
||||
+gen-as-const-headers += ucontext_i.sym
|
||||
+endif
|
||||
diff -Nrup j1/sysdeps/unix/sysv/linux/arm/eabi/getcontext.S j2/sysdeps/unix/sysv/linux/arm/eabi/getcontext.S
|
||||
--- j1/sysdeps/unix/sysv/linux/arm/eabi/getcontext.S 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ j2/sysdeps/unix/sysv/linux/arm/eabi/getcontext.S 2012-04-30 14:02:34.000589703 -0600
|
||||
@@ -0,0 +1,113 @@
|
||||
+/* Copyright (C) 2012 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/>. */
|
||||
+
|
||||
+#include <sysdep.h>
|
||||
+#include <rtld-global-offsets.h>
|
||||
+
|
||||
+#include "ucontext_i.h"
|
||||
+
|
||||
+ .syntax unified
|
||||
+ .text
|
||||
+
|
||||
+/* int getcontext (ucontext_t *ucp) */
|
||||
+
|
||||
+ENTRY(__getcontext)
|
||||
+ /* No need to save r0-r3, d0-d7, or d16-d31. */
|
||||
+ add r1, r0, #MCONTEXT_ARM_R4
|
||||
+ stmia r1, {r4-r11}
|
||||
+
|
||||
+ /* Save R13 separately as Thumb can't STM it. */
|
||||
+ str r13, [r0, #MCONTEXT_ARM_SP]
|
||||
+ str r14, [r0, #MCONTEXT_ARM_LR]
|
||||
+ /* Return to LR */
|
||||
+ str r14, [r0, #MCONTEXT_ARM_PC]
|
||||
+ /* Return zero */
|
||||
+ mov r2, #0
|
||||
+ str r2, [r0, #MCONTEXT_ARM_R0]
|
||||
+
|
||||
+ /* Save ucontext_t * across the next call. */
|
||||
+ mov r4, r0
|
||||
+
|
||||
+ /* __sigprocmask(SIG_BLOCK, NULL, &(ucontext->uc_sigmask)) */
|
||||
+ mov r0, #SIG_BLOCK
|
||||
+ mov r1, #0
|
||||
+ add r2, r4, #UCONTEXT_SIGMASK
|
||||
+ bl PLTJMP(__sigprocmask)
|
||||
+
|
||||
+ /* Store FP regs. Much of the FP code is copied from arm/eabi/setjmp.S. */
|
||||
+
|
||||
+#ifdef PIC
|
||||
+ ldr r2, 1f
|
||||
+ ldr r1, Lrtld_global_ro
|
||||
+0: add r2, pc, r2
|
||||
+ ldr r2, [r2, r1]
|
||||
+ ldr r2, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
|
||||
+#else
|
||||
+ ldr r2, Lhwcap
|
||||
+ ldr r2, [r2, #0]
|
||||
+#endif
|
||||
+
|
||||
+ add r0, r4, #UCONTEXT_REGSPACE
|
||||
+
|
||||
+ tst r2, #HWCAP_ARM_VFP
|
||||
+ beq Lno_vfp
|
||||
+
|
||||
+ /* Store the VFP registers.
|
||||
+ Don't use VFP instructions directly because this code
|
||||
+ is used in non-VFP multilibs. */
|
||||
+ /* Following instruction is vstmia r0!, {d8-d15}. */
|
||||
+ stc p11, cr8, [r0], #64
|
||||
+ /* Store the floating-point status register. */
|
||||
+ /* Following instruction is vmrs r1, fpscr. */
|
||||
+ mrc p10, 7, r1, cr1, cr0, 0
|
||||
+ str r1, [r0], #4
|
||||
+Lno_vfp:
|
||||
+
|
||||
+ tst r2, #HWCAP_ARM_IWMMXT
|
||||
+ beq Lno_iwmmxt
|
||||
+
|
||||
+ /* Save the call-preserved iWMMXt registers. */
|
||||
+ /* Following instructions are wstrd wr10, [r0], #8 (etc.) */
|
||||
+ stcl p1, cr10, [r0], #8
|
||||
+ stcl p1, cr11, [r0], #8
|
||||
+ stcl p1, cr12, [r0], #8
|
||||
+ stcl p1, cr13, [r0], #8
|
||||
+ stcl p1, cr14, [r0], #8
|
||||
+ stcl p1, cr15, [r0], #8
|
||||
+Lno_iwmmxt:
|
||||
+
|
||||
+ /* Restore the clobbered R4 and LR. */
|
||||
+ ldr r14, [r4, #MCONTEXT_ARM_LR]
|
||||
+ ldr r4, [r4, #MCONTEXT_ARM_R4]
|
||||
+
|
||||
+ mov r0, #0
|
||||
+
|
||||
+ DO_RET(r14)
|
||||
+
|
||||
+END(__getcontext)
|
||||
+
|
||||
+#ifdef PIC
|
||||
+1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8
|
||||
+Lrtld_global_ro:
|
||||
+ .long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
|
||||
+#else
|
||||
+Lhwcap:
|
||||
+ .long C_SYMBOL_NAME(_dl_hwcap)
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+weak_alias(__getcontext, getcontext)
|
||||
diff -Nrup j1/sysdeps/unix/sysv/linux/arm/eabi/makecontext.c j2/sysdeps/unix/sysv/linux/arm/eabi/makecontext.c
|
||||
--- j1/sysdeps/unix/sysv/linux/arm/eabi/makecontext.c 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ j2/sysdeps/unix/sysv/linux/arm/eabi/makecontext.c 2012-04-30 14:02:34.001589697 -0600
|
||||
@@ -0,0 +1,73 @@
|
||||
+/* Copyright (C) 2012 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/>. */
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+#include <ucontext.h>
|
||||
+
|
||||
+/* Number of arguments that go in registers. */
|
||||
+#define NREG_ARGS 4
|
||||
+
|
||||
+/* Take a context previously prepared via getcontext() and set to
|
||||
+ call func() with the given int only args. */
|
||||
+void
|
||||
+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
|
||||
+{
|
||||
+ extern void __startcontext (void);
|
||||
+ unsigned long *funcstack;
|
||||
+ va_list vl;
|
||||
+ unsigned long *regptr;
|
||||
+ unsigned int reg;
|
||||
+ int misaligned;
|
||||
+
|
||||
+ /* Start at the top of stack. */
|
||||
+ funcstack = (unsigned long *) (ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
|
||||
+
|
||||
+ /* Ensure the stack stays eight byte aligned. */
|
||||
+ misaligned = ((unsigned long) funcstack & 4) != 0;
|
||||
+
|
||||
+ if ((argc > NREG_ARGS) && (argc & 1) != 0)
|
||||
+ misaligned = !misaligned;
|
||||
+
|
||||
+ if (misaligned)
|
||||
+ funcstack -= 1;
|
||||
+
|
||||
+ va_start (vl, argc);
|
||||
+
|
||||
+ /* Reserve space for the on-stack arguments. */
|
||||
+ if (argc > NREG_ARGS)
|
||||
+ funcstack -= (argc - NREG_ARGS);
|
||||
+
|
||||
+ ucp->uc_mcontext.arm_sp = (unsigned long) funcstack;
|
||||
+ ucp->uc_mcontext.arm_pc = (unsigned long) func;
|
||||
+
|
||||
+ /* Exit to startcontext() with the next context in R4 */
|
||||
+ ucp->uc_mcontext.arm_r4 = (unsigned long) ucp->uc_link;
|
||||
+ ucp->uc_mcontext.arm_lr = (unsigned long) __startcontext;
|
||||
+
|
||||
+ /* The first four arguments go into registers. */
|
||||
+ regptr = &(ucp->uc_mcontext.arm_r0);
|
||||
+
|
||||
+ for (reg = 0; (reg < argc) && (reg < NREG_ARGS); reg++)
|
||||
+ *regptr++ = va_arg (vl, unsigned long);
|
||||
+
|
||||
+ /* And the remainder on the stack. */
|
||||
+ for (; reg < argc; reg++)
|
||||
+ *funcstack++ = va_arg (vl, unsigned long);
|
||||
+
|
||||
+ va_end (vl);
|
||||
+}
|
||||
+weak_alias (__makecontext, makecontext)
|
||||
diff -Nrup j1/sysdeps/unix/sysv/linux/arm/eabi/setcontext.S j2/sysdeps/unix/sysv/linux/arm/eabi/setcontext.S
|
||||
--- j1/sysdeps/unix/sysv/linux/arm/eabi/setcontext.S 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ j2/sysdeps/unix/sysv/linux/arm/eabi/setcontext.S 2012-04-30 14:02:34.049589449 -0600
|
||||
@@ -0,0 +1,101 @@
|
||||
+/* Copyright (C) 2012 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/>. */
|
||||
+
|
||||
+#include <sysdep.h>
|
||||
+#include <rtld-global-offsets.h>
|
||||
+
|
||||
+#include "ucontext_i.h"
|
||||
+
|
||||
+ .syntax unified
|
||||
+ .text
|
||||
+
|
||||
+/* int setcontext (const ucontext_t *ucp) */
|
||||
+
|
||||
+ENTRY(__setcontext)
|
||||
+ mov r4, r0
|
||||
+ add r0, r0, #UCONTEXT_REGSPACE
|
||||
+
|
||||
+ /* Restore the VFP registers. Copied from arm/eabi/__longjmp.S. */
|
||||
+#ifdef PIC
|
||||
+ ldr r2, 1f
|
||||
+ ldr r1, Lrtld_global_ro
|
||||
+0: add r2, pc, r2
|
||||
+ ldr r2, [r2, r1]
|
||||
+ ldr r2, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
|
||||
+#else
|
||||
+ ldr r2, Lhwcap
|
||||
+ ldr r2, [r2, #0]
|
||||
+#endif
|
||||
+
|
||||
+ tst r2, #HWCAP_ARM_VFP
|
||||
+ beq Lno_vfp_sc
|
||||
+
|
||||
+ /* Following instruction is vldmia r0!, {d8-d15}. */
|
||||
+ ldc p11, cr8, [r0], #64
|
||||
+ /* Restore the floating-point status register. */
|
||||
+ ldr r1, [r0], #4
|
||||
+ /* Following instruction is fmxr fpscr, r1. */
|
||||
+ mcr p10, 7, r1, cr1, cr0, 0
|
||||
+Lno_vfp_sc:
|
||||
+ tst r2, #HWCAP_ARM_IWMMXT
|
||||
+ beq Lno_iwmmxt_sc
|
||||
+
|
||||
+ /* Restore the call-preserved iWMMXt registers. */
|
||||
+ /* Following instructions are wldrd wr10, [r0], #8 (etc.) */
|
||||
+ ldcl p1, cr10, [r0], #8
|
||||
+ ldcl p1, cr11, [r0], #8
|
||||
+ ldcl p1, cr12, [r0], #8
|
||||
+ ldcl p1, cr13, [r0], #8
|
||||
+ ldcl p1, cr14, [r0], #8
|
||||
+ ldcl p1, cr15, [r0], #8
|
||||
+Lno_iwmmxt_sc:
|
||||
+
|
||||
+ /* Now bring back the signal status. */
|
||||
+ mov r0, #SIG_SETMASK
|
||||
+ add r1, r4, #UCONTEXT_SIGMASK
|
||||
+ mov r2, #0
|
||||
+ bl PLTJMP(__sigprocmask)
|
||||
+
|
||||
+ /* Loading r0-r3 makes makecontext easier. */
|
||||
+ add r14, r4, #MCONTEXT_ARM_R0
|
||||
+ ldmia r14, {r0-r12}
|
||||
+ ldr r13, [r14, #(MCONTEXT_ARM_SP - MCONTEXT_ARM_R0)]
|
||||
+ add r14, r14, #(MCONTEXT_ARM_LR - MCONTEXT_ARM_R0)
|
||||
+ ldmia r14, {r14, pc}
|
||||
+
|
||||
+END(setcontext)
|
||||
+weak_alias(__setcontext, setcontext)
|
||||
+
|
||||
+ /* Called when a makecontext() context returns. Start the
|
||||
+ context in R4 or fall through to exit(). */
|
||||
+ENTRY(__startcontext)
|
||||
+ movs r0, r4
|
||||
+ bne PLTJMP(__setcontext)
|
||||
+
|
||||
+ @ New context was 0 - exit
|
||||
+ b PLTJMP(_exit)
|
||||
+END(__startcontext)
|
||||
+
|
||||
+#ifdef PIC
|
||||
+1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8
|
||||
+Lrtld_global_ro:
|
||||
+ .long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
|
||||
+#else
|
||||
+Lhwcap:
|
||||
+ .long C_SYMBOL_NAME(_dl_hwcap)
|
||||
+#endif
|
||||
+
|
||||
diff -Nrup j1/sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S j2/sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S
|
||||
--- j1/sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ j2/sysdeps/unix/sysv/linux/arm/eabi/swapcontext.S 2012-04-30 14:02:34.050589444 -0600
|
||||
@@ -0,0 +1,63 @@
|
||||
+/* Copyright (C) 2012 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/>. */
|
||||
+
|
||||
+#include <sysdep.h>
|
||||
+
|
||||
+#include "ucontext_i.h"
|
||||
+
|
||||
+ .syntax unified
|
||||
+ .text
|
||||
+
|
||||
+/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
|
||||
+
|
||||
+ENTRY(swapcontext)
|
||||
+
|
||||
+ /* Have getcontext() do most of the work then fix up
|
||||
+ LR afterwards. Save R3 to keep the stack aligned. */
|
||||
+ push {r0,r1,r3,r14}
|
||||
+ cfi_adjust_cfa_offset (16)
|
||||
+ cfi_rel_offset (r0,0)
|
||||
+ cfi_rel_offset (r1,4)
|
||||
+ cfi_rel_offset (r3,8)
|
||||
+ cfi_rel_offset (r14,12)
|
||||
+
|
||||
+ bl __getcontext
|
||||
+ mov r4, r0
|
||||
+
|
||||
+ pop {r0,r1,r3,r14}
|
||||
+ cfi_adjust_cfa_offset (-16)
|
||||
+ cfi_restore (r0)
|
||||
+ cfi_restore (r1)
|
||||
+ cfi_restore (r3)
|
||||
+ cfi_restore (r14)
|
||||
+
|
||||
+ /* Exit if getcontext() failed. */
|
||||
+ cmp r4, #0
|
||||
+ itt ne
|
||||
+ movne r0, r4
|
||||
+ RETINSTR(ne, r14)
|
||||
+
|
||||
+ /* Fix up LR and the PC. */
|
||||
+ str r13,[r0, #MCONTEXT_ARM_SP]
|
||||
+ str r14,[r0, #MCONTEXT_ARM_LR]
|
||||
+ str r14,[r0, #MCONTEXT_ARM_PC]
|
||||
+
|
||||
+ /* And swap using swapcontext(). */
|
||||
+ mov r0, r1
|
||||
+ b __setcontext
|
||||
+
|
||||
+END(swapcontext)
|
||||
diff -Nrup j1/sysdeps/unix/sysv/linux/arm/ucontext_i.sym j2/sysdeps/unix/sysv/linux/arm/ucontext_i.sym
|
||||
--- j1/sysdeps/unix/sysv/linux/arm/ucontext_i.sym 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ j2/sysdeps/unix/sysv/linux/arm/ucontext_i.sym 2012-04-30 14:02:34.051589439 -0600
|
||||
@@ -0,0 +1,30 @@
|
||||
+#include <inttypes.h>
|
||||
+#include <signal.h>
|
||||
+#include <stddef.h>
|
||||
+#include <sys/ucontext.h>
|
||||
+
|
||||
+SIG_BLOCK
|
||||
+SIG_SETMASK
|
||||
+
|
||||
+-- Offsets of the fields in the ucontext_t structure.
|
||||
+#define ucontext(member) offsetof (ucontext_t, member)
|
||||
+#define mcontext(member) ucontext (uc_mcontext.member)
|
||||
+
|
||||
+UCONTEXT_FLAGS ucontext (uc_flags)
|
||||
+UCONTEXT_LINK ucontext (uc_link)
|
||||
+UCONTEXT_STACK ucontext (uc_stack)
|
||||
+UCONTEXT_MCONTEXT ucontext (uc_mcontext)
|
||||
+UCONTEXT_SIGMASK ucontext (uc_sigmask)
|
||||
+
|
||||
+UCONTEXT_REGSPACE ucontext (uc_regspace)
|
||||
+
|
||||
+MCONTEXT_TRAP_NO mcontext (trap_no)
|
||||
+MCONTEXT_ERROR_CODE mcontext (error_code)
|
||||
+MCONTEXT_OLDMASK mcontext (oldmask)
|
||||
+MCONTEXT_ARM_R0 mcontext (arm_r0)
|
||||
+MCONTEXT_ARM_R4 mcontext (arm_r4)
|
||||
+MCONTEXT_ARM_SP mcontext (arm_sp)
|
||||
+MCONTEXT_ARM_LR mcontext (arm_lr)
|
||||
+MCONTEXT_ARM_PC mcontext (arm_pc)
|
||||
+MCONTEXT_ARM_CPSR mcontext (arm_cpsr)
|
||||
+MCONTEXT_FAULT_ADDRESS mcontext (fault_address)
|
|
@ -1,16 +1,16 @@
|
|||
diff -rup a/sysdeps/ieee754/dbl-64/slowexp.c b/sysdeps/ieee754/dbl-64/slowexp.c
|
||||
--- a/sysdeps/ieee754/dbl-64/slowexp.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/ieee754/dbl-64/slowexp.c 2012-03-13 11:57:51.225330782 -0600
|
||||
@@ -31,6 +31,8 @@
|
||||
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
|
||||
+++ d/sysdeps/ieee754/dbl-64/slowexp.c 2012-05-21 10:02:51.693957300 -0600
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "mpa.h"
|
||||
#include "math_private.h"
|
||||
#include <math_private.h>
|
||||
|
||||
+#include <stap-probe.h>
|
||||
+
|
||||
#ifndef SECTION
|
||||
# define SECTION
|
||||
#endif
|
||||
@@ -61,12 +63,21 @@ __slowexp(double x) {
|
||||
@@ -60,12 +62,21 @@ __slowexp(double x) {
|
||||
__sub(&mpy,&mpcor,&mpz,p);
|
||||
__mp_dbl(&mpw, &w, p);
|
||||
__mp_dbl(&mpz, &z, p);
|
||||
|
@ -33,19 +33,19 @@ diff -rup a/sysdeps/ieee754/dbl-64/slowexp.c b/sysdeps/ieee754/dbl-64/slowexp.c
|
|||
return res;
|
||||
}
|
||||
}
|
||||
diff -rup a/sysdeps/ieee754/dbl-64/slowpow.c b/sysdeps/ieee754/dbl-64/slowpow.c
|
||||
--- a/sysdeps/ieee754/dbl-64/slowpow.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/ieee754/dbl-64/slowpow.c 2012-03-13 11:57:59.865284437 -0600
|
||||
@@ -35,6 +35,8 @@
|
||||
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
|
||||
+++ d/sysdeps/ieee754/dbl-64/slowpow.c 2012-05-21 10:02:51.694957291 -0600
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "mpa.h"
|
||||
#include "math_private.h"
|
||||
#include <math_private.h>
|
||||
|
||||
+#include <stap-probe.h>
|
||||
+
|
||||
#ifndef SECTION
|
||||
# define SECTION
|
||||
#endif
|
||||
@@ -66,7 +68,12 @@ __slowpow(double x, double y, double z)
|
||||
@@ -65,7 +67,12 @@ __slowpow(double x, double y, double z)
|
||||
__mp_dbl(&mpr, &res, p);
|
||||
__sub(&mpp,&eps,&mpr1,p); /* pp -eps =r1 */
|
||||
__mp_dbl(&mpr1, &res1, p); /* converting into double precision */
|
||||
|
@ -59,7 +59,7 @@ diff -rup a/sysdeps/ieee754/dbl-64/slowpow.c b/sysdeps/ieee754/dbl-64/slowpow.c
|
|||
|
||||
p = 32; /* if we get here result wasn't calculated exactly, continue */
|
||||
__dbl_mp(x,&mpx,p); /* for more exact calculation */
|
||||
@@ -76,5 +83,10 @@ __slowpow(double x, double y, double z)
|
||||
@@ -75,5 +82,10 @@ __slowpow(double x, double y, double z)
|
||||
__mul(&mpy,&mpz,&mpw,p); /* y*z =w */
|
||||
__mpexp(&mpw, &mpp, p); /* e^w=pp */
|
||||
__mp_dbl(&mpp, &res, p); /* converting into double precision */
|
||||
|
|
788
glibc-stap.patch
788
glibc-stap.patch
|
@ -1,270 +1,157 @@
|
|||
diff -Nrup a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh
|
||||
--- a/scripts/check-local-headers.sh 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/scripts/check-local-headers.sh 2012-01-01 20:41:26.683439836 -0700
|
||||
@@ -29,7 +29,7 @@ exec ${AWK} -v includedir="$includedir"
|
||||
BEGIN {
|
||||
status = 0
|
||||
exclude = "^" includedir \
|
||||
- "/(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h)"
|
||||
+ "/(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h|sys/sdt(-config)?\\.h))"
|
||||
}
|
||||
/^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
|
||||
{
|
||||
diff -Nrup a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
|
||||
--- a/sysdeps/i386/__longjmp.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/i386/__longjmp.S 2012-01-01 20:41:26.686439835 -0700
|
||||
@@ -1,5 +1,5 @@
|
||||
/* longjmp for i386.
|
||||
- Copyright (C) 1995-1998,2000,2002,2005,2006,2009
|
||||
+ Copyright (C) 1995-1998,2000,2002,2005,2006,2009,2011
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
diff -Nrup c/config.h.in d/config.h.in
|
||||
--- c/config.h.in 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/config.h.in 2012-05-20 23:51:59.511489307 -0600
|
||||
@@ -208,6 +208,9 @@
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
.text
|
||||
ENTRY (__longjmp)
|
||||
@@ -33,6 +34,7 @@ ENTRY (__longjmp)
|
||||
movl (JB_SP*4)(%eax), %ecx
|
||||
PTR_DEMANGLE (%edx)
|
||||
PTR_DEMANGLE (%ecx)
|
||||
+ LIBC_PROBE (longjmp, 3, 4@%eax, -4@8(%esp), 4@%edx)
|
||||
cfi_def_cfa(%eax, 0)
|
||||
cfi_register(%eip, %edx)
|
||||
cfi_register(%esp, %ecx)
|
||||
@@ -50,6 +52,7 @@ ENTRY (__longjmp)
|
||||
cfi_restore(%edi)
|
||||
cfi_restore(%ebp)
|
||||
|
||||
+ LIBC_PROBE (longjmp_target, 3, 4@%eax, -4@8(%esp), 4@%edx)
|
||||
movl 8(%esp), %eax /* Second argument is return value. */
|
||||
movl %ecx, %esp
|
||||
#else
|
||||
@@ -57,12 +60,14 @@ ENTRY (__longjmp)
|
||||
movl 8(%esp), %eax /* Second argument is return value. */
|
||||
/* Save the return address now. */
|
||||
movl (JB_PC*4)(%ecx), %edx
|
||||
+ LIBC_PROBE (longjmp, 3, 4@%ecx, -4@%eax, 4@%edx)
|
||||
/* Restore registers. */
|
||||
movl (JB_BX*4)(%ecx), %ebx
|
||||
movl (JB_SI*4)(%ecx), %esi
|
||||
movl (JB_DI*4)(%ecx), %edi
|
||||
movl (JB_BP*4)(%ecx), %ebp
|
||||
movl (JB_SP*4)(%ecx), %esp
|
||||
+ LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%ecx, 4@%edx)
|
||||
#endif
|
||||
/* Jump to saved PC. */
|
||||
jmp *%edx
|
||||
diff -Nrup a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
|
||||
--- a/sysdeps/i386/bsd-_setjmp.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/i386/bsd-_setjmp.S 2012-01-01 20:41:26.686439835 -0700
|
||||
@@ -1,5 +1,6 @@
|
||||
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version.
|
||||
- Copyright (C) 1994-1997,2000-2002,2005, 2006 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1994-1997,2000-2002,2005,2006,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
|
||||
@@ -25,6 +26,7 @@
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
+#include <stap-probe.h>
|
||||
+/* Define if Systemtap <sys/sdt.h> probes should be defined. */
|
||||
+#undef USE_STAP_PROBE
|
||||
+
|
||||
/*
|
||||
*/
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define JMPBUF PARMS
|
||||
@@ -47,6 +49,7 @@ ENTRY (BP_SYM (_setjmp))
|
||||
#endif
|
||||
movl %ecx, (JB_SP*4)(%edx)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 4@%edx, -4@$0, 4@%ecx)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%ecx)
|
||||
#endif
|
||||
diff -Nrup a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
|
||||
--- a/sysdeps/i386/bsd-setjmp.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/i386/bsd-setjmp.S 2012-01-01 20:41:26.687439834 -0700
|
||||
@@ -1,5 +1,6 @@
|
||||
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version.
|
||||
- Copyright (C) 1994-1997,2000,2001,2005, 2006 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1994-1997,2000,2001,2005,2006,2011
|
||||
+ Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
diff -Nrup c/configure d/configure
|
||||
--- c/configure 2012-05-20 23:51:08.075734606 -0600
|
||||
+++ d/configure 2012-05-20 23:53:48.520969358 -0600
|
||||
@@ -1441,6 +1441,7 @@ Optional Features:
|
||||
--enable-nss-crypt enable libcrypt to use nss
|
||||
--enable-obsolete-rpc build and install the obsolete RPC code for
|
||||
link-time usage
|
||||
+ --enable-systemtap enable systemtap static probe points [default=no]
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -25,6 +26,7 @@
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
+#include <stap-probe.h>
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@@ -3767,6 +3768,51 @@ if test "$link_obsolete_rpc" = yes; then
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define JMPBUF PARMS
|
||||
@@ -49,6 +51,7 @@ ENTRY (BP_SYM (setjmp))
|
||||
#endif
|
||||
movl %ecx, (JB_SP*4)(%eax)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 4@%eax, -4@$1, 4@%ecx)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%ecx)
|
||||
#endif
|
||||
diff -Nrup a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
|
||||
--- a/sysdeps/i386/setjmp.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/i386/setjmp.S 2012-01-01 20:41:26.687439834 -0700
|
||||
@@ -1,5 +1,5 @@
|
||||
/* setjmp for i386.
|
||||
- Copyright (C) 1995,1996,1997,2000,2001,2005,2006
|
||||
+ Copyright (C) 1995,1996,1997,2000,2001,2005,2006,2011
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
fi
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <asm-syntax.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
+#include <stap-probe.h>
|
||||
+# Check whether --enable-systemtap was given.
|
||||
+if test "${enable_systemtap+set}" = set; then :
|
||||
+ enableval=$enable_systemtap; systemtap=$enableval
|
||||
+else
|
||||
+ systemtap=no
|
||||
+fi
|
||||
+
|
||||
+if test x$systemtap != xno; then
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemtap static probe support" >&5
|
||||
+$as_echo_n "checking for systemtap static probe support... " >&6; }
|
||||
+if test "${libc_cv_sdt+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ old_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="-std=gnu99 $CFLAGS"
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+#include <sys/sdt.h>
|
||||
+void foo (int i, void *p)
|
||||
+{
|
||||
+ asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
|
||||
+ :: STAP_PROBE_ASM_OPERANDS (2, i, p));
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_compile "$LINENO"; then :
|
||||
+ libc_cv_sdt=yes
|
||||
+else
|
||||
+ libc_cv_sdt=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
+ CFLAGS="$old_CFLAGS"
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sdt" >&5
|
||||
+$as_echo "$libc_cv_sdt" >&6; }
|
||||
+ if test $libc_cv_sdt = yes; then
|
||||
+ $as_echo "#define USE_STAP_PROBE 1" >>confdefs.h
|
||||
+
|
||||
+ else
|
||||
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
+as_fn_error $? "systemtap support needs sys/sdt.h with asm support
|
||||
+See \`config.log' for more details" "$LINENO" 5; }
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
# The way shlib-versions is used to generate soversions.mk uses a
|
||||
# fairly simplistic model for name recognition that can't distinguish
|
||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
||||
diff -Nrup c/configure.in d/configure.in
|
||||
--- c/configure.in 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/configure.in 2012-05-20 23:51:59.558489083 -0600
|
||||
@@ -263,6 +263,29 @@ if test "$link_obsolete_rpc" = yes; then
|
||||
AC_DEFINE(LINK_OBSOLETE_RPC)
|
||||
fi
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define JMPBUF PARMS
|
||||
@@ -44,6 +45,7 @@ ENTRY (BP_SYM (__sigsetjmp))
|
||||
#endif
|
||||
movl %ecx, (JB_SP*4)(%eax)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 4@%eax, -4@SIGMSK(%esp), 4@%ecx)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%ecx)
|
||||
#endif
|
||||
diff -Nrup a/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S b/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
|
||||
--- a/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S 2012-01-01 20:41:26.699439832 -0700
|
||||
@@ -1,4 +1,5 @@
|
||||
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 2001,2004,2005,2006,2009,2011
|
||||
+ Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
+AC_ARG_ENABLE([systemtap],
|
||||
+ [AS_HELP_STRING([--enable-systemtap],
|
||||
+ [enable systemtap static probe points @<:@default=no@:>@])],
|
||||
+ [systemtap=$enableval],
|
||||
+ [systemtap=no])
|
||||
+if test x$systemtap != xno; then
|
||||
+ AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
|
||||
+ old_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="-std=gnu99 $CFLAGS"
|
||||
+ AC_COMPILE_IFELSE([#include <sys/sdt.h>
|
||||
+void foo (int i, void *p)
|
||||
+{
|
||||
+ asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
|
||||
+ :: STAP_PROBE_ASM_OPERANDS (2, i, p));
|
||||
+}], [libc_cv_sdt=yes], [libc_cv_sdt=no])
|
||||
+ CFLAGS="$old_CFLAGS"])
|
||||
+ if test $libc_cv_sdt = yes; then
|
||||
+ AC_DEFINE([USE_STAP_PROBE])
|
||||
+ else
|
||||
+ AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
# The way shlib-versions is used to generate soversions.mk uses a
|
||||
# fairly simplistic model for name recognition that can't distinguish
|
||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
||||
diff -Nrup c/elf/Makefile d/elf/Makefile
|
||||
--- c/elf/Makefile 2012-05-20 23:51:07.907735407 -0600
|
||||
+++ d/elf/Makefile 2012-05-20 23:51:59.561489070 -0600
|
||||
@@ -423,7 +423,8 @@ CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
|
||||
CFLAGS-cache.c = $(SYSCONF-FLAGS)
|
||||
CFLAGS-rtld.c = $(SYSCONF-FLAGS)
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -19,6 +20,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
-CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
|
||||
+CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
|
||||
+ -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
|
||||
|
||||
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
|
||||
generated += $(addsuffix .so,$(strip $(modules-names)))
|
||||
diff -Nrup c/elf/rtld-Rules d/elf/rtld-Rules
|
||||
--- c/elf/rtld-Rules 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/elf/rtld-Rules 2012-05-20 23:51:59.561489070 -0600
|
||||
@@ -1,7 +1,7 @@
|
||||
# Subroutine makefile for compiling libc modules linked into dynamic linker.
|
||||
|
||||
.section .rodata.str1.1,"aMS",@progbits,1
|
||||
@@ -79,7 +81,9 @@ ENTRY (____longjmp_chk)
|
||||
cfi_adjust_cfa_offset(-12)
|
||||
movl 4(%esp), %ecx
|
||||
# Copyright (C) 2002,2003,2005,2006,2008,2010,2011
|
||||
-# Free Software Foundation, Inc.
|
||||
+# Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
-.Lok: /* We add unwind information for the target here. */
|
||||
+.Lok:
|
||||
+ LIBC_PROBE (longjmp, 3, 4@%ecx, -4@8(%esp), 4@%edx)
|
||||
+ /* We add unwind information for the target here. */
|
||||
cfi_def_cfa(%ecx, 0)
|
||||
cfi_register(%eip, %edx)
|
||||
cfi_register(%esp, %edi)
|
||||
@@ -102,5 +106,6 @@ ENTRY (____longjmp_chk)
|
||||
cfi_restore(%ebp)
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -130,6 +130,6 @@ ifdef rtld-depfiles
|
||||
endif
|
||||
|
||||
/* Jump to saved PC. */
|
||||
+ LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%eax, 4@%edx)
|
||||
jmp *%edx
|
||||
END (____longjmp_chk)
|
||||
diff -Nrup a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
|
||||
--- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S 2012-01-01 20:41:26.703439831 -0700
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
# This here is the whole point of all the shenanigans.
|
||||
-rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1
|
||||
+rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld
|
||||
|
||||
.section .rodata.str1.1,"aMS",@progbits,1
|
||||
.type longjmp_msg,@object
|
||||
@@ -94,7 +95,9 @@ ENTRY(____longjmp_chk)
|
||||
movl %ebx, %esi
|
||||
cfi_restore (%rsi)
|
||||
endif
|
||||
diff -Nrup c/extra-lib.mk d/extra-lib.mk
|
||||
--- c/extra-lib.mk 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/extra-lib.mk 2012-05-20 23:51:59.559489078 -0600
|
||||
@@ -101,4 +101,4 @@ ifneq (,$(cpp-srcs-left))
|
||||
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
||||
endif
|
||||
|
||||
-.Lok: /* We add unwind information for the target here. */
|
||||
+.Lok:
|
||||
+ LIBC_PROBE (longjmp, 3, 8@%rdi, -4@%esi, 8@%rdx)
|
||||
+ /* We add unwind information for the target here. */
|
||||
cfi_def_cfa(%rdi, 0)
|
||||
cfi_register(%rsp,%r8)
|
||||
cfi_register(%rbp,%r9)
|
||||
@@ -113,5 +116,6 @@ ENTRY(____longjmp_chk)
|
||||
movl %esi, %eax
|
||||
movq %r8,%rsp
|
||||
movq %r9,%rbp
|
||||
+ LIBC_PROBE (longjmp_target, 3, 8@%rdi, -4@%eax, 8@%rdx)
|
||||
jmpq *%rdx
|
||||
END (____longjmp_chk)
|
||||
diff -Nrup a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
|
||||
--- a/sysdeps/x86_64/__longjmp.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/x86_64/__longjmp.S 2012-01-01 20:41:26.703439831 -0700
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 2001,2004,2005,2006,2009,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
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
/* Jump to the position specified by ENV, causing the
|
||||
setjmp call there to return VAL, or 1 if VAL is 0.
|
||||
@@ -34,6 +35,7 @@ ENTRY(__longjmp)
|
||||
PTR_DEMANGLE (%r9)
|
||||
PTR_DEMANGLE (%rdx)
|
||||
#endif
|
||||
+ LIBC_PROBE (longjmp, 3, 8@%rdi, -4@%esi, 8@%rdx)
|
||||
/* We add unwind information for the target here. */
|
||||
cfi_def_cfa(%rdi, 0)
|
||||
cfi_register(%rsp,%r8)
|
||||
@@ -53,5 +55,6 @@ ENTRY(__longjmp)
|
||||
mov %esi, %eax
|
||||
movq %r8,%rsp
|
||||
movq %r9,%rbp
|
||||
+ LIBC_PROBE (longjmp_target, 3, 8@%rdi, -4@%eax, 8@%rdx)
|
||||
jmpq *%rdx
|
||||
END (__longjmp)
|
||||
diff -Nrup a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
|
||||
--- a/sysdeps/x86_64/setjmp.S 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/sysdeps/x86_64/setjmp.S 2012-01-01 20:41:26.704439831 -0700
|
||||
@@ -1,5 +1,5 @@
|
||||
/* setjmp for x86-64.
|
||||
- Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2001,2003,2005,2006,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
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
ENTRY (__sigsetjmp)
|
||||
/* Save registers. */
|
||||
@@ -41,6 +42,7 @@ ENTRY (__sigsetjmp)
|
||||
#endif
|
||||
movq %rdx, (JB_RSP*8)(%rdi)
|
||||
movq (%rsp), %rax /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 8@%rdi, -4@%esi, 8@%rax)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%rax)
|
||||
#endif
|
||||
diff -Nrup a/include/stap-probe.h b/include/stap-probe.h
|
||||
--- a/include/stap-probe.h 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ b/include/stap-probe.h 2012-01-01 20:41:26.646439841 -0700
|
||||
-CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
|
||||
+CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1 -DIN_LIB=$(lib)
|
||||
diff -Nrup c/include/stap-probe.h d/include/stap-probe.h
|
||||
--- c/include/stap-probe.h 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ d/include/stap-probe.h 2012-05-20 23:51:59.510489312 -0600
|
||||
@@ -0,0 +1,140 @@
|
||||
+/* Macros for defining Systemtap <sys/sdt.h> static probe points.
|
||||
+ Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
|
@ -406,162 +293,267 @@ diff -Nrup a/include/stap-probe.h b/include/stap-probe.h
|
|||
+#endif /* USE_STAP_PROBE. */
|
||||
+
|
||||
+#endif /* stap-probe.h */
|
||||
diff -Nrup a/config.h.in b/config.h.in
|
||||
--- a/config.h.in 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/config.h.in 2012-01-01 20:41:26.632439843 -0700
|
||||
@@ -187,6 +187,9 @@
|
||||
/* Define if `.ctors' and `.dtors' sections shouldn't be used. */
|
||||
#undef NO_CTORS_DTORS_SECTIONS
|
||||
diff -Nrup c/scripts/check-local-headers.sh d/scripts/check-local-headers.sh
|
||||
--- c/scripts/check-local-headers.sh 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/scripts/check-local-headers.sh 2012-05-20 23:54:51.258670072 -0600
|
||||
@@ -28,7 +28,7 @@ exec ${AWK} -v includedir="$includedir"
|
||||
BEGIN {
|
||||
status = 0
|
||||
exclude = "^" includedir \
|
||||
- "/(.*-.*-.*/|)(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h)"
|
||||
+ "/(.*-.*-.*/|)(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h|sys/sdt(-config)?\\.h))"
|
||||
}
|
||||
/^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
|
||||
{
|
||||
diff -Nrup c/sysdeps/i386/__longjmp.S d/sysdeps/i386/__longjmp.S
|
||||
--- c/sysdeps/i386/__longjmp.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/i386/__longjmp.S 2012-05-20 23:51:59.478489471 -0600
|
||||
@@ -1,5 +1,5 @@
|
||||
/* longjmp for i386.
|
||||
- Copyright (C) 1995-1998,2000,2002,2005,2006,2009
|
||||
+ Copyright (C) 1995-1998,2000,2002,2005,2006,2009,2011
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
+/* Define if Systemtap <sys/sdt.h> probes should be defined. */
|
||||
+#undef USE_STAP_PROBE
|
||||
+
|
||||
/*
|
||||
*/
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
diff -Nrup a/configure b/configure
|
||||
--- a/configure 2012-01-01 20:40:50.423446105 -0700
|
||||
+++ b/configure 2012-01-01 20:41:26.634439843 -0700
|
||||
@@ -791,6 +791,7 @@ enable_kernel
|
||||
enable_all_warnings
|
||||
enable_multi_arch
|
||||
enable_nss_crypt
|
||||
+enable_systemtap
|
||||
with_cpu
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
@@ -1450,6 +1451,7 @@ Optional Features:
|
||||
--enable-multi-arch enable single DSO with optimizations for multiple
|
||||
architectures
|
||||
--enable-nss-crypt enable libcrypt to use nss
|
||||
+ --enable-systemtap enable systemtap static probe points [default=no]
|
||||
.text
|
||||
ENTRY (__longjmp)
|
||||
@@ -32,6 +33,7 @@ ENTRY (__longjmp)
|
||||
movl (JB_SP*4)(%eax), %ecx
|
||||
PTR_DEMANGLE (%edx)
|
||||
PTR_DEMANGLE (%ecx)
|
||||
+ LIBC_PROBE (longjmp, 3, 4@%eax, -4@8(%esp), 4@%edx)
|
||||
cfi_def_cfa(%eax, 0)
|
||||
cfi_register(%eip, %edx)
|
||||
cfi_register(%esp, %ecx)
|
||||
@@ -49,6 +51,7 @@ ENTRY (__longjmp)
|
||||
cfi_restore(%edi)
|
||||
cfi_restore(%ebp)
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@@ -3804,6 +3806,51 @@ else
|
||||
fi
|
||||
+ LIBC_PROBE (longjmp_target, 3, 4@%eax, -4@8(%esp), 4@%edx)
|
||||
movl 8(%esp), %eax /* Second argument is return value. */
|
||||
movl %ecx, %esp
|
||||
#else
|
||||
@@ -56,12 +59,14 @@ ENTRY (__longjmp)
|
||||
movl 8(%esp), %eax /* Second argument is return value. */
|
||||
/* Save the return address now. */
|
||||
movl (JB_PC*4)(%ecx), %edx
|
||||
+ LIBC_PROBE (longjmp, 3, 4@%ecx, -4@%eax, 4@%edx)
|
||||
/* Restore registers. */
|
||||
movl (JB_BX*4)(%ecx), %ebx
|
||||
movl (JB_SI*4)(%ecx), %esi
|
||||
movl (JB_DI*4)(%ecx), %edi
|
||||
movl (JB_BP*4)(%ecx), %ebp
|
||||
movl (JB_SP*4)(%ecx), %esp
|
||||
+ LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%ecx, 4@%edx)
|
||||
#endif
|
||||
/* Jump to saved PC. */
|
||||
jmp *%edx
|
||||
diff -Nrup c/sysdeps/i386/bsd-_setjmp.S d/sysdeps/i386/bsd-_setjmp.S
|
||||
--- c/sysdeps/i386/bsd-_setjmp.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/i386/bsd-_setjmp.S 2012-05-20 23:51:59.479489464 -0600
|
||||
@@ -1,5 +1,6 @@
|
||||
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version.
|
||||
- Copyright (C) 1994-1997,2000-2002,2005, 2006 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1994-1997,2000-2002,2005,2006,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
|
||||
@@ -24,6 +25,7 @@
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define JMPBUF PARMS
|
||||
@@ -46,6 +48,7 @@ ENTRY (BP_SYM (_setjmp))
|
||||
#endif
|
||||
movl %ecx, (JB_SP*4)(%edx)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 4@%edx, -4@$0, 4@%ecx)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%ecx)
|
||||
#endif
|
||||
diff -Nrup c/sysdeps/i386/bsd-setjmp.S d/sysdeps/i386/bsd-setjmp.S
|
||||
--- c/sysdeps/i386/bsd-setjmp.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/i386/bsd-setjmp.S 2012-05-20 23:51:59.505489337 -0600
|
||||
@@ -1,5 +1,6 @@
|
||||
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version.
|
||||
- Copyright (C) 1994-1997,2000,2001,2005, 2006 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1994-1997,2000,2001,2005,2006,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
|
||||
@@ -24,6 +25,7 @@
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define JMPBUF PARMS
|
||||
@@ -48,6 +50,7 @@ ENTRY (BP_SYM (setjmp))
|
||||
#endif
|
||||
movl %ecx, (JB_SP*4)(%eax)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 4@%eax, -4@$1, 4@%ecx)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%ecx)
|
||||
#endif
|
||||
diff -Nrup c/sysdeps/i386/setjmp.S d/sysdeps/i386/setjmp.S
|
||||
--- c/sysdeps/i386/setjmp.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/i386/setjmp.S 2012-05-20 23:51:59.507489327 -0600
|
||||
@@ -1,5 +1,5 @@
|
||||
/* setjmp for i386.
|
||||
- Copyright (C) 1995,1996,1997,2000,2001,2005,2006
|
||||
+ Copyright (C) 1995,1996,1997,2000,2001,2005,2006,2011
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <asm-syntax.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define JMPBUF PARMS
|
||||
@@ -43,6 +44,7 @@ ENTRY (BP_SYM (__sigsetjmp))
|
||||
#endif
|
||||
movl %ecx, (JB_SP*4)(%eax)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 4@%eax, -4@SIGMSK(%esp), 4@%ecx)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%ecx)
|
||||
#endif
|
||||
diff -Nrup c/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S d/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
|
||||
--- c/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S 2012-05-20 23:51:59.507489327 -0600
|
||||
@@ -1,4 +1,5 @@
|
||||
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 2001,2004,2005,2006,2009,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
|
||||
@@ -18,6 +19,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
|
||||
+# Check whether --enable-systemtap was given.
|
||||
+if test "${enable_systemtap+set}" = set; then :
|
||||
+ enableval=$enable_systemtap; systemtap=$enableval
|
||||
+else
|
||||
+ systemtap=no
|
||||
+fi
|
||||
+
|
||||
+if test x$systemtap != xno; then
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemtap static probe support" >&5
|
||||
+$as_echo_n "checking for systemtap static probe support... " >&6; }
|
||||
+if test "${libc_cv_sdt+set}" = set; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ old_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="-std=gnu99 $CFLAGS"
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+#include <sys/sdt.h>
|
||||
+void foo (int i, void *p)
|
||||
+{
|
||||
+ asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
|
||||
+ :: STAP_PROBE_ASM_OPERANDS (2, i, p));
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_compile "$LINENO"; then :
|
||||
+ libc_cv_sdt=yes
|
||||
+else
|
||||
+ libc_cv_sdt=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
+ CFLAGS="$old_CFLAGS"
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sdt" >&5
|
||||
+$as_echo "$libc_cv_sdt" >&6; }
|
||||
+ if test $libc_cv_sdt = yes; then
|
||||
+ $as_echo "#define USE_STAP_PROBE 1" >>confdefs.h
|
||||
+
|
||||
+ else
|
||||
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
+as_fn_error $? "systemtap support needs sys/sdt.h with asm support
|
||||
+See \`config.log' for more details" "$LINENO" 5; }
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
# The way shlib-versions is used to generate soversions.mk uses a
|
||||
# fairly simplistic model for name recognition that can't distinguish
|
||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
||||
diff -Nrup a/configure.in b/configure.in
|
||||
--- a/configure.in 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/configure.in 2012-01-01 20:41:26.635439843 -0700
|
||||
@@ -290,6 +290,29 @@ else
|
||||
fi
|
||||
AC_SUBST(libc_cv_nss_crypt)
|
||||
.section .rodata.str1.1,"aMS",@progbits,1
|
||||
@@ -78,7 +80,9 @@ ENTRY (____longjmp_chk)
|
||||
cfi_adjust_cfa_offset(-12)
|
||||
movl 4(%esp), %ecx
|
||||
|
||||
+AC_ARG_ENABLE([systemtap],
|
||||
+ [AS_HELP_STRING([--enable-systemtap],
|
||||
+ [enable systemtap static probe points @<:@default=no@:>@])],
|
||||
+ [systemtap=$enableval],
|
||||
+ [systemtap=no])
|
||||
+if test x$systemtap != xno; then
|
||||
+ AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
|
||||
+ old_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="-std=gnu99 $CFLAGS"
|
||||
+ AC_COMPILE_IFELSE([#include <sys/sdt.h>
|
||||
+void foo (int i, void *p)
|
||||
+{
|
||||
+ asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
|
||||
+ :: STAP_PROBE_ASM_OPERANDS (2, i, p));
|
||||
+}], [libc_cv_sdt=yes], [libc_cv_sdt=no])
|
||||
+ CFLAGS="$old_CFLAGS"])
|
||||
+ if test $libc_cv_sdt = yes; then
|
||||
+ AC_DEFINE([USE_STAP_PROBE])
|
||||
+ else
|
||||
+ AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
# The way shlib-versions is used to generate soversions.mk uses a
|
||||
# fairly simplistic model for name recognition that can't distinguish
|
||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
||||
diff -Nrup a/extra-lib.mk b/extra-lib.mk
|
||||
--- a/extra-lib.mk 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/extra-lib.mk 2012-01-01 20:41:26.644439841 -0700
|
||||
@@ -101,4 +101,4 @@ ifneq (,$(cpp-srcs-left))
|
||||
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
||||
endif
|
||||
-.Lok: /* We add unwind information for the target here. */
|
||||
+.Lok:
|
||||
+ LIBC_PROBE (longjmp, 3, 4@%ecx, -4@8(%esp), 4@%edx)
|
||||
+ /* We add unwind information for the target here. */
|
||||
cfi_def_cfa(%ecx, 0)
|
||||
cfi_register(%eip, %edx)
|
||||
cfi_register(%esp, %edi)
|
||||
@@ -101,5 +105,6 @@ ENTRY (____longjmp_chk)
|
||||
cfi_restore(%ebp)
|
||||
|
||||
-CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
|
||||
+CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1 -DIN_LIB=$(lib)
|
||||
diff -Nrup a/elf/Makefile b/elf/Makefile
|
||||
--- a/elf/Makefile 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/elf/Makefile 2012-01-01 20:41:26.637439843 -0700
|
||||
@@ -505,7 +506,8 @@ CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'
|
||||
CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
|
||||
CFLAGS-cache.c = $(SYSCONF-FLAGS)
|
||||
/* Jump to saved PC. */
|
||||
+ LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%eax, 4@%edx)
|
||||
jmp *%edx
|
||||
END (____longjmp_chk)
|
||||
diff -Nrup c/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S d/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
|
||||
--- c/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S 2012-05-20 23:51:59.508489322 -0600
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
-CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
|
||||
+CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
|
||||
+ -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
|
||||
#include <sigaltstack-offsets.h>
|
||||
|
||||
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
|
||||
generated += $(addsuffix .so,$(strip $(modules-names)))
|
||||
diff -Nrup a/elf/rtld-Rules b/elf/rtld-Rules
|
||||
--- a/elf/rtld-Rules 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/elf/rtld-Rules 2012-01-01 20:41:26.642439841 -0700
|
||||
@@ -1,7 +1,7 @@
|
||||
# Subroutine makefile for compiling libc modules linked into dynamic linker.
|
||||
@@ -95,7 +96,9 @@ ENTRY(____longjmp_chk)
|
||||
movl %ebx, %esi
|
||||
cfi_restore (%rsi)
|
||||
|
||||
# Copyright (C) 2002,2003,2005,2006,2008,2010,2011
|
||||
-# Free Software Foundation, Inc.
|
||||
+# Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
-.Lok: /* We add unwind information for the target here. */
|
||||
+.Lok:
|
||||
+ LIBC_PROBE (longjmp, 3, 8@%rdi, -4@%esi, 8@%rdx)
|
||||
+ /* We add unwind information for the target here. */
|
||||
cfi_def_cfa(%rdi, 0)
|
||||
cfi_register(%rsp,%r8)
|
||||
cfi_register(%rbp,%r9)
|
||||
@@ -114,5 +117,6 @@ ENTRY(____longjmp_chk)
|
||||
movl %esi, %eax
|
||||
mov %R8_LP, %RSP_LP
|
||||
movq %r9,%rbp
|
||||
+ LIBC_PROBE (longjmp_target, 3, 8@%rdi, -4@%eax, 8@%rdx)
|
||||
jmpq *%rdx
|
||||
END (____longjmp_chk)
|
||||
diff -Nrup c/sysdeps/x86_64/__longjmp.S d/sysdeps/x86_64/__longjmp.S
|
||||
--- c/sysdeps/x86_64/__longjmp.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/x86_64/__longjmp.S 2012-05-20 23:51:59.509489317 -0600
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 2001,2004,2005,2006,2009,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
|
||||
@@ -131,6 +131,6 @@ ifdef rtld-depfiles
|
||||
endif
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
# This here is the whole point of all the shenanigans.
|
||||
-rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1
|
||||
+rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld
|
||||
/* Jump to the position specified by ENV, causing the
|
||||
setjmp call there to return VAL, or 1 if VAL is 0.
|
||||
@@ -33,6 +34,7 @@ ENTRY(__longjmp)
|
||||
PTR_DEMANGLE (%r9)
|
||||
PTR_DEMANGLE (%RDX_LP)
|
||||
#endif
|
||||
+ LIBC_PROBE (longjmp, 3, 8@%rdi, -4@%esi, 8@%rdx)
|
||||
/* We add unwind information for the target here. */
|
||||
cfi_def_cfa(%rdi, 0)
|
||||
cfi_register(%rsp,%r8)
|
||||
@@ -52,5 +54,6 @@ ENTRY(__longjmp)
|
||||
mov %esi, %eax
|
||||
mov %R8_LP,%RSP_LP
|
||||
movq %r9,%rbp
|
||||
+ LIBC_PROBE (longjmp_target, 3, 8@%rdi, -4@%eax, 8@%rdx)
|
||||
jmpq *%rdx
|
||||
END (__longjmp)
|
||||
diff -Nrup c/sysdeps/x86_64/setjmp.S d/sysdeps/x86_64/setjmp.S
|
||||
--- c/sysdeps/x86_64/setjmp.S 2012-05-20 19:47:38.000000000 -0600
|
||||
+++ d/sysdeps/x86_64/setjmp.S 2012-05-20 23:52:44.907272800 -0600
|
||||
@@ -1,5 +1,5 @@
|
||||
/* setjmp for x86-64.
|
||||
- Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2001,2003,2005,2006,2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
endif
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <jmpbuf-offsets.h>
|
||||
#include <asm-syntax.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
ENTRY (__sigsetjmp)
|
||||
/* Save registers. */
|
||||
@@ -40,6 +41,7 @@ ENTRY (__sigsetjmp)
|
||||
#endif
|
||||
movq %rdx, (JB_RSP*8)(%rdi)
|
||||
mov (%rsp), %RAX_LP /* Save PC we are returning to now. */
|
||||
+ LIBC_PROBE (setjmp, 3, 8@%rdi, -4@%esi, 8@%rax)
|
||||
#ifdef PTR_MANGLE
|
||||
PTR_MANGLE (%RAX_LP)
|
||||
#endif
|
||||
|
|
|
@ -1,267 +0,0 @@
|
|||
diff -Nrup a/Makeconfig b/Makeconfig
|
||||
--- a/Makeconfig 2012-01-29 21:44:43.010328202 -0700
|
||||
+++ b/Makeconfig 2012-01-29 21:45:18.242344330 -0700
|
||||
@@ -950,6 +950,12 @@ libdl =
|
||||
endif
|
||||
endif
|
||||
|
||||
+ifeq ($(build-shared),yes)
|
||||
+libm = $(common-objpfx)math/libm.so$(libm.so-version)
|
||||
+else
|
||||
+libm = $(common-objpfx)math/libm.a
|
||||
+endif
|
||||
+
|
||||
# These are the subdirectories containing the library source. The order
|
||||
# is more or less arbitrary. The sorting step will take care of the
|
||||
# dependencies.
|
||||
diff -Nrup a/elf/Makefile b/elf/Makefile
|
||||
--- a/elf/Makefile 2012-01-29 21:44:43.087328238 -0700
|
||||
+++ b/elf/Makefile 2012-01-29 21:45:18.880344622 -0700
|
||||
@@ -124,7 +124,8 @@ distribute := rtld-Rules \
|
||||
tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
|
||||
tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
|
||||
tst-initorder.c \
|
||||
- tst-initorder2.c
|
||||
+ tst-initorder2.c \
|
||||
+ tst-relsort1.c tst-relsort1mod1.c tst-relsort1mod2.c
|
||||
|
||||
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
|
||||
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
|
||||
@@ -230,7 +231,7 @@ tests += loadtest restest1 preloadtest l
|
||||
tst-audit1 tst-audit2 \
|
||||
tst-stackguard1 tst-addr1 tst-thrlock \
|
||||
tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
|
||||
- tst-initorder tst-initorder2
|
||||
+ tst-initorder tst-initorder2 tst-relsort1
|
||||
# reldep9
|
||||
test-srcs = tst-pathopt
|
||||
selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
|
||||
@@ -293,7 +294,9 @@ modules-names = testobj1 testobj2 testob
|
||||
tst-initordera1 tst-initorderb1 \
|
||||
tst-initordera2 tst-initorderb2 \
|
||||
tst-initordera3 tst-initordera4 \
|
||||
- tst-initorder2a tst-initorder2b tst-initorder2c tst-initorder2d
|
||||
+ tst-initorder2a tst-initorder2b tst-initorder2c \
|
||||
+ tst-initorder2d \
|
||||
+ tst-relsort1mod1 tst-relsort1mod2
|
||||
ifeq (yes,$(have-initfini-array))
|
||||
modules-names += tst-array2dep tst-array5dep
|
||||
endif
|
||||
@@ -1199,3 +1202,9 @@ CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
|
||||
CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
|
||||
CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
|
||||
endif
|
||||
+
|
||||
+$(objpfx)tst-relsort1: $(libdl)
|
||||
+$(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
|
||||
+$(objpfx)tst-relsort1mod2.so: $(libm)
|
||||
+$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
|
||||
+ $(objpfx)tst-relsort1mod2.so
|
||||
diff -Nrup a/elf/dl-open.c b/elf/dl-open.c
|
||||
--- a/elf/dl-open.c 2012-01-29 21:44:43.165328272 -0700
|
||||
+++ b/elf/dl-open.c 2012-01-29 21:55:06.683599515 -0700
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Load a shared object at runtime, relocate it, and run its initializer.
|
||||
- Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1996-2007, 2009, 2010, 2011, 2012 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
|
||||
@@ -304,53 +304,116 @@ dl_open_worker (void *a)
|
||||
if (GLRO(dl_lazy))
|
||||
reloc_mode |= mode & RTLD_LAZY;
|
||||
|
||||
- /* Relocate the objects loaded. We do this in reverse order so that copy
|
||||
- relocs of earlier objects overwrite the data written by later objects. */
|
||||
-
|
||||
+ /* Sort the objects by dependency for the relocation process. This
|
||||
+ allows IFUNC relocations to work and it also means copy
|
||||
+ relocation of dependencies are if necessary overwritten. */
|
||||
+ size_t nmaps = 0;
|
||||
struct link_map *l = new;
|
||||
- while (l->l_next)
|
||||
- l = l->l_next;
|
||||
- int relocation_in_progress = 0;
|
||||
- while (1)
|
||||
+ do
|
||||
{
|
||||
if (! l->l_real->l_relocated)
|
||||
+ ++nmaps;
|
||||
+ l = l->l_next;
|
||||
+ }
|
||||
+ while (l != NULL);
|
||||
+ struct link_map *maps[nmaps];
|
||||
+ nmaps = 0;
|
||||
+ l = new;
|
||||
+ do
|
||||
+ {
|
||||
+ if (! l->l_real->l_relocated)
|
||||
+ maps[nmaps++] = l;
|
||||
+ l = l->l_next;
|
||||
+ }
|
||||
+ while (l != NULL);
|
||||
+ if (nmaps > 1)
|
||||
+ {
|
||||
+ char seen[nmaps];
|
||||
+ memset (seen, '\0', nmaps);
|
||||
+ size_t i = 0;
|
||||
+ while (1)
|
||||
{
|
||||
- if (! relocation_in_progress)
|
||||
+ ++seen[i];
|
||||
+ struct link_map *thisp = maps[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. */
|
||||
+ size_t k = nmaps - 1;
|
||||
+ while (k > i)
|
||||
{
|
||||
- /* Notify the debugger that relocations are about to happen. */
|
||||
- LIBC_PROBE (rtld_reloc_start, 2, args->nsid, r);
|
||||
- relocation_in_progress = 1;
|
||||
+ struct link_map **runp = maps[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 (&maps[i], &maps[i + 1],
|
||||
+ (k - i) * sizeof (maps[0]));
|
||||
+ maps[k] = thisp;
|
||||
+
|
||||
+ if (seen[i + 1] > 1)
|
||||
+ {
|
||||
+ ++i;
|
||||
+ goto next_clear;
|
||||
+ }
|
||||
+
|
||||
+ char this_seen = seen[i];
|
||||
+ memmove (&seen[i], &seen[i + 1],
|
||||
+ (k - i) * sizeof (seen[0]));
|
||||
+ seen[k] = this_seen;
|
||||
+
|
||||
+ goto next;
|
||||
+ }
|
||||
+
|
||||
+ --k;
|
||||
}
|
||||
|
||||
+ if (++i == nmaps)
|
||||
+ break;
|
||||
+ next_clear:
|
||||
+ memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0]));
|
||||
+ next:;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int relocation_in_progress = 0;
|
||||
+ for (size_t i = nmaps; i-- > 0; )
|
||||
+ {
|
||||
+ l = maps[i];
|
||||
+
|
||||
+ if (! relocation_in_progress)
|
||||
+ {
|
||||
+ /* Notify the debugger that relocations are about to happen. */
|
||||
+ LIBC_PROBE (rtld-reloc_start, 2, args->nsid, r);
|
||||
+ relocation_in_progress = 1;
|
||||
+ }
|
||||
#ifdef SHARED
|
||||
- if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
|
||||
+ if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
|
||||
+ {
|
||||
+ /* If this here is the shared object which we want to profile
|
||||
+ make sure the profile is started. We can find out whether
|
||||
+ this is necessary or not by observing the `_dl_profile_map'
|
||||
+ variable. If it was NULL but is not NULL afterwars we must
|
||||
+ start the profiling. */
|
||||
+ struct link_map *old_profile_map = GL(dl_profile_map);
|
||||
+
|
||||
+ _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
|
||||
+
|
||||
+ if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
|
||||
{
|
||||
- /* If this here is the shared object which we want to profile
|
||||
- make sure the profile is started. We can find out whether
|
||||
- this is necessary or not by observing the `_dl_profile_map'
|
||||
- variable. If was NULL but is not NULL afterwars we must
|
||||
- start the profiling. */
|
||||
- struct link_map *old_profile_map = GL(dl_profile_map);
|
||||
-
|
||||
- _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
|
||||
-
|
||||
- if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
|
||||
- {
|
||||
- /* We must prepare the profiling. */
|
||||
- _dl_start_profile ();
|
||||
-
|
||||
- /* Prevent unloading the object. */
|
||||
- GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
|
||||
- }
|
||||
+ /* We must prepare the profiling. */
|
||||
+ _dl_start_profile ();
|
||||
+
|
||||
+ /* Prevent unloading the object. */
|
||||
+ GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
|
||||
}
|
||||
- else
|
||||
-#endif
|
||||
- _dl_relocate_object (l, l->l_scope, reloc_mode, 0);
|
||||
}
|
||||
-
|
||||
- if (l == new)
|
||||
- break;
|
||||
- l = l->l_prev;
|
||||
+ else
|
||||
+#endif
|
||||
+ _dl_relocate_object (l, l->l_scope, reloc_mode, 0);
|
||||
}
|
||||
|
||||
/* If the file is not loaded now as a dependency, add the search
|
||||
diff -Nrup a/elf/tst-relsort1.c b/elf/tst-relsort1.c
|
||||
--- a/elf/tst-relsort1.c 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ b/elf/tst-relsort1.c 2012-01-29 21:45:18.913344636 -0700
|
||||
@@ -0,0 +1,19 @@
|
||||
+#include <dlfcn.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+do_test ()
|
||||
+{
|
||||
+ const char lib[] = "$ORIGIN/tst-relsort1mod1.so";
|
||||
+ void *h = dlopen (lib, RTLD_NOW);
|
||||
+ if (h == NULL)
|
||||
+ {
|
||||
+ puts (dlerror ());
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define TEST_FUNCTION do_test ()
|
||||
+#include "../test-skeleton.c"
|
||||
diff -Nrup a/elf/tst-relsort1mod1.c b/elf/tst-relsort1mod1.c
|
||||
--- a/elf/tst-relsort1mod1.c 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ b/elf/tst-relsort1mod1.c 2012-01-29 21:45:18.914344636 -0700
|
||||
@@ -0,0 +1,7 @@
|
||||
+extern int foo (double);
|
||||
+
|
||||
+int
|
||||
+bar (void)
|
||||
+{
|
||||
+ return foo (1.2);
|
||||
+}
|
||||
diff -Nrup a/elf/tst-relsort1mod2.c b/elf/tst-relsort1mod2.c
|
||||
--- a/elf/tst-relsort1mod2.c 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ b/elf/tst-relsort1mod2.c 2012-01-29 21:45:18.914344636 -0700
|
||||
@@ -0,0 +1,7 @@
|
||||
+#include <math.h>
|
||||
+
|
||||
+int
|
||||
+foo (double d)
|
||||
+{
|
||||
+ return floor (d) != 0.0;
|
||||
+}
|
|
@ -1,30 +0,0 @@
|
|||
diff -rup c/include/features.h d/include/features.h
|
||||
--- c/include/features.h 2012-05-08 21:26:45.294191922 -0600
|
||||
+++ d/include/features.h 2012-05-08 21:32:42.889297128 -0600
|
||||
@@ -309,19 +309,18 @@
|
||||
# define __USE_REENTRANT 1
|
||||
#endif
|
||||
|
||||
-#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
|
||||
- && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
|
||||
-# if !__GNUC_PREREQ (4, 1)
|
||||
-# ifdef __GNUC_RH_RELEASE__
|
||||
-# warning _FORTIFY_SOURCE supported only with GCC 4.1 and later
|
||||
-# endif
|
||||
-# define __USE_FORTIFY_LEVEL 0
|
||||
+#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0
|
||||
+# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
|
||||
+# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
|
||||
+# elif !__GNUC_PREREQ (4, 1)
|
||||
+# warning _FORTIFY_SOURCE requires GCC 4.1 or later
|
||||
# elif _FORTIFY_SOURCE > 1
|
||||
# define __USE_FORTIFY_LEVEL 2
|
||||
# else
|
||||
# define __USE_FORTIFY_LEVEL 1
|
||||
# endif
|
||||
-#else
|
||||
+#endif
|
||||
+#ifndef __USE_FORTIFY_LEVEL
|
||||
# define __USE_FORTIFY_LEVEL 0
|
||||
#endif
|
||||
|
154
glibc.spec
154
glibc.spec
|
@ -1,6 +1,6 @@
|
|||
%define glibcsrcdir glibc-2.15-a316c1f
|
||||
%define glibcversion 2.15
|
||||
%define glibcportsdir glibc-ports-2.15-ad8ae7d
|
||||
%define glibcsrcdir glibc-2.15.90-8b728fa3
|
||||
%define glibcversion 2.15.90
|
||||
%define glibcportsdir glibc-ports-2.15.90-4645e97
|
||||
### glibc.spec.in follows:
|
||||
%define run_glibc_tests 1
|
||||
%define auxarches athlon alphaev6
|
||||
|
@ -28,7 +28,7 @@
|
|||
Summary: The GNU libc libraries
|
||||
Name: glibc
|
||||
Version: %{glibcversion}
|
||||
Release: 41%{?dist}
|
||||
Release: 1%{?dist}
|
||||
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
|
||||
# Things that are linked directly into dynamically linked programs
|
||||
# and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
|
||||
|
@ -68,51 +68,36 @@ Patch0001: %{name}-stap.patch
|
|||
|
||||
# Reverting an upstream patch. I don't think this has been discussed
|
||||
# upstream yet.
|
||||
Patch0006: %{name}-rh769421.patch
|
||||
Patch0005: %{name}-rh769421.patch
|
||||
|
||||
# Depends on systemtap infrastructure, so can't go upstream
|
||||
Patch0012: %{name}-rh179072.patch
|
||||
Patch0009: %{name}-rh179072.patch
|
||||
|
||||
# Needs to be sent upstream
|
||||
Patch0013: %{name}-rh697421.patch
|
||||
Patch0010: %{name}-rh697421.patch
|
||||
|
||||
# Needs to be sent upstream
|
||||
Patch0014: %{name}-rh740682.patch
|
||||
Patch0011: %{name}-rh740682.patch
|
||||
|
||||
# Needs to be sent upstream
|
||||
Patch0018: %{name}-rh657588.patch
|
||||
Patch0013: %{name}-rh657588.patch
|
||||
|
||||
# Not likely to be accepted upstream
|
||||
Patch0019: %{name}-rh787201.patch
|
||||
Patch0014: %{name}-rh787201.patch
|
||||
|
||||
# Not necessary to send upstream, fedora specific
|
||||
Patch0023: %{name}-rh688948.patch
|
||||
Patch0018: %{name}-rh688948.patch
|
||||
|
||||
# Needs to be sent upstream
|
||||
Patch0027: %{name}-rh564528.patch
|
||||
Patch0021: %{name}-rh564528.patch
|
||||
|
||||
# stap and thus will never be accepted upstream
|
||||
Patch0044: %{name}-stap-libm.patch
|
||||
Patch0029: %{name}-stap-libm.patch
|
||||
|
||||
#
|
||||
# Patches from upstream
|
||||
#
|
||||
|
||||
Patch1004: %{name}-rh740506.patch
|
||||
Patch1010: %{name}-rh784402.patch
|
||||
Patch1026: %{name}-rh624296.patch
|
||||
Patch1034: %{name}-rh794797.patch
|
||||
Patch1035: %{name}-rh788989.patch
|
||||
Patch1036: %{name}-rh795498.patch
|
||||
Patch1037: %{name}-rh760935.patch
|
||||
Patch1038: %{name}-rh798471.patch
|
||||
Patch1039: %{name}-rh758888.patch
|
||||
Patch1041: %{name}-rh794797-2.patch
|
||||
Patch1046: %{name}-rh806403.patch
|
||||
Patch1047: %{name}-rh806070.patch
|
||||
Patch1048: %{name}-rh804792.patch
|
||||
Patch1052: %{name}-sw13979.patch
|
||||
Patch1053: %{name}-rh817276.patch
|
||||
|
||||
#
|
||||
# Patches submitted, but not yet approved upstream.
|
||||
|
@ -126,69 +111,57 @@ Patch2002: %{name}-sw13579.patch
|
|||
Patch2003: %{name}-rh757881.patch
|
||||
|
||||
# Upstream BZ 13013
|
||||
Patch2005: %{name}-rh730856.patch
|
||||
Patch2004: %{name}-rh730856.patch
|
||||
|
||||
Patch2007: %{name}-rh729661.patch
|
||||
Patch2006: %{name}-rh729661.patch
|
||||
|
||||
# Upstream BZ 13197
|
||||
Patch2008: %{name}-rh446078.patch
|
||||
|
||||
# Upstream BZ 13905
|
||||
Patch2009: %{name}-rh454629.patch
|
||||
Patch2007: %{name}-rh446078.patch
|
||||
|
||||
# Upstream BZ 13948
|
||||
Patch2011: %{name}-rh622499.patch
|
||||
Patch2008: %{name}-rh622499.patch
|
||||
|
||||
# Upstream BZ 13618
|
||||
Patch2015: %{name}-sw13618.patch
|
||||
Patch2016: %{name}-sw13618-2.patch
|
||||
Patch2012: %{name}-sw13618-2.patch
|
||||
|
||||
Patch2017: %{name}-rh783979.patch
|
||||
Patch2020: %{name}-rh741105.patch
|
||||
Patch2021: %{name}-rh770869.patch
|
||||
Patch2022: %{name}-rh691912.patch
|
||||
Patch2024: %{name}-rh770439.patch
|
||||
Patch2025: %{name}-rh789209.patch
|
||||
Patch2015: %{name}-rh741105.patch
|
||||
Patch2016: %{name}-rh770869.patch
|
||||
Patch2017: %{name}-rh691912.patch
|
||||
Patch2019: %{name}-rh770439.patch
|
||||
Patch2020: %{name}-rh789209.patch
|
||||
|
||||
# Upstream BZ 13604
|
||||
Patch2028: %{name}-rh790292.patch
|
||||
Patch2022: %{name}-rh790292.patch
|
||||
|
||||
# Upstream BZ 13603
|
||||
Patch2029: %{name}-rh790298.patch
|
||||
Patch2023: %{name}-rh790298.patch
|
||||
|
||||
# Upstream BZ 13698
|
||||
Patch2030: %{name}-rh791161.patch
|
||||
Patch2024: %{name}-rh791161.patch
|
||||
|
||||
# Upstream BZ 12377
|
||||
Patch2031: %{name}-rh697149.patch
|
||||
Patch2025: %{name}-rh697149.patch
|
||||
|
||||
# Upstream BZ 9954
|
||||
Patch2032: %{name}-rh739743.patch
|
||||
Patch2026: %{name}-rh739743.patch
|
||||
|
||||
# Upstream BZ 13939
|
||||
Patch2033: %{name}-rh789238.patch
|
||||
Patch2027: %{name}-rh789238.patch
|
||||
|
||||
#Upstream BZ 13818
|
||||
Patch2040: %{name}-rh800224.patch
|
||||
Patch2028: %{name}-rh800224.patch
|
||||
|
||||
Patch2045: %{name}-rh803286.patch
|
||||
Patch2030: %{name}-rh803286.patch
|
||||
|
||||
|
||||
# Upstream BZ 13939
|
||||
Patch2049: %{name}-rh789238-2.patch
|
||||
Patch2031: %{name}-rh789238-2.patch
|
||||
|
||||
# Upstream BZ 13946
|
||||
Patch2050: %{name}-rh682500.patch
|
||||
Patch2032: %{name}-rh682500.patch
|
||||
|
||||
# Upstream BZ 13761
|
||||
Patch2051: %{name}-rh788989-2.patch
|
||||
|
||||
# Upstream, see libc-alpha posting from Carlos O'Donell 5/5/2012
|
||||
Patch2054: %{name}-arm-hardfloat-1.patch
|
||||
Patch2055: %{name}-arm-hardfloat-2.patch
|
||||
|
||||
# Upstream BZ 13753/14059
|
||||
Patch2056: %{name}-rh801650.patch
|
||||
Patch2033: %{name}-rh788989-2.patch
|
||||
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Obsoletes: glibc-profile < 2.4
|
||||
|
@ -407,61 +380,36 @@ rm -rf %{glibcportsdir}
|
|||
%patch0001 -E -p1
|
||||
%patch2002 -p1
|
||||
%patch2003 -p1
|
||||
%patch1004 -p1
|
||||
%patch2005 -p1
|
||||
%patch0006 -p1
|
||||
%patch2004 -p1
|
||||
%patch0005 -p1
|
||||
%patch2006 -p1
|
||||
%patch2007 -p1
|
||||
%patch2008 -p1
|
||||
%patch2009 -p1
|
||||
%patch1010 -p1
|
||||
%patch2011 -p1
|
||||
%patch0012 -p1
|
||||
%patch0009 -p1
|
||||
%patch0010 -p1
|
||||
%patch0011 -p1
|
||||
%patch2012 -p1
|
||||
%patch0013 -p1
|
||||
%patch0014 -p1
|
||||
%patch2015 -p1
|
||||
%patch2016 -p1
|
||||
%patch2017 -p1
|
||||
%patch0018 -p1
|
||||
%patch0019 -p1
|
||||
%patch2019 -p1
|
||||
%patch2020 -p1
|
||||
%patch2021 -p1
|
||||
%patch0021 -p1
|
||||
%patch2022 -p1
|
||||
%patch0023 -p1
|
||||
%patch2023 -p1
|
||||
%patch2024 -p1
|
||||
%patch2025 -p1
|
||||
%patch1026 -p1
|
||||
%patch0027 -p1
|
||||
%patch2026 -p1
|
||||
%patch2027 -p1
|
||||
%patch2028 -p1
|
||||
%patch2029 -p1
|
||||
#%patch0029 -p1
|
||||
%patch2030 -p1
|
||||
%patch2031 -p1
|
||||
%patch2032 -p1
|
||||
%patch2033 -p1
|
||||
%patch1034 -p1
|
||||
%patch1035 -p1
|
||||
%patch1036 -p1
|
||||
%patch1037 -p1
|
||||
%patch1038 -p1
|
||||
%patch1039 -p1
|
||||
%patch2040 -p1
|
||||
%patch1041 -p1
|
||||
%patch0044 -p1
|
||||
%patch2045 -p1
|
||||
%patch1046 -p1
|
||||
%patch1047 -p1
|
||||
%patch1048 -p1
|
||||
%patch2049 -p1
|
||||
%patch2050 -p1
|
||||
%patch2051 -p1
|
||||
%patch1052 -p1
|
||||
%patch2054 -p1
|
||||
|
||||
pushd ../%{glibcportsdir}
|
||||
%patch1053 -p1
|
||||
%patch2055 -p1
|
||||
popd
|
||||
|
||||
%patch2056 -p1
|
||||
|
||||
# A lot of programs still misuse memcpy when they have to use
|
||||
# memmove. The memcpy implementation below is not tolerant at
|
||||
|
@ -560,6 +508,7 @@ configure_CFLAGS="$build_CFLAGS -fno-asynchronous-unwind-tables"
|
|||
%ifarch %{multiarcharches}
|
||||
--enable-multi-arch \
|
||||
%endif
|
||||
--enable-obsolete-rpc \
|
||||
%ifarch %{systemtaparches}
|
||||
--enable-systemtap \
|
||||
%endif
|
||||
|
@ -1252,8 +1201,8 @@ rm -f *.filelist*
|
|||
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/cache/ldconfig/aux-cache
|
||||
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
|
||||
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/gai.conf
|
||||
%doc README NEWS INSTALL FAQ BUGS NOTES PROJECTS CONFORMANCE
|
||||
%doc COPYING COPYING.LIB README.libm LICENSES
|
||||
%doc README NEWS INSTALL BUGS PROJECTS CONFORMANCE
|
||||
%doc COPYING COPYING.LIB LICENSES
|
||||
%doc hesiod/README.hesiod
|
||||
|
||||
%if %{xenpackage}
|
||||
|
@ -1318,6 +1267,9 @@ rm -f *.filelist*
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed May 23 2012 Jeff Law <law@redhat.com> - 2.15.90-1
|
||||
- Resync with upstream sources.
|
||||
|
||||
* Tue May 22 2012 Patsy Franklin <pfrankli@redhat.com> - 2.15-41
|
||||
- Fix tzdata trigger (#822200)
|
||||
- Make the symlink relative rather than linking into the buildroot (#822200).
|
||||
|
|
6
sources
6
sources
|
@ -1,3 +1,3 @@
|
|||
9c0e2b4d8cd47eac34850a4172be2aed glibc-2.15-a316c1f-fedora.tar.gz
|
||||
3d33246687a96d5dd7ca0e6f2660eabe glibc-2.15-a316c1f.tar.gz
|
||||
aab8b3cee4a585a8da1eea40979fabae glibc-ports-2.15-ad8ae7d.tar.gz
|
||||
a958330a0f9d3c388abef8cbc8b868e3 glibc-2.15.90-8b728fa3.tar.gz
|
||||
6de42dba1548f09bc6adff993db2f9fe glibc-ports-2.15.90-4645e97.tar.gz
|
||||
abe0e2514f86286214b6af4c5cff0577 glibc-2.15.90-8b728fa3-fedora.tar.gz
|
||||
|
|
Loading…
Reference in New Issue