mailing list of musl libc
 help / color / mirror / code / Atom feed
From: sva sva <azharivs@gmail.com>
To: musl@lists.openwall.com
Subject: Hijacking malloc called within musl libc
Date: Thu, 30 May 2019 16:39:48 -0400	[thread overview]
Message-ID: <CAKsLdYyB+xeLF42O010cE6VQEWtcLPhuWRj4_mY4dJ4Vn699ZQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

I am LD_PRELOADing an application my own malloc which eventually calls the
libc malloc. Everything is fine until the code hits malloc which is called
from musl's own libc which doesn't get overloaded. I want those to be
overloaded as well.

More specifically this is the part of libc for scandir code at
src/dirent/scandir.c:
tmp = realloc(names, len * sizeof *names);

I checked how this works for glibc, and apparently they use
__libc_malloc/etc. internally and have malloc as a weak alias for that
which is used every where including the rest of the standard library.
However in musl, there is no such thing as a weak alias defined for
malloc/etc.

I am kind of stuck here so would appreciate some help.

Thanks

Vahid

[-- Attachment #2: Type: text/html, Size: 926 bytes --]

             reply	other threads:[~2019-05-30 20:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 20:39 sva sva [this message]
2019-05-30 22:29 ` Szabolcs Nagy
2019-05-31  4:13   ` sva sva
2019-05-31 11:43     ` Szabolcs Nagy
2019-05-31 13:34       ` Rich Felker
2019-06-03 18:46         ` sva sva
2019-06-03 20:18           ` Rich Felker

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=CAKsLdYyB+xeLF42O010cE6VQEWtcLPhuWRj4_mY4dJ4Vn699ZQ@mail.gmail.com \
    --to=azharivs@gmail.com \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).