public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Dynamic Linker: Exposing static symbols at runtime
@ 2020-10-22  5:23 Harley Paterson
  2020-10-22  7:57 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Harley Paterson @ 2020-10-22  5:23 UTC (permalink / raw)
  To: libc-alpha

Hello,

I'm doing some research on dynamic software updating recently. I've found it would be very helpful to expose static symbols to running program, much like `dlopen`, `dlsym`, and friends expose dynamic symbols to running programs via the `dlfcn.h` header.

Is anyone able to provide insight into what work is required to get the `ld-linux.so` to read the static symbol stable, and expose symbols to processes via an API?

Would the `glibc` community, additionally, be interested in patch with this functionality when or if I implemented it? I can't immediately think of any use cases except my own, however I'm quite willing to contribute this functionality back if the community wants it.

In my use case, my patching software sits between the loader and the user's target program. When the user issues a request to patch software, along with a target binary, the patcher attempts find symbols which have changed between the loaded version and the updated verion, loads the new versions into memory, and patches up requests - either by writing to the PLT, or inserting long jumps into the existing functions. I currently anticipate writing an ELF parser in my patching software to get symbols in the two binaries, although there are some compilations such as relations and base addresses which make me suspect this functionality would be best placed in the dynamic linker, which is awear of the load-time relocations.

I appreciate any insight you can provide,



H Paterson.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Dynamic Linker: Exposing static symbols at runtime
  2020-10-22  5:23 Dynamic Linker: Exposing static symbols at runtime Harley Paterson
@ 2020-10-22  7:57 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2020-10-22  7:57 UTC (permalink / raw)
  To: Harley Paterson via Libc-alpha; +Cc: Harley Paterson

* Harley Paterson via Libc-alpha:

> I'm doing some research on dynamic software updating recently. I've
> found it would be very helpful to expose static symbols to running
> program, much like `dlopen`, `dlsym`, and friends expose dynamic
> symbols to running programs via the `dlfcn.h` header.
>
> Is anyone able to provide insight into what work is required to get
> the `ld-linux.so` to read the static symbol stable, and expose symbols
> to processes via an API?

In general, the static symbol table is not mapped into memory because it
is not located in an allocated section.  So the dynamic loader cannot
provide this data any more easily than a separate library could: it
would have to load it from disk as a first step, too.  This suggests to
me that glibc integration is not really needed.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-22  7:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22  5:23 Dynamic Linker: Exposing static symbols at runtime Harley Paterson
2020-10-22  7:57 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).