public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug string/28475] New: Incorrect access attribute on memfrob
@ 2021-10-19 15:50 jsm28 at gcc dot gnu.org
2021-10-20 13:39 ` [Bug string/28475] " cvs-commit at gcc dot gnu.org
2021-10-20 13:40 ` jsm28 at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2021-10-19 15:50 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28475
Bug ID: 28475
Summary: Incorrect access attribute on memfrob
Product: glibc
Version: 2.34
Status: NEW
Severity: normal
Priority: P2
Component: string
Assignee: unassigned at sourceware dot org
Reporter: jsm28 at gcc dot gnu.org
Target Milestone: ---
My build-many-glibcs.py bot using GCC mainline has shown a build failure for
s390x-linux-gnu-O3 for some time.
https://sourceware.org/pipermail/libc-testresults/2021q4/008732.html
memfrob.c: In function 'memfrob':
memfrob.c:26:10: error: '*(char *)s' may be used uninitialized
[-Werror=maybe-uninitialized]
26 | *p++ ^= 42;
| ~~~~~^~~~~
memfrob.c:21:16: note: accessing argument 1 of a function declared with
attribute 'access (write_only, 1, 2)'
21 | memfrob (void *s, size_t n)
| ~~~~~~^
This shows an actual bug in access attribute in the header: memfrob both reads
and writes the memory pointed to by its argument, so marking it write_only is
incorrect.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug string/28475] Incorrect access attribute on memfrob
2021-10-19 15:50 [Bug string/28475] New: Incorrect access attribute on memfrob jsm28 at gcc dot gnu.org
@ 2021-10-20 13:39 ` cvs-commit at gcc dot gnu.org
2021-10-20 13:40 ` jsm28 at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-20 13:39 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28475
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <jsm28@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2c6cabb3a442f467e78c702cffbd5f003f87f44f
commit 2c6cabb3a442f467e78c702cffbd5f003f87f44f
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Oct 20 13:38:50 2021 +0000
Correct access attribute on memfrob (bug 28475)
As noted in bug 28475, the access attribute on memfrob in <string.h>
is incorrect: the function both reads and writes the memory pointed to
by its argument, so it needs to use __read_write__, not
__write_only__. This incorrect attribute results in a build failure
for accessing uninitialized memory for s390x-linux-gnu-O3 with
build-many-glibcs.py using GCC mainline.
Correct the attribute. Fixing this shows up that some calls to
memfrob in elf/ tests are reading uninitialized memory; I'm not
entirely sure of the purpose of those calls, but guess they are about
ensuring that the stack space is indeed allocated at that point in the
function, and so it matters that they are calling a function whose
semantics are unknown to the compiler. Thus, change the first memfrob
call in those tests to use explicit_bzero instead, as suggested by
Florian in
<https://sourceware.org/pipermail/libc-alpha/2021-October/132119.html>,
to avoid the use of uninitialized memory.
Tested for x86_64, and with build-many-glibcs.py (GCC mainline) for
s390x-linux-gnu-O3.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug string/28475] Incorrect access attribute on memfrob
2021-10-19 15:50 [Bug string/28475] New: Incorrect access attribute on memfrob jsm28 at gcc dot gnu.org
2021-10-20 13:39 ` [Bug string/28475] " cvs-commit at gcc dot gnu.org
@ 2021-10-20 13:40 ` jsm28 at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2021-10-20 13:40 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28475
Joseph Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Target Milestone|--- |2.35
Resolution|--- |FIXED
--- Comment #2 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Fixed for 2.35.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-20 13:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 15:50 [Bug string/28475] New: Incorrect access attribute on memfrob jsm28 at gcc dot gnu.org
2021-10-20 13:39 ` [Bug string/28475] " cvs-commit at gcc dot gnu.org
2021-10-20 13:40 ` jsm28 at gcc dot gnu.org
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).