public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61063] New: Improve -fstack-protector-all
@ 2014-05-05 11:20 Ulrich.Windl at rz dot uni-regensburg.de
2014-05-05 11:28 ` [Bug c/61063] " jakub at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: Ulrich.Windl at rz dot uni-regensburg.de @ 2014-05-05 11:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61063
Bug ID: 61063
Summary: Improve -fstack-protector-all
Product: gcc
Version: 4.3.4
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: Ulrich.Windl at rz dot uni-regensburg.de
I had made a programming error that I could not find with
-fstack-protector-all, but I think it should have helped:
My bug was related to pthread_join() when the thread return parameter received
a pointer to an integer (as the thread actually returns an integer).
Unfortunately on x86_64 sizeof(int) != sizeof(void *), so my program overwrote
the stack.
Interestingly with -O0 things seemed to work, but with -O2 things went grazy.
When the program eventually caused a SIGSEGV the stack was completely unusable
(program crashed on return).
AFAIK, stack-protect pads some magic bytes around on the stack that are checked
before return. As it didn't help much diagnosing my problem, I'd like to
suggest the following enhancements:
1) Don't add some magic bytes at one place on the stack, but add magic bytes
around _every_ variable on the stack.
2) Don't just call the integrity test for the magic bytes before return, but
every time a variable on the stack is modified.
I know it will hit performance hard, but I wasted several hours until I found
why my code broke.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/61063] Improve -fstack-protector-all
2014-05-05 11:20 [Bug c/61063] New: Improve -fstack-protector-all Ulrich.Windl at rz dot uni-regensburg.de
@ 2014-05-05 11:28 ` jakub at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-05-05 11:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61063
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Just use -fsanitize=address in GCC 4.8.0 or later, or valgrind,
-fstack-protector is not meant to have such a performance hit.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-05 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-05 11:20 [Bug c/61063] New: Improve -fstack-protector-all Ulrich.Windl at rz dot uni-regensburg.de
2014-05-05 11:28 ` [Bug c/61063] " jakub 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).