Sujet : Re: (interposers): How to workaround the "strong symbols" problem?
De : gazelle (at) *nospam* shell.xmission.com (Kenny McCormack)
Groupes : comp.unix.programmerDate : 18. Jan 2025, 01:42:35
Autres entêtes
Organisation : The official candy of the new Millennium
Message-ID : <vmetdr$341gl$1@news.xmission.com>
References : 1 2
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
wwved112g19.fsf@LkoBDZeT.terraraq.uk>,
Richard Kettlewell <
invalid@invalid.invalid> wrote:
...
Generally, it all works fine - or at least, it did - until they
started having "strong symbols" (I think that's the right term).
>
I think you mean STB_WEAK vs STB_GLOBAL, in the naming used in Glibc and
the ELF spec.
Maybe so. I am not familiar with these terms. Could you explain further?
Anyway, and FWIW, I think it turns out this is not relevant to my problem
(see below).
...
I can interpose both weak and global symbols from Debians Glibc 2.39
without doing anything unusual.
Good to hear. So, does this (weak vs. global) have any connection at all
to whether or not you can interpose them?
...
Yes, it can be done.
...
Something that tripped me up: a program shows a call to openat() in
strace output, so one tries to interpose openat(). But in fact the
program is calling the Glibc open() function, which calls the openat()
syscall.
...
However I think from your other post that you've already considered this
possibility.
Right. It seems to boil down to:
You can't interpose a syscall.
I.e., so if a library function calls the syscall directly (rather than
going through the Glibc wrapper), you can't interpose it. This is, of
course, as it should be.
Anyway, I got it working (so this thread can be considered solved) and I
think you gave me a push in the right direction. It turns out the function
I have to hook is "fopen64". I figured this out by using "ltrace" rather
than "strace". It turns out "strace" is too low-level.
So, thanks for your post.
-- When someone tells me he/she is a Christian I check to see if I'mstill in possession of my wallet.