* _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
@ 2022-05-06 18:10 Petr Ovtchenkov
0 siblings, 0 replies; only message in thread
From: Petr Ovtchenkov @ 2022-05-06 18:10 UTC (permalink / raw)
To: elfutils-devel
Hi,
_FORTIFY_SOURCE=3 fail to compile with gcc 12/glibc 2.35.
Used:
(GCC) 12.0.1 20220504 (prerelease)
glibc ec5b79aac768 (release/2.35/master)
<snip>
In file included from ..../x86_64-unknown-linux-gnu/usr/include/features.h:490,
from .../x86_64-unknown-linux-gnu/usr/include/assert.h:35,
from elf_getarsym.c:34:
In function ‘pread’,
inlined from ‘pread_retry’ at ../lib/system.h:188:21,
inlined from ‘read_number_entries’ at elf_getarsym.c:63:21,
inlined from ‘elf_getarsym’ at elf_getarsym.c:172:11:
..../x86_64-unknown-linux-gnu/usr/include/bits/unistd.h:74:10: error: ‘__pread_alias’ specified size between 9223372036854775813 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
74 | return __glibc_fortify (pread, __nbytes, sizeof (char),
| ^~~~~~~~~~~~~~~
elf_getarsym.c: In function ‘elf_getarsym’:
elf_getarsym.c:56:5: note: destination object allocated here
56 | } u;
| ^
..../x86_64-unknown-linux-gnu/usr/include/bits/unistd.h:50:16: note: in a call to function ‘__pread_alias’ declared with attribute ‘access (write_only, 2, 3)’
50 | extern ssize_t __REDIRECT (__pread_alias,
| ^~~~~~~~~~
In file included from ..../x86_64-unknown-linux-gnu/usr/include/features.h:490,
from ..../x86_64-unknown-linux-gnu/usr/include/assert.h:35,
from elf_getarsym.c:34:
In function ‘pread’,
inlined from ‘pread_retry’ at ../lib/system.h:188:21,
inlined from ‘read_number_entries’ at elf_getarsym.c:63:21,
inlined from ‘elf_getarsym’ at elf_getarsym.c:172:11:
.../x86_64-unknown-linux-gnu/usr/include/bits/unistd.h:74:10: error: ‘__pread_alias’ specified size between 9223372036854775813 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
74 | return __glibc_fortify (pread, __nbytes, sizeof (char),
| ^~~~~~~~~~~~~~~
elf_getarsym.c: In function ‘elf_getarsym’:
elf_getarsym.c:56:5: note: destination object allocated here
56 | } u;
| ^
.../x86_64-unknown-linux-gnu/usr/include/bits/unistd.h:50:16: note: in a call to function ‘__pread_alias’ declared with attribute ‘access (write_only, 2, 3)’
50 | extern ssize_t __REDIRECT (__pread_alias,
</snip>
Lower level (_FORTIFY_SOURCE=2) compiled fine.
Tricks similar to suggested in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91397
not help: warning disappear only when I set wrong condition
if (w >= sizeof(u))
__builtin_unreachable();
(should be w > sizeof(u)).
--
- ptr
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-06 18:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 18:10 _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35 Petr Ovtchenkov
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).