Re: (interposers): How to workaround the "strong symbols" problem?

Liste des GroupesRevenir à cu programmer 
Sujet : Re: (interposers): How to workaround the "strong symbols" problem?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.programmer
Date : 18. Jan 2025, 02:22:51
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250117172121.963@kylheku.com>
References : 1 2
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-01-17, Kenny McCormack <gazelle@shell.xmission.com> wrote:
In article <vmeibp$33sam$1@news.xmission.com>,
Kenny McCormack <gazelle@shell.xmission.com> wrote:
Context is Linux (and only Linux).
>
Over the years, I have written many "interposers" - that is, a shared
library loaded with LD_PRELOAD that hooks some system or library call
(e.g., "read").  The interposer usually ends up calling the "real"
function, then doing something special either before or after the call.
>
Also, wanted to state that the function I am trying to hook is "openat".
>
"open" I can hook, but "openat" doesn't work.  I think most programs just
call "open", which eventually ends up calling "openat", so that (hooking
"open") works.  But some programs call "openat" directly, and that doesn't
work.
>
And, also, just to clarify, the whole point of this is to modify the
behavior of a program without the bother of re-compiling it.

In one installation where glibc is 2.31 from 2021, I get this:

$ nm /lib64/libc.so.6  | grep '1444b0'
00000000001444b0 t __GI___openat
00000000001444b0 t __GI___openat64
00000000001444b0 t __libc_openat64
00000000001444b0 t __openat
00000000001444b0 W openat
00000000001444b0 t __openat64
00000000001444b0 W openat64

Where 1444b0 is the address I discovered by another grep, and
then used it to see what all the aliases are. The openat and
openat64 symbols are W (weak).

If you do the same exercise, what do you see?

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
17 Jan 25 * (interposers): How to workaround the "strong symbols" problem?16Kenny McCormack
17 Jan 25 +* Re: (interposers): How to workaround the "strong symbols" problem?2Kenny McCormack
18 Jan 25 i`- Re: (interposers): How to workaround the "strong symbols" problem?1Kaz Kylheku
18 Jan 25 `* Re: (interposers): How to workaround the "strong symbols" problem?13Richard Kettlewell
18 Jan 25  `* Re: (interposers): How to workaround the "strong symbols" problem?12Kenny McCormack
19 Jan 25   `* Re: (interposers): How to workaround the "strong symbols" problem?11Marcel Mueller
19 Jan 25    `* Re: (interposers): How to workaround the "strong symbols" problem?10Richard Kettlewell
19 Jan 25     +* Re: (interposers): How to workaround the "strong symbols" problem?5Kenny McCormack
19 Jan 25     i`* Re: (interposers): How to workaround the "strong symbols" problem?4Marcel Mueller
19 Jan 25     i +* Re: (interposers): How to workaround the "strong symbols" problem?2Kenny McCormack
20 Jan 25     i i`- Re: (interposers): How to workaround the "strong symbols" problem?1Marcel Mueller
20 Jan 25     i `- Re: (interposers): How to workaround the "strong symbols" problem?1Richard Kettlewell
20 Jan 25     `* Re: (interposers): How to workaround the "strong symbols" problem?4Muttley
20 Jan 25      `* Re: (interposers): How to workaround the "strong symbols" problem?3Kalevi Kolttonen
20 Jan 25       `* Re: (interposers): How to workaround the "strong symbols" problem?2Kenny McCormack
20 Jan 25        `- Re: (interposers): How to workaround the "strong symbols" problem?1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal