svn commit: r269680 - stable/10/libexec/rtld-elf

Mark Johnston markj at FreeBSD.org
Thu Aug 7 18:36:49 UTC 2014


Author: markj
Date: Thu Aug  7 18:36:47 2014
New Revision: 269680
URL: http://svnweb.freebsd.org/changeset/base/269680

Log:
  MFC r265456, r265578:
  Add a postinit debugger hook to rtld. This will be used by dtrace(1) to halt
  the victim process before its entry point is called, at which point probes
  and DOF data are registered with the kernel. The r_debug_state hook cannot
  be used for this purpose, as it is called before the program's init routines
  are invoked and in particular before DOF data is registered (via drti.o).

Modified:
  stable/10/libexec/rtld-elf/Symbol.map
  stable/10/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/rtld-elf/Symbol.map
==============================================================================
--- stable/10/libexec/rtld-elf/Symbol.map	Thu Aug  7 17:49:42 2014	(r269679)
+++ stable/10/libexec/rtld-elf/Symbol.map	Thu Aug  7 18:36:47 2014	(r269680)
@@ -30,4 +30,5 @@ FBSDprivate_1.0 {
     _rtld_atfork_post;
     _rtld_addr_phdr;
     _rtld_get_stack_prot;
+    _r_debug_postinit;
 };

Modified: stable/10/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/10/libexec/rtld-elf/rtld.c	Thu Aug  7 17:49:42 2014	(r269679)
+++ stable/10/libexec/rtld-elf/rtld.c	Thu Aug  7 18:36:47 2014	(r269680)
@@ -161,6 +161,7 @@ static bool matched_symbol(SymLook *, co
     const unsigned long);
 
 void r_debug_state(struct r_debug *, struct link_map *) __noinline;
+void _r_debug_postinit(struct link_map *) __noinline;
 
 /*
  * Data declarations.
@@ -635,6 +636,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
     if (obj_main->crt_no_init)
 	preinit_main();
     objlist_call_init(&initlist, &lockstate);
+    _r_debug_postinit(&obj_main->linkmap);
     objlist_clear(&initlist);
     dbg("loading filtees");
     for (obj = obj_list->next; obj != NULL; obj = obj->next) {
@@ -3497,7 +3499,20 @@ r_debug_state(struct r_debug* rd, struct
      * even when marked __noinline.  However, gdb depends on those
      * calls being made.
      */
-    __asm __volatile("" : : : "memory");
+    __compiler_membar();
+}
+
+/*
+ * A function called after init routines have completed. This can be used to
+ * break before a program's entry routine is called, and can be used when
+ * main is not available in the symbol table.
+ */
+void
+_r_debug_postinit(struct link_map *m)
+{
+
+	/* See r_debug_state(). */
+	__compiler_membar();
 }
 
 /*


More information about the svn-src-all mailing list