From: Martin Sebor via Libc-alpha <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: Martin Sebor via Libc-alpha <libc-alpha@sourceware.org>,
Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH] add attribute none to pthread_setspecific (BZ #27714)
Date: Wed, 28 Apr 2021 08:49:33 -0600 [thread overview]
Message-ID: <ede56ec8-f426-ef3a-7c07-9e1dac6d70ef@gmail.com> (raw)
In-Reply-To: <87eeeulv93.fsf@oldenburg.str.redhat.com>
On 4/28/21 1:32 AM, Florian Weimer wrote:
> * Martin Sebor:
>
>> diff --git a/nptl/tst-tsd3.c b/nptl/tst-tsd3.c
>> index 0dd39ccb2b..45c7e4e1ea 100644
>> --- a/nptl/tst-tsd3.c
>> +++ b/nptl/tst-tsd3.c
>> @@ -37,7 +37,8 @@ destr1 (void *arg)
>> {
>> puts ("set key2");
>>
>> - if (pthread_setspecific (key2, (void *) 1l) != 0)
>> + /* Use an arbirary but valid pointer to avoid GCC warnings. */
>> + if (pthread_setspecific (key2, (void *) &left) != 0)
>> {
>> puts ("destr1: setspecific failed");
>> exit (1);
>> @@ -53,7 +54,8 @@ destr2 (void *arg)
>> {
>> puts ("set key1");
>>
>> - if (pthread_setspecific (key1, (void *) 1l) != 0)
>> + /* Use an arbirary but valid pointer to avoid GCC warnings. */
>> + if (pthread_setspecific (key1, (void *) &left) != 0)
>> {
>> puts ("destr2: setspecific failed");
>> exit (1);
>
> Sorry, this is clearly a bug in attribute access (none). No access
> should mean no access, not access to one byte, as the warning currently
> implies.
It's not a bug. Access none was introduced as a check whether
the object has the expected size without assuming it's written
to or read from (each access mode has its own checks). Pointers
to void are treated as char*. This was documented in the GCC 10
manual when attribute access was first added and hasn't changed
with GCC 11.
The motivating use case for access none was a Linux kernel API
(I think check_copy_size) used to verify that a pointer points
to an object with the expected size.
>
> Please fix this for GCC 11.2 and adjust the glibc version check for the
> none variant of the attribute.
I'll see if I can come up with a solution for
the pthread_setspecific use case.
Martin
next prev parent reply other threads:[~2021-04-28 14:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 21:30 [PATCH] add attribute none to pthread_setspecific (BZ #27714) Martin Sebor via Libc-alpha
2021-04-22 22:26 ` Martin Sebor via Libc-alpha
2021-04-23 0:11 ` Paul Eggert
2021-04-23 15:24 ` Martin Sebor via Libc-alpha
2021-04-23 20:19 ` Paul Eggert
2021-04-23 21:29 ` Martin Sebor via Libc-alpha
2021-04-24 0:27 ` Paul Eggert
2021-04-26 19:38 ` Martin Sebor via Libc-alpha
2021-04-27 4:41 ` Florian Weimer via Libc-alpha
2021-04-27 19:07 ` Martin Sebor via Libc-alpha
2021-04-27 21:07 ` Joseph Myers
2021-04-27 21:46 ` Martin Sebor via Libc-alpha
2021-04-27 21:58 ` Joseph Myers
2021-04-27 22:57 ` Martin Sebor via Libc-alpha
2021-04-28 1:09 ` Martin Sebor via Libc-alpha
2021-04-28 7:32 ` Florian Weimer via Libc-alpha
2021-04-28 14:49 ` Martin Sebor via Libc-alpha [this message]
2021-04-29 7:45 ` Florian Weimer via Libc-alpha
2021-04-29 14:55 ` Martin Sebor via Libc-alpha
2021-04-29 16:16 ` Florian Weimer via Libc-alpha
2021-04-28 1:30 ` H.J. Lu via Libc-alpha
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://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ede56ec8-f426-ef3a-7c07-9e1dac6d70ef@gmail.com \
--to=libc-alpha@sourceware.org \
--cc=fweimer@redhat.com \
--cc=joseph@codesourcery.com \
--cc=msebor@gmail.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.
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).