From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org, Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH 4/4] io: Reorganize the getcwd implementation
Date: Thu, 27 Aug 2020 14:29:14 -0300 [thread overview]
Message-ID: <d0b4747b-4df4-2229-809b-a1b021f0b390@linaro.org> (raw)
In-Reply-To: <bc07802d-780c-18dc-d42f-9f505355fe05@linaro.org>
On 27/08/2020 09:35, Adhemerval Zanella wrote:
> diff --git a/elf/dl-object.c b/elf/dl-object.c
> index d2cdf135cc..aab7265717 100644
> --- a/elf/dl-object.c
> +++ b/elf/dl-object.c
> @@ -202,30 +202,12 @@ _dl_new_object (char *realname, const char *libname, int type,
> }
> else
> {
> - size_t len = realname_len;
> - char *result = NULL;
> -
> - /* Get the current directory name. */
> - origin = NULL;
> - do
> - {
> - char *new_origin;
> -
> - len += 128;
> - new_origin = (char *) realloc (origin, len);
> - if (new_origin == NULL)
> - /* We exit the loop. Note that result == NULL. */
> - break;
> - origin = new_origin;
> - }
> - while ((result = __getcwd (origin, len - realname_len)) == NULL
> - && errno == ERANGE);
> -
> - if (result == NULL)
> + /* The rtld __getcwd implementation does not handle paths larger
> + than PATH_MAX (which would be invalid to be used on subsequent
> + open calls). */
> + origin = __getcwd (NULL, 0);
> + if (origin == NULL)
> {
> - /* We were not able to determine the current directory.
> - Note that free(origin) is OK if origin == NULL. */
> - free (origin);
> origin = (char *) -1;
> goto out;
> }
And this part is obviously wrong since the algorithm will append the realname
on the resulting string afterward. I will send a update version with the
rtld code size optimization, but without this bogus change.
next prev parent reply other threads:[~2020-08-27 17:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 21:02 [PATCH 1/4] Sync getcwd with gnulib Adhemerval Zanella
2020-08-26 21:02 ` [PATCH 2/4] linux: Remove __ASSUME_ATFCTS Adhemerval Zanella
2020-08-26 21:02 ` [PATCH 3/4] Use LFS readdir in generic POSIX getcwd [BZ# 22899] Adhemerval Zanella
2020-08-27 9:58 ` Florian Weimer
2020-08-26 21:02 ` [PATCH 4/4] io: Reorganize the getcwd implementation Adhemerval Zanella
2020-08-26 22:39 ` Paul Eggert
2020-08-27 12:35 ` Adhemerval Zanella
2020-08-27 13:21 ` Florian Weimer
2020-08-27 13:40 ` Adhemerval Zanella
2020-08-27 17:29 ` Adhemerval Zanella [this message]
2020-08-27 19:20 ` [PATCH v2] " Adhemerval Zanella
2020-08-27 23:44 ` Paul Eggert
2020-08-31 18:27 ` Adhemerval Zanella
2020-08-26 22:39 ` [PATCH 1/4] Sync getcwd with gnulib Paul Eggert
2020-08-27 11:07 ` Adhemerval Zanella
2020-08-27 8:14 ` Florian Weimer
2020-08-27 10:53 ` Adhemerval Zanella
2020-08-27 10:58 ` Florian Weimer
2020-08-27 11:06 ` Adhemerval Zanella
2020-08-27 11:10 ` Florian Weimer
2020-08-27 11:33 ` 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=d0b4747b-4df4-2229-809b-a1b021f0b390@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=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).