From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: [PATCH 1/2] explicit_bzero-tests: pacify GCC
Date: Sun, 18 Jul 2021 11:12:53 +0200 [thread overview]
Message-ID: <1970409.cXUO0us07v@omega> (raw)
In-Reply-To: <20210718045621.1058412-1-eggert@cs.ucla.edu>
Hi Paul,
> diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c
> index cdb839245..c42aba93f 100644
> --- a/tests/test-explicit_bzero.c
> +++ b/tests/test-explicit_bzero.c
> @@ -126,12 +126,12 @@ test_heap (void)
> /* There are two passes:
> 1. Put a secret in memory and invoke explicit_bzero on it.
> 2. Verify that the memory has been erased.
> - Implement them in the same function, so that they access the same memory
> - range on the stack. */
> + Access the memory via a volatile pointer, so the compiler
> + does not assume the pointer's value and optimize away accesses. */
> +static char *volatile stackbuf;
> static int _GL_ATTRIBUTE_NOINLINE
> do_secret_stuff (volatile int pass)
> {
> - char stackbuf[SECRET_SIZE];
> if (pass == 1)
> {
> memcpy (stackbuf, SECRET, SECRET_SIZE);
I disagree with this change, as it significantly reduces the strength of the
test.
The purpose of the test is to verify that the compiler does not eliminate
a call to explicit_bzero, even if data flow analysis reveals that the stack
area is "dead" at the end of the function.
With this patch, it was turned into a weaker assertion: namely, that the
compiler does not eliminate a call to explicit_bzero if it cannot make
inferences about the pointer argument.
I would suggest to revert this patch, and instead use a #pragma, like you
did in the test-memrchr.c patch.
Bruno
next prev parent reply other threads:[~2021-07-18 9:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-18 4:56 [PATCH 1/2] explicit_bzero-tests: pacify GCC Paul Eggert
2021-07-18 4:56 ` [PATCH 2/2] memrchr-tests: " Paul Eggert
2021-07-18 9:12 ` Bruno Haible [this message]
2021-07-18 19:14 ` [PATCH 1/2] explicit_bzero-tests: " Paul Eggert
2021-07-18 22:23 ` Bruno Haible
2021-07-18 23:17 ` Paul Eggert
2021-07-19 0:37 ` Bruno Haible
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
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1970409.cXUO0us07v@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=eggert@cs.ucla.edu \
/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).