r_debug in ld-elf.so.1 should be a public symbol to allow for an alternative run-time loader

Yuri yuri at rawbw.com
Sat Feb 1 22:55:36 UTC 2014


I think it would be reasonable if r_debug and related symbols in the 
ld-elf.so.1 run-time loader would be made public.

Currently, only r_debug_symbol is public out of all debugger-related 
symbols in ld-elf.so. This is done so that debuggers can add a 
breakpoint on it to get notified of changes in the set of loaded shared 
libraries. This is sufficient when ld-elf.so is the only one who loads 
objects.

Now imagine the situation when an application wants to load its own ELF 
objects in its own way, still having the benefit of using the debug 
info. Such application would need to have access to the list of objects 
maintained by ld-elf.so. r_debug variable contains this list.

Such application would necessarily be system specific, and would have to 
have the knowledge of some inner workings of ld-elf.so. But, in my 
opinion, this is a legitimate use and should be allowed. Therefore I am 
suggesting this patch. Except r_debug, it adds related lock object and 
functions to the list of publics, because they are needed to avoid race 
conditions.

This is, of course, not a mainstream way to do things, but nevertheless 
it should be allowed.
This is also a minor patch, and it can't possibly hurt anything else.

--begin patch--
--- libexec/rtld-elf/Symbol.map  (revision 260894)
+++ libexec/rtld-elf/Symbol.map  (working copy)
@@ -15,6 +15,11 @@
      dlinfo;
      dl_iterate_phdr;
      r_debug_state;
+    r_debug;
+    rtld_bind_lock;
+    rlock_acquire;
+    wlock_acquire;
+    lock_release;
      __tls_get_addr;
  };

--end patch--


Yuri


More information about the freebsd-hackers mailing list