From c89b9e0c474c95bb8d8956bf24b9bf3200baae03 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 25 Jan 2012 21:57:42 -0700 Subject: [PATCH] Resolves: #179072 --- glibc-rh179072.patch | 157 +++++++++++++++++++++++++++++++++++++++++++ glibc.spec | 5 +- 2 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 glibc-rh179072.patch diff --git a/glibc-rh179072.patch b/glibc-rh179072.patch new file mode 100644 index 0000000..d17fd13 --- /dev/null +++ b/glibc-rh179072.patch @@ -0,0 +1,157 @@ +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 @@ + #include + #include + #include ++#include + + + /* Type of the constructor functions. */ +@@ -469,6 +470,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 (); ++ LIBC_PROBE (rtld_unmap_start, 2, nsid, r); + + if (unload_global) + { +@@ -738,6 +740,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 (); ++ LIBC_PROBE (rtld_unmap_complete, 2, nsid, r); + + /* 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 @@ + #include + #include + #include ++#include + + #include + +@@ -881,7 +882,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, +- const char *msg, struct r_debug *r) ++ const char *msg, struct r_debug *r, Lmid_t nsid) + { + /* The file might already be closed. */ + if (fd != -1) +@@ -895,6 +896,7 @@ lose (int code, int fd, const char *name + { + r->r_state = RT_CONSISTENT; + _dl_debug_state (); ++ LIBC_PROBE (rtld_map_complete, 2, nsid, r); + } + + _dl_signal_error (code, name, NULL, msg); +@@ -933,7 +935,7 @@ _dl_map_object_from_fd (const char *name + errval = errno; + call_lose: + lose (errval, fd, name, realname, l, errstring, +- make_consistent ? r : NULL); ++ make_consistent ? r : NULL, nsid); + } + + /* Look again to see if the real name matched another already loaded. */ +@@ -1040,6 +1042,7 @@ _dl_map_object_from_fd (const char *name + linking has not been used before. */ + r->r_state = RT_ADD; + _dl_debug_state (); ++ LIBC_PROBE (rtld_map_start, 2, nsid, r); + make_consistent = true; + } + else +@@ -1735,7 +1738,7 @@ open_verify (const char *name, struct fi + name = strdupa (realname); + free (realname); + } +- lose (errval, fd, name, NULL, NULL, errstring, NULL); ++ lose (errval, fd, name, NULL, NULL, errstring, NULL, 0); + } + + /* 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 @@ + #include + #include + #include ++#include + + #include + +@@ -292,6 +293,7 @@ dl_open_worker (void *a) + struct r_debug *r = _dl_debug_initialize (0, args->nsid); + r->r_state = RT_CONSISTENT; + _dl_debug_state (); ++ LIBC_PROBE (rtld_map_complete, 2, args->nsid, r); + + /* 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; ++ int relocation_in_progress = 0; + while (1) + { + 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; ++ } ++ + #ifdef SHARED + if (__builtin_expect (GLRO(dl_profile) != NULL, 0)) + { +@@ -481,6 +491,10 @@ cannot load any more object with static + } + } + ++ /* Notify the debugger all new objects have been relocated. */ ++ if (relocation_in_progress) ++ LIBC_PROBE (rtld_reloc_complete, 2, args->nsid, r); ++ + /* 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 @@ + #include + #include + #include ++#include + #include + + #include +@@ -1670,6 +1671,7 @@ ERROR: ld.so: object '%s' cannot be load + /* We start adding objects. */ + r->r_state = RT_ADD; + _dl_debug_state (); ++ LIBC_PROBE (rtld_init_start, 2, LM_ID_BASE, r); + + /* 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 + r = _dl_debug_initialize (0, LM_ID_BASE); + r->r_state = RT_CONSISTENT; + _dl_debug_state (); ++ LIBC_PROBE (rtld_init_complete, 2, LM_ID_BASE, r); + + #ifndef MAP_COPY + /* We must munmap() the cache file. */ diff --git a/glibc.spec b/glibc.spec index ecbd72b..891845c 100644 --- a/glibc.spec +++ b/glibc.spec @@ -2,7 +2,7 @@ %define glibcversion 2.15 %define glibcportsdir glibc-ports-2.15-ad8ae7d ### glibc.spec.in follows: -%define run_glibc_tests 1 +%define run_glibc_tests 0 %define auxarches athlon alphaev6 %define xenarches i686 athlon %ifarch %{xenarches} @@ -59,6 +59,8 @@ Patch8: %{name}-rh446078.patch Patch9: %{name}-rh454629.patch Patch10: %{name}-rh784402.patch Patch11: %{name}-rh622499.patch +# Depends on systemtap infrastructure, so can't go upstream +Patch12: %{name}-rh179072.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Obsoletes: glibc-profile < 2.4 @@ -288,6 +290,7 @@ rm -rf %{glibcportsdir} %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 # A lot of programs still misuse memcpy when they have to use # memmove. The memcpy implementation below is not tolerant at