[Issue 9243] Order locals to prevent buffer overflow attacks
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Dec 29 17:59:59 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9243
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #1 from bearophile_hugs at eml.cc 2012-12-29 17:59:58 PST ---
(In reply to comment #0)
> but this enhancement has zero cost, so why not?
Advanced compilers do two things:
- If in a function you have nested scopes that define variables, two successive
scopes are sometimes allowed to re-use the same stack space inside the same
stack frame. I think this can "shuffle" (change) the position of variables in
the stack frame.
- I think they sometimes use profile-driven optimization to tell what are the
hottest stack variables used in a stack frame. This information is probably
later used to set the position of the variables in the stack frame to put the
hottest closer, or on the contrary to let them go different CPU cache lines, to
avoid a slower modify-and-read access patterns.
So maybe it's better to use this idea only in debug builds.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list