public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: DJ Delorie <dj@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] improve out-of-bounds checking with GCC 10 attribute access [BZ #25219]
Date: Wed, 6 May 2020 16:09:28 -0600	[thread overview]
Message-ID: <7b066bcc-0757-1dee-4a45-0f630a389715@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.21.2005062040410.18350@digraph.polyomino.org.uk>

On 5/6/20 2:44 PM, Joseph Myers wrote:
> How exactly was this patch tested?

Besides using the test file attached to the patch I also built glibc
on x86_64-linux, ran the test suite, and compared the results to
an unpatched baseline.  I didn't get any errors but apparently that
was because my test script disables -Werror (I forgot about that,
sorry).

> I'm seeing glibc testsuite build
> failures with GCC 10 on what looks like every configuration supported by
> build-many-glibcs.py, with errors referencing these attributes.  (I
> haven't bisected to confirm the responsible commit; this is with the first
> run of my bot for GCC 10, and my GCC mainline bot had the build fail
> earlier because of GCC bugs at the relevant time.)

The warnings look correct to me.  They should be suppressed for
the tests that exercise the APIs failure modes.  There are a few
others that probably fall into the same category:

-Wstringop-overflow Instances:
   ../libio/bits/stdio2.h:70
   ../string/bits/string_fortified.h:106
   ../string/bits/string_fortified.h:83
   test-errno.c:122
   test-errno.c:137

My baseline log shows just the two below (plus a number of
-Wattribute-warning, -Warray-bounds, and -Wunused-value instances);

-Wstringop-overflow Instances:
   ../libio/bits/stdio2.h:67
   ../string/bits/string_fortified.h:106

I can look into suppressing the new ones.  What's the usual way of
doing that in Glibc tests?

Martin

> 
> test-errno.c: In function 'do_test':
> test-errno.c:122:30: error: argument 1 value -1 is negative [-Werror=stringop-overflow=]
>    122 |   fails |= test_wrp (EINVAL, getgroups, -1, 0);
>        |                              ^
> test-errno.c:65:17: note: in definition of macro 'test_wrp_rv'
>     65 |     rtype ret = syscall (__VA_ARGS__);    \
>        |                 ^~~~~~~
> test-errno.c:122:12: note: in expansion of macro 'test_wrp'
>    122 |   fails |= test_wrp (EINVAL, getgroups, -1, 0);
>        |            ^~~~~~~~
> In file included from ../include/unistd.h:2,
>                   from test-errno.c:35:
> ../posix/unistd.h:701:12: note: in a call to function 'getgroups' declared with attribute 'write_only (2, 1)'
>    701 | extern int getgroups (int __size, __gid_t __list[]) __THROW __wur
>        |            ^~~~~~~~~
> test-errno.c:137:30: error: 'readlink' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
>    137 |   fails |= test_wrp (EINVAL, readlink, "/", buf, -1);
>        |                              ^
> test-errno.c:65:17: note: in definition of macro 'test_wrp_rv'
>     65 |     rtype ret = syscall (__VA_ARGS__);    \
>        |                 ^~~~~~~
> test-errno.c:137:12: note: in expansion of macro 'test_wrp'
>    137 |   fails |= test_wrp (EINVAL, readlink, "/", buf, -1);
>        |            ^~~~~~~~
> In file included from ../include/unistd.h:2,
>                   from test-errno.c:35:
> ../posix/unistd.h:820:16: note: in a call to function 'readlink' declared with attribute 'write_only (2, 3)'
>    820 | extern ssize_t readlink (const char *__restrict __path,
>        |                ^~~~~~~~
> 
> 


  parent reply	other threads:[~2020-05-06 22:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 22:12 Martin Sebor
2020-04-30 22:37 ` Dmitry V. Levin
2020-05-01  2:42 ` DJ Delorie
2020-05-01 19:54   ` Martin Sebor
2020-05-01 22:02     ` DJ Delorie
2020-05-04 17:34       ` Martin Sebor
2020-05-04 18:40         ` Martin Sebor
2020-05-06 20:44         ` Joseph Myers
2020-05-06 21:08           ` DJ Delorie
2020-05-06 22:09           ` Martin Sebor [this message]
2020-05-06 22:27             ` Joseph Myers

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=7b066bcc-0757-1dee-4a45-0f630a389715@gmail.com \
    --to=msebor@gmail.com \
    --cc=dj@redhat.com \
    --cc=joseph@codesourcery.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).