public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/27714] New: pthread_setspecific missing attribute access none
@ 2021-04-09 16:26 msebor at gmail dot com
2021-04-22 21:31 ` [Bug nptl/27714] " msebor at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: msebor at gmail dot com @ 2021-04-09 16:26 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27714
Bug ID: 27714
Summary: pthread_setspecific missing attribute access none
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: nptl
Assignee: unassigned at sourceware dot org
Reporter: msebor at gmail dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
GCC 11 has enhanced -Wmaybe-uninitialized to trigger when the address of an
uninitialized object is passed to a const pointer function parameter. The
assumption is that the function will most likely read the referenced object.
As a result, when compiled with GCC 11, code that passes such an address to
pthread_setspecific() such as the test case below triggers the warning. This
has caused the following failure in GCC
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99984.
$ cat z.c && gcc -S -Wall z.c
#include <pthread.h>
void f (pthread_key_t key)
{
int x;
pthread_setspecific (key, &x);
}
z.c: In function ‘f’:
z.c:6:3: warning: ‘x’ may be used uninitialized [-Wmaybe-uninitialized]
6 | pthread_setspecific (key, &x);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from z.c:1:
/usr/include/pthread.h:1123:12: note: by argument 2 of type ‘const void *’ to
‘pthread_setspecific’ declared here
1123 | extern int pthread_setspecific (pthread_key_t __key,
| ^~~~~~~~~~~~~~~~~~~
z.c:5:7: note: ‘x’ declared here
5 | int x;
| ^
(The same warning is triggered when the result of malloc() is passed to the
function.)
To avoid the warning in calls to functions like pthread_setspecific that don't
read the object GCC 11 also extends attribute access to accept a new mode:
none. Glibc should make use of the attribute in the declaration of the
function (and any others like it).
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug nptl/27714] pthread_setspecific missing attribute access none
2021-04-09 16:26 [Bug nptl/27714] New: pthread_setspecific missing attribute access none msebor at gmail dot com
@ 2021-04-22 21:31 ` msebor at gmail dot com
2021-04-27 19:10 ` msebor at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: msebor at gmail dot com @ 2021-04-22 21:31 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27714
--- Comment #1 from Martin Sebor <msebor at gmail dot com> ---
Patch: https://sourceware.org/pipermail/libc-alpha/2021-April/125358.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug nptl/27714] pthread_setspecific missing attribute access none
2021-04-09 16:26 [Bug nptl/27714] New: pthread_setspecific missing attribute access none msebor at gmail dot com
2021-04-22 21:31 ` [Bug nptl/27714] " msebor at gmail dot com
@ 2021-04-27 19:10 ` msebor at gmail dot com
2021-04-28 1:29 ` hjl.tools at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: msebor at gmail dot com @ 2021-04-27 19:10 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27714
Martin Sebor <msebor at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Martin Sebor <msebor at gmail dot com> ---
Fixed in https://sourceware.org/pipermail/glibc-cvs/2021q2/072962.html.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug nptl/27714] pthread_setspecific missing attribute access none
2021-04-09 16:26 [Bug nptl/27714] New: pthread_setspecific missing attribute access none msebor at gmail dot com
2021-04-22 21:31 ` [Bug nptl/27714] " msebor at gmail dot com
2021-04-27 19:10 ` msebor at gmail dot com
@ 2021-04-28 1:29 ` hjl.tools at gmail dot com
2021-04-28 19:05 ` msebor at gmail dot com
2021-11-28 16:49 ` khuey at kylehuey dot com
4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-04-28 1:29 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27714
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |hjl.tools at gmail dot com
Last reconfirmed| |2021-04-28
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
With GCC 11, now I got
tst-tsd3.c: In function ‘tf’:
tst-tsd3.c:71:7: error: ‘pthread_setspecific’ expecting 1 byte in a region of
size 0 [-Werror=stringop-overread]
71 | if (pthread_setspecific (key1, (void *) 1l) != 0
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/pthread.h:1,
from tst-tsd3.c:20:
../sysdeps/nptl/pthread.h:1184:12: note: in a call to function
‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1184 | extern int pthread_setspecific (pthread_key_t __key,
| ^~~~~~~~~~~~~~~~~~~
tst-tsd3.c:72:10: error: ‘pthread_setspecific’ expecting 1 byte in a region of
size 0 [-Werror=stringop-overread]
72 | || pthread_setspecific (key2, (void *) 1l) != 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/pthread.h:1,
from tst-tsd3.c:20:
../sysdeps/nptl/pthread.h:1184:12: note: in a call to function
‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1184 | extern int pthread_setspecific (pthread_key_t __key,
| ^~~~~~~~~~~~~~~~~~~
tst-tsd3.c: In function ‘destr2’:
tst-tsd3.c:56:11: error: ‘pthread_setspecific’ expecting 1 byte in a region of
size 0 [-Werror=stringop-overread]
56 | if (pthread_setspecific (key1, (void *) 1l) != 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/pthread.h:1,
from tst-tsd3.c:20:
../sysdeps/nptl/pthread.h:1184:12: note: in a call to function
‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1184 | extern int pthread_setspecific (pthread_key_t __key,
| ^~~~~~~~~~~~~~~~~~~
tst-tsd3.c: In function ‘destr1’:
tst-tsd3.c:40:11: error: ‘pthread_setspecific’ expecting 1 byte in a region of
size 0 [-Werror=stringop-overread]
40 | if (pthread_setspecific (key2, (void *) 1l) != 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/pthread.h:1,
from tst-tsd3.c:20:
../sysdeps/nptl/pthread.h:1184:12: note: in a call to function
‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
1184 | extern int pthread_setspecific (pthread_key_t __key,
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [../o-iterator.mk:9:
/export/build/gnu/tools-build/glibc-lam-test/build-x86_64-linux/nptl/tst-tsd3.o]
Error 1
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug nptl/27714] pthread_setspecific missing attribute access none
2021-04-09 16:26 [Bug nptl/27714] New: pthread_setspecific missing attribute access none msebor at gmail dot com
` (2 preceding siblings ...)
2021-04-28 1:29 ` hjl.tools at gmail dot com
@ 2021-04-28 19:05 ` msebor at gmail dot com
2021-11-28 16:49 ` khuey at kylehuey dot com
4 siblings, 0 replies; 6+ messages in thread
From: msebor at gmail dot com @ 2021-04-28 19:05 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27714
Martin Sebor <msebor at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Martin Sebor <msebor at gmail dot com> ---
All those warnings should be fixed as of last night:
https://sourceware.org/pipermail/glibc-cvs/2021q2/072963.html
If any are not, please open a new bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug nptl/27714] pthread_setspecific missing attribute access none
2021-04-09 16:26 [Bug nptl/27714] New: pthread_setspecific missing attribute access none msebor at gmail dot com
` (3 preceding siblings ...)
2021-04-28 19:05 ` msebor at gmail dot com
@ 2021-11-28 16:49 ` khuey at kylehuey dot com
4 siblings, 0 replies; 6+ messages in thread
From: khuey at kylehuey dot com @ 2021-11-28 16:49 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27714
Kyle Huey (Mozilla) <khuey at kylehuey dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |khuey at kylehuey dot com
--- Comment #5 from Kyle Huey (Mozilla) <khuey at kylehuey dot com> ---
(In reply to Martin Sebor from comment #4)
> All those warnings should be fixed as of last night:
> https://sourceware.org/pipermail/glibc-cvs/2021q2/072963.html
> If any are not, please open a new bug.
You may have fixed the warnings in gcc but now everyone downstream has to deal
with pthread_setspecific requiring a valid pointer to memory where it did not
require that before.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-11-28 16:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 16:26 [Bug nptl/27714] New: pthread_setspecific missing attribute access none msebor at gmail dot com
2021-04-22 21:31 ` [Bug nptl/27714] " msebor at gmail dot com
2021-04-27 19:10 ` msebor at gmail dot com
2021-04-28 1:29 ` hjl.tools at gmail dot com
2021-04-28 19:05 ` msebor at gmail dot com
2021-11-28 16:49 ` khuey at kylehuey dot com
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).