* [Feature Request] dlopen_from function
@ 2021-06-19 7:23 Jakob Skaar
2021-06-23 7:37 ` Szabolcs Nagy
0 siblings, 1 reply; 3+ messages in thread
From: Jakob Skaar @ 2021-06-19 7:23 UTC (permalink / raw)
To: libc-help
Hi,
The behaviour of certain functions in libdl[^2] like the `dlopen`
function is dependent on where it is called from. This is normally
what you want, but sometimes you may want to specify the caller
address yourself, for example when intercepting/hooking the `dlopen`
function itself. For this reason, Apple has added the `dlopen_from`
function in macOS Big Sur. `dlopen_from` has an extra parameter, `void
*caller`, that specifies the "fake" caller address to be used instead
of `RETURN_ADDRESS(0)`[^3]. Using `dlopen_from` significantly
simplifies intercepting `dlopen` calls (see [here][1] for an example).
So my feature request is to implement `dlopen_from` in glibc too.
[1]: <https://github.com/clementgallet/libTAS/blob/70966f9e1f400dfdd5176bba63c11cb6026d3da6/src/library/dlhook.cpp#L108-L189>
[^2]: The same logic also applies to `dlmopen`, `dlsym`, and `dlvsym`.
[^3]: Header file where `dlopen_from` is declared:
<https://opensource.apple.com/source/dyld/dyld-832.7.3/include/dlfcn_private.h.auto.html>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Feature Request] dlopen_from function
2021-06-19 7:23 [Feature Request] dlopen_from function Jakob Skaar
@ 2021-06-23 7:37 ` Szabolcs Nagy
2021-06-23 12:12 ` Jakob Skaar
0 siblings, 1 reply; 3+ messages in thread
From: Szabolcs Nagy @ 2021-06-23 7:37 UTC (permalink / raw)
To: Jakob Skaar; +Cc: libc-help
The 06/19/2021 09:23, Jakob Skaar via Libc-help wrote:
> Hi,
>
> The behaviour of certain functions in libdl[^2] like the `dlopen`
> function is dependent on where it is called from. This is normally
> what you want, but sometimes you may want to specify the caller
> address yourself, for example when intercepting/hooking the `dlopen`
> function itself. For this reason, Apple has added the `dlopen_from`
> function in macOS Big Sur. `dlopen_from` has an extra parameter, `void
> *caller`, that specifies the "fake" caller address to be used instead
> of `RETURN_ADDRESS(0)`[^3]. Using `dlopen_from` significantly
> simplifies intercepting `dlopen` calls (see [here][1] for an example).
> So my feature request is to implement `dlopen_from` in glibc too.
i think glibc specific feature requests should go to
bugzilla.
but i would be useful to discuss this on
libc-coord@lists.openwall.com to see if there is
interest across implementations otherwise the api
will not work portably.
>
> [1]: <https://github.com/clementgallet/libTAS/blob/70966f9e1f400dfdd5176bba63c11cb6026d3da6/src/library/dlhook.cpp#L108-L189>
> [^2]: The same logic also applies to `dlmopen`, `dlsym`, and `dlvsym`.
> [^3]: Header file where `dlopen_from` is declared:
> <https://opensource.apple.com/source/dyld/dyld-832.7.3/include/dlfcn_private.h.auto.html>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Feature Request] dlopen_from function
2021-06-23 7:37 ` Szabolcs Nagy
@ 2021-06-23 12:12 ` Jakob Skaar
0 siblings, 0 replies; 3+ messages in thread
From: Jakob Skaar @ 2021-06-23 12:12 UTC (permalink / raw)
To: Szabolcs Nagy; +Cc: libc-help
On Wed, 23 Jun 2021 at 09:38, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>
> i think glibc specific feature requests should go to
> bugzilla.
I've done this now, see:
<https://sourceware.org/bugzilla/show_bug.cgi?id=28008>.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-23 12:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-19 7:23 [Feature Request] dlopen_from function Jakob Skaar
2021-06-23 7:37 ` Szabolcs Nagy
2021-06-23 12:12 ` Jakob Skaar
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).