On 21 Feb 2024, at 20:00, Brooks Davis <bro...@freebsd.org> wrote:
> 
> The sanitizers reach somewhat questionably into libc internals that are
> exported to allow rtld to update them.  I was unable to find an solution
> that didn't break this and I felt that fixing things like closefrom()
> using non-deprecated syscalls was more important than avoiding changes
> to the sanitizer interface.

On Darwin, Apple added a special __interpose section that contains pairs of 
functions to be replaced and replacements. Within the library supplying the 
interposer, the symbol is resolved to the next version along, but everything 
that links to the interposing library sees the wrapped version.

I wonder if it’s worth teaching rtld to do something equivalent. It’s a fairly 
lightweight generic mechanism that avoids a lot of the hacks that the 
sanitisers (and other things, such as instrumented malloc wrappers) do.

David

Reply via email to