public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Fengkai Sun via Libc-help <libc-help@sourceware.org>
Cc: Fengkai Sun <qcloud1014@gmail.com>
Subject: Re: Can LD_PRELOAD set different symbol definitions for shared objects and executable?
Date: Tue, 25 May 2021 10:41:43 +0200	[thread overview]
Message-ID: <87eedv19yw.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAF6YOcORWWnW8EvCskAmDf3shEBvP8Lo_irBcG7y2+_U0bSZBQ@mail.gmail.com> (Fengkai Sun via Libc-help's message of "Tue, 25 May 2021 10:35:20 +0800")

* Fengkai Sun via Libc-help:

> For example, if I set LD_PRELOAD="./mymalloc.so", then all references to
> malloc will be interposed. There is no way to specify a custom allocator
> only for shared objects(maybe I can make a difference in the source code of
> custom malloc, but that's off topic).

Yes, LD_* variables are captured at startup, and changing their values
later using setenv etc. does not have an impact on the current process.

> I wonder if there is any way to do this, or if I missed out some
> fundamental ideas.

It is possible to do this using the LD_AUDIT framework.

Thanks,
Florian


  reply	other threads:[~2021-05-25  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25  2:35 Fengkai Sun
2021-05-25  8:41 ` Florian Weimer [this message]
2021-05-25 16:03   ` Fengkai Sun
2021-05-25 17:50     ` Florian Weimer

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=87eedv19yw.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-help@sourceware.org \
    --cc=qcloud1014@gmail.com \
    /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).