public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Farid Zakaria via Libc-help <libc-help@sourceware.org>
Cc: Farid Zakaria <fmzakari@ucsc.edu>
Subject: Re: Can I use la_symbind to change the shared object file where it's binded?
Date: Mon, 10 Oct 2022 10:43:35 +0200	[thread overview]
Message-ID: <87a6643w7c.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAH4OOv62xN=WXUC8qCXDOwr_6Ejme9HS-rag0xjViqHzEhJYtQ@mail.gmail.com> (Farid Zakaria via Libc-help's message of "Thu, 6 Oct 2022 10:05:38 -0700")

* Farid Zakaria via Libc-help:

> I am looking to see if I can replicate LD_PRELOAD using la_symbind in
> the rltd-audit API.
>
> I would like to provide the audit API a: symbol -> shared object file
> (perhaps with offset) and have the audit API override it.
>
> Is this possible?
> I am thinking perhaps I can dlopen the file in the audit method and
> then use dlsym as well.

It's possible to use la_symbind to alter some symbol bindings.  Where
the replacement symbol address comes from does not matter.

You may have to use dlmopen, to inject the shared object into the main
namespace, not the auditor namespace.  You probably have to open the
shared object before the la_symbind callback happens.

Be sure to use a recent glibc versions (2.34 and later) because many
bugs in auditor support have been fixed.

Thanks,
Florian


      reply	other threads:[~2022-10-10  8:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 17:05 Farid Zakaria
2022-10-10  8:43 ` Florian Weimer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6643w7c.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=fmzakari@ucsc.edu \
    --cc=libc-help@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).