From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 2/2] malloc: Use __libc_type to detect an inner libc
Date: Fri, 13 Nov 2020 17:14:15 +0100 [thread overview]
Message-ID: <e661c73438b37a7c931089e6ba0421a5711d468d.1605283657.git.fweimer@redhat.com> (raw)
In-Reply-To: <7e89ec4dee33dd4eef6986dd0e790a9500c430b6.1605283657.git.fweimer@redhat.com>
The inner libc must not use sbrk. _dl_addr occasionally shows up
in profiles, but had to be used before because __libc_multiple_libs
was unreliable.
---
malloc/arena.c | 7 +------
malloc/malloc.c | 2 ++
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/malloc/arena.c b/malloc/arena.c
index 202daf15b0..865eaa1a84 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -296,12 +296,7 @@ ptmalloc_init (void)
#ifdef SHARED
/* In case this libc copy is in a non-default namespace, never use brk.
Likewise if dlopened from statically linked program. */
- Dl_info di;
- struct link_map *l;
-
- if (_dl_open_hook != NULL
- || (_dl_addr (ptmalloc_init, &di, &l, NULL) != 0
- && l->l_ns != LM_ID_BASE))
+ if (__libc_type == libc_type_secondary)
__morecore = __failing_morecore;
#endif
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 5b87bdb081..0834e4181a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -247,6 +247,8 @@
/* For SINGLE_THREAD_P. */
#include <sysdep-cancel.h>
+#include <libc-internal.h>
+
/*
Debugging:
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
next prev parent reply other threads:[~2020-11-13 16:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 16:14 [PATCH 1/2] Replace __libc_multiple_libcs with tri-state __libc_type Florian Weimer
2020-11-13 16:14 ` Florian Weimer [this message]
2020-11-13 18:21 ` [PATCH 2/2] malloc: Use __libc_type to detect an inner libc Adhemerval Zanella
2020-11-13 19:05 ` Florian Weimer
2020-11-16 13:18 ` Adhemerval Zanella
2020-11-24 11:23 ` Florian Weimer
2020-11-13 18:19 ` [PATCH 1/2] Replace __libc_multiple_libcs with tri-state __libc_type Adhemerval Zanella
2020-11-13 22:02 ` Florian Weimer
2020-11-16 18:38 ` Adhemerval Zanella
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=e661c73438b37a7c931089e6ba0421a5711d468d.1605283657.git.fweimer@redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@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).