From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Cc: Colin Cross <ccross@google.com>
Subject: Re: [musl] [PATCH] dl_iterate_phdr: return empty string for the name of the main program
Date: Tue, 5 Apr 2022 06:43:59 +0200 [thread overview]
Message-ID: <20220405044359.GA8499@voyager> (raw)
In-Reply-To: <20220405031859.17673-1-ccross@google.com>
On Mon, Apr 04, 2022 at 08:18:59PM -0700, Colin Cross wrote:
> diff --git a/ldso/dynlink.c b/ldso/dynlink.c
> index fd0d38e9..d2e22a0b 100644
> --- a/ldso/dynlink.c
> +++ b/ldso/dynlink.c
> @@ -2323,12 +2323,15 @@ no_redir:
>
> int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void *data), void *data)
> {
> + static const char* empty_string = "";
> struct dso *current;
> struct dl_phdr_info info;
> int ret = 0;
> for(current = head; current;) {
> info.dlpi_addr = (uintptr_t)current->base;
> - info.dlpi_name = current->name;
> + /* glibc uses an empty string for the main program */
> + info.dlpi_name = (current == head) ? empty_string :
> + current->name;
> info.dlpi_phdr = current->phdr;
> info.dlpi_phnum = current->phnum;
> info.dlpi_adds = gencnt;
> --
> 2.35.1.1094.g7c7d902a7c-goog
>
Any particular reason you chose to create an object for the empty
string, instead of just using an empty string? I.e. why not just
info.dlpi_name = current==head? "" : current->name;
Ciao,
Markus
prev parent reply other threads:[~2022-04-05 4:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 3:18 Colin Cross
2022-04-05 3:57 ` Michael Forney
2022-04-11 12:24 ` Jeffrey Walton
2022-04-11 12:42 ` Rich Felker
2022-04-11 14:03 ` Jeffrey Walton
2022-04-11 14:58 ` Rich Felker
2022-04-11 15:52 ` Colin Cross
2022-04-11 12:46 ` Florian Weimer
2022-04-05 4:43 ` Markus Wichmann [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=20220405044359.GA8499@voyager \
--to=nullplan@gmx.net \
--cc=ccross@google.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).