- Use upstream accepted changes for 179072 (stap linker probes).
This commit is contained in:
parent
d0ef83992e
commit
78dd4e4edc
@ -1,6 +1,6 @@
|
||||
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
|
||||
diff -Nrup a/elf/dl-close.c b/elf/dl-close.c
|
||||
--- a/elf/dl-close.c 2012-06-30 13:12:34.000000000 -0600
|
||||
+++ b/elf/dl-close.c 2012-08-20 11:07:56.027477028 -0600
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sysdep-cancel.h>
|
||||
@ -13,21 +13,41 @@ diff -Nrup c/elf/dl-close.c d/elf/dl-close.c
|
||||
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);
|
||||
+ LIBC_PROBE (unmap_start, 2, nsid, r);
|
||||
|
||||
if (unload_global)
|
||||
{
|
||||
@@ -737,6 +739,7 @@ _dl_close_worker (struct link_map *map)
|
||||
@@ -484,7 +486,7 @@ _dl_close_worker (struct link_map *map)
|
||||
/* Speed up removing most recently added objects. */
|
||||
j = cnt;
|
||||
else
|
||||
- for (i = 0; i < cnt; i++)
|
||||
+ for (i = 0; i < cnt; i++)
|
||||
if (ns_msl->r_list[i]->l_removed == 0)
|
||||
{
|
||||
if (i != j)
|
||||
@@ -640,6 +642,10 @@ _dl_close_worker (struct link_map *map)
|
||||
assert (nsid != LM_ID_BASE);
|
||||
#endif
|
||||
ns->_ns_loaded = imap->l_next;
|
||||
+
|
||||
+ /* Update the pointer to the head of the list
|
||||
+ we leave for debuggers to examine. */
|
||||
+ r->r_map = (void *) ns->_ns_loaded;
|
||||
}
|
||||
|
||||
--ns->_ns_nloaded;
|
||||
@@ -737,6 +743,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);
|
||||
+ LIBC_PROBE (unmap_complete, 2, nsid, r);
|
||||
|
||||
/* Recheck if we need to retry, release the lock. */
|
||||
out:
|
||||
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
|
||||
diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
|
||||
--- a/elf/dl-load.c 2012-08-20 11:05:53.042962577 -0600
|
||||
+++ b/elf/dl-load.c 2012-08-20 11:06:30.009816633 -0600
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stackinfo.h>
|
||||
#include <caller.h>
|
||||
@ -49,7 +69,7 @@ diff -Nrup c/elf/dl-load.c d/elf/dl-load.c
|
||||
{
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_map_complete, 2, nsid, r);
|
||||
+ LIBC_PROBE (map_failed, 2, nsid, r);
|
||||
}
|
||||
|
||||
_dl_signal_error (code, name, NULL, msg);
|
||||
@ -66,11 +86,11 @@ diff -Nrup c/elf/dl-load.c d/elf/dl-load.c
|
||||
linking has not been used before. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_map_start, 2, nsid, r);
|
||||
+ LIBC_PROBE (map_start, 2, nsid, r);
|
||||
make_consistent = true;
|
||||
}
|
||||
else
|
||||
@@ -1734,7 +1737,7 @@ open_verify (const char *name, struct fi
|
||||
@@ -1744,7 +1747,7 @@ open_verify (const char *name, struct fi
|
||||
name = strdupa (realname);
|
||||
free (realname);
|
||||
}
|
||||
@ -79,9 +99,9 @@ diff -Nrup c/elf/dl-load.c d/elf/dl-load.c
|
||||
}
|
||||
|
||||
/* See whether the ELF header is what we expect. */
|
||||
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
|
||||
diff -Nrup a/elf/dl-open.c b/elf/dl-open.c
|
||||
--- a/elf/dl-open.c 2012-06-30 13:12:34.000000000 -0600
|
||||
+++ b/elf/dl-open.c 2012-08-20 11:06:30.010816629 -0600
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <caller.h>
|
||||
#include <sysdep-cancel.h>
|
||||
@ -94,7 +114,7 @@ diff -Nrup c/elf/dl-open.c d/elf/dl-open.c
|
||||
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);
|
||||
+ LIBC_PROBE (map_complete, 3, args->nsid, r, new);
|
||||
|
||||
/* Print scope information. */
|
||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
|
||||
@ -111,7 +131,7 @@ diff -Nrup c/elf/dl-open.c d/elf/dl-open.c
|
||||
+ if (! relocation_in_progress)
|
||||
+ {
|
||||
+ /* Notify the debugger that relocations are about to happen. */
|
||||
+ LIBC_PROBE (rtld_reloc_start, 2, args->nsid, r);
|
||||
+ LIBC_PROBE (reloc_start, 2, args->nsid, r);
|
||||
+ relocation_in_progress = 1;
|
||||
+ }
|
||||
+
|
||||
@ -124,14 +144,140 @@ diff -Nrup c/elf/dl-open.c d/elf/dl-open.c
|
||||
|
||||
+ /* Notify the debugger all new objects have been relocated. */
|
||||
+ if (relocation_in_progress)
|
||||
+ LIBC_PROBE (rtld_reloc_complete, 2, args->nsid, r);
|
||||
+ LIBC_PROBE (reloc_complete, 3, args->nsid, r, new);
|
||||
+
|
||||
/* Run the initializer functions of new objects. */
|
||||
_dl_init (new, args->argc, args->argv, args->env);
|
||||
|
||||
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
|
||||
diff -Nrup a/elf/rtld-debugger-interface.txt b/elf/rtld-debugger-interface.txt
|
||||
--- a/elf/rtld-debugger-interface.txt 1969-12-31 17:00:00.000000000 -0700
|
||||
+++ b/elf/rtld-debugger-interface.txt 2012-08-20 11:06:30.011816625 -0600
|
||||
@@ -0,0 +1,122 @@
|
||||
+Standard debugger interface
|
||||
+===========================
|
||||
+
|
||||
+The run-time linker exposes a rendezvous structure to allow debuggers
|
||||
+to interface with it. This structure, r_debug, is defined in link.h.
|
||||
+If the executable's dynamic section has a DT_DEBUG element, the
|
||||
+run-time linker sets that element's value to the address where this
|
||||
+structure can be found.
|
||||
+
|
||||
+The r_debug structure contains (amongst others) the following fields:
|
||||
+
|
||||
+ struct link_map *r_map:
|
||||
+ A linked list of loaded objects.
|
||||
+
|
||||
+ enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state:
|
||||
+ The current state of the r_map list. RT_CONSISTENT means that r_map
|
||||
+ is not currently being modified and may safely be inspected. RT_ADD
|
||||
+ means that an object is being added to r_map, and that the list is
|
||||
+ not guaranteed to be consistent. Likewise RT_DELETE means that an
|
||||
+ object is being removed from the list.
|
||||
+
|
||||
+ ElfW(Addr) r_brk:
|
||||
+ The address of a function internal to the run-time linker which is
|
||||
+ called whenever r_state is changed. The debugger should set a
|
||||
+ breakpoint at this address if it wants to notice mapping changes.
|
||||
+
|
||||
+This protocol is widely supported, but somewhat limited in that it
|
||||
+has no provision to provide access to multiple namespaces, and that
|
||||
+the notifications (via r_brk) only refer to changes to r_map--the
|
||||
+debugger is notified that a new object has been added, for instance,
|
||||
+but there is no way for the debugger to discover whether any of the
|
||||
+objects in the link-map have been relocated or not.
|
||||
+
|
||||
+
|
||||
+Probe-based debugger interface
|
||||
+==============================
|
||||
+
|
||||
+Systemtap is a dynamic tracing/instrumenting tool available on Linux.
|
||||
+Probes that are not fired at run time have close to zero overhead.
|
||||
+glibc contains a number of probes that debuggers can set breakpoints
|
||||
+on in order to notice certain events.
|
||||
+
|
||||
+All rtld probes have the following arguments:
|
||||
+
|
||||
+ arg1: Lmid_t lmid:
|
||||
+ The link-map ID of the link-map list that the object was loaded
|
||||
+ into. This will be LM_ID_BASE for the application's main link-map
|
||||
+ list, or some other value for different namespaces.
|
||||
+
|
||||
+ arg2: struct r_debug *r_debug:
|
||||
+ A pointer to the r_debug structure containing the link-map list
|
||||
+ that the object was loaded into. This will be the value stored in
|
||||
+ DT_DEBUG for the application's main link-map list, or some other
|
||||
+ value for different namespaces.
|
||||
+
|
||||
+map_complete and reloc_complete may have the following additional
|
||||
+argument:
|
||||
+
|
||||
+ arg3: struct link_map *new:
|
||||
+ A pointer which, if not NULL, points to the entry in the specified
|
||||
+ r_debug structure's link-map list corresponding to the first new
|
||||
+ object to have been mapped or relocated, with new->l_next pointing
|
||||
+ to the link-map of the next new object to have been mapped or
|
||||
+ relocated, and so on. Note that because `new' is an entry in a
|
||||
+ larger list, new->l_prev (if not NULL) will point to what was the
|
||||
+ last link-map in the link-map list prior to the new objects being
|
||||
+ mapped or relocated.
|
||||
+
|
||||
+The following probes are available:
|
||||
+
|
||||
+ init_start:
|
||||
+ This is called once, when the linker is about to fill in the main
|
||||
+ r_debug structure at application startup. init_start always has
|
||||
+ lmid set to LM_ID_BASE and r_debug set to the value stored in
|
||||
+ DT_DEBUG. r_debug is not guaranteed to be consistent until
|
||||
+ init_complete is fired.
|
||||
+
|
||||
+ init_complete:
|
||||
+ This is called once, when the linker has filled in the main
|
||||
+ r_debug structure at application startup. init_complete always
|
||||
+ has lmid set to LM_ID_BASE and r_debug set to the value stored
|
||||
+ in DT_DEBUG. The r_debug structure is consistent and may be
|
||||
+ inspected, and all objects in the link-map are guaranteed to
|
||||
+ have been relocated.
|
||||
+
|
||||
+ map_start:
|
||||
+ The linker is about to map new objects into the specified
|
||||
+ namespace. The namespace's r_debug structure is not guaranteed
|
||||
+ to be consistent until a corresponding map_complete is fired.
|
||||
+
|
||||
+ map_complete:
|
||||
+ The linker has finished mapping new objects into the specified
|
||||
+ namespace. The namespace's r_debug structure is consistent and
|
||||
+ may be inspected, although objects in the namespace's link-map
|
||||
+ are not guaranteed to have been relocated.
|
||||
+
|
||||
+ map_failed:
|
||||
+ The linker failed while attempting to map new objects into
|
||||
+ the specified namespace. The namespace's r_debug structure
|
||||
+ is consistent and may be inspected.
|
||||
+
|
||||
+ reloc_start:
|
||||
+ The linker is about to relocate all unrelocated objects in the
|
||||
+ specified namespace. The namespace's r_debug structure is not
|
||||
+ guaranteed to be consistent until a corresponding reloc_complete
|
||||
+ is fired.
|
||||
+
|
||||
+ reloc_complete:
|
||||
+ The linker has relocated all objects in the specified namespace.
|
||||
+ The namespace's r_debug structure is consistent and may be
|
||||
+ inspected, and all objects in the namespace's link-map are
|
||||
+ guaranteed to have been relocated.
|
||||
+
|
||||
+ unmap_start:
|
||||
+ The linker is about to remove objects from the specified
|
||||
+ namespace. The namespace's r_debug structure is not guaranteed to
|
||||
+ be consistent until a corresponding unmap_complete is fired.
|
||||
+
|
||||
+ unmap_complete:
|
||||
+ The linker has finished removing objects into the specified
|
||||
+ namespace. The namespace's r_debug structure is consistent and
|
||||
+ may be inspected.
|
||||
diff -Nrup a/elf/rtld.c b/elf/rtld.c
|
||||
--- a/elf/rtld.c 2012-08-20 11:05:52.905963117 -0600
|
||||
+++ b/elf/rtld.c 2012-08-20 11:06:30.016816605 -0600
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <dl-osinfo.h>
|
||||
#include <dl-procinfo.h>
|
||||
@ -144,15 +290,15 @@ diff -Nrup c/elf/rtld.c d/elf/rtld.c
|
||||
/* We start adding objects. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_init_start, 2, LM_ID_BASE, r);
|
||||
+ LIBC_PROBE (init_start, 2, LM_ID_BASE, r);
|
||||
|
||||
/* Auditing checkpoint: we are ready to signal that the initial map
|
||||
is being constructed. */
|
||||
@@ -2398,6 +2400,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
@@ -2399,6 +2401,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);
|
||||
+ LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
|
||||
|
||||
#ifndef MAP_COPY
|
||||
/* We must munmap() the cache file. */
|
||||
|
@ -28,7 +28,7 @@
|
||||
Summary: The GNU libc libraries
|
||||
Name: glibc
|
||||
Version: %{glibcversion}
|
||||
Release: 9%{?dist}
|
||||
Release: 10%{?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
|
||||
@ -1314,10 +1314,13 @@ rm -f *.filelist*
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Aug 25 2012 Jeff Law <law@redhat.com> - 2.16-9
|
||||
* Mon Aug 20 2012 Jeff Law <law@redhat.com> - 2.16-10
|
||||
- Use upstream accepted changes for 179072 (stap linker probes).
|
||||
|
||||
* Fri Aug 17 2012 Jeff Law <law@redhat.com> - 2.16-9
|
||||
- Fix race in intl/* testsuite (#849203)
|
||||
|
||||
* Wed Aug 25 2012 Jeff Law <law@redhat.com> - 2.16-8
|
||||
* Wed Aug 15 2012 Jeff Law <law@redhat.com> - 2.16-8
|
||||
- Fix integer overflow leading to buffer overflow in strto* (#847718)
|
||||
|
||||
* Wed Jul 25 2012 Jeff Law <law@redhat.com> - 2.16-7
|
||||
|
Loading…
Reference in New Issue
Block a user