From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>,
jma14 <jma14@rice.edu>, Carlos O'Donell <carlos@redhat.com>,
John Mellor-Crummey <johnmc@rice.edu>
Subject: Re: [PATCH v12 1/4] elf: Add la_activity during application exit
Date: Wed, 26 Jan 2022 13:25:40 +0100 [thread overview]
Message-ID: <87o83yu1iz.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <f4ae0b66-c50f-512b-9aa0-e1efb07e72b1@linaro.org> (Adhemerval Zanella's message of "Wed, 26 Jan 2022 09:18:36 -0300")
* Adhemerval Zanella:
> On 26/01/2022 08:42, Florian Weimer wrote:
>> * Adhemerval Zanella via Libc-alpha:
>>
>>> +static int
>>> +do_test (int argc, char *argv[])
>>> +{
>>> + /* We must have either:
>>> + - One our fource parameters left if called initially:
>>> + + path to ld.so optional
>>> + + "--library-path" optional
>>> + + the library path optional
>>> + + the application name */
>>> + if (restart)
>>> + return handle_restart ();
>>> +
>>> + char *spargv[9];
>>> + int i = 0;
>>> + for (; i < argc - 1; i++)
>>> + spargv[i] = argv[i + 1];
>>> + spargv[i++] = (char *) "--direct";
>>> + spargv[i++] = (char *) "--restart";
>>> + spargv[i] = NULL;
>>> + TEST_VERIFY_EXIT (i < array_length (spargv));
>>
>> Sorry, I think this test is invalid because it happens after the
>> out-of-bounds write. I expect that compilers will eventually warn about
>> that.
>
> It seems that at least gcc 11 does not warn if the array is not large
> enough. Maybe this is better:
>
> char *spargv[9];
> TEST_VERIFY_EXIT (((argc - 1) + 3) < array_length (spargv));
> int i = 0;
> for (; i < argc - 1; i++)
> spargv[i] = argv[i + 1];
> spargv[i++] = (char *) "--direct";
> spargv[i++] = (char *) "--restart";
> spargv[i] = NULL;
Yes, it is. Thanks. It's a bit unfortunate that there is no succinct
way to express this.
Florian
next prev parent reply other threads:[~2022-01-26 12:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 18:36 [PATCH v12 0/4] Multiple rtld-audit fixes Adhemerval Zanella
2022-01-25 18:36 ` [PATCH v12 1/4] elf: Add la_activity during application exit Adhemerval Zanella
2022-01-26 11:42 ` Florian Weimer
2022-01-26 12:18 ` Adhemerval Zanella
2022-01-26 12:25 ` Florian Weimer [this message]
2022-02-01 4:21 ` Carlos O'Donell
2022-02-01 13:30 ` Adhemerval Zanella
2022-01-25 18:36 ` [PATCH v12 2/4] elf: Fix initial-exec TLS access on audit modules (BZ #28096) Adhemerval Zanella
2022-02-01 5:29 ` Carlos O'Donell
2022-02-01 13:35 ` Adhemerval Zanella
2022-01-25 18:36 ` [PATCH v12 3/4] elf: Issue la_symbind for bind-now (BZ #23734) Adhemerval Zanella
2022-02-01 6:06 ` Carlos O'Donell
2022-02-01 13:47 ` Adhemerval Zanella
2022-01-25 18:37 ` [PATCH v12 4/4] elf: Fix runtime linker auditing on aarch64 (BZ #26643) Adhemerval Zanella
2022-02-01 6:19 ` Carlos O'Donell
2022-02-01 14:11 ` Adhemerval Zanella
2022-02-01 6:45 ` [PATCH v12 0/4] Multiple rtld-audit fixes Carlos O'Donell
2022-02-01 7:53 ` John Mellor-Crummey
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=87o83yu1iz.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=adhemerval.zanella@linaro.org \
--cc=carlos@redhat.com \
--cc=jma14@rice.edu \
--cc=johnmc@rice.edu \
--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).