https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69976

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-02-26
           Assignee|unassigned at gcc dot gnu.org      
|andres.tiraboschi@tallertec
                   |                            |hnologies.com
            Summary|Zero the local stack on     |Zero the local stack on
                   |function exit; don't        |function exit
                   |optimize out memset before  |
                   |return                      |
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think what is more reasonable is just adding a function attribute clear_stack
that makes sure stack adjustments clear no longer necessary stack slots _plus_
not use the red zone if available (or clear that as well).

Such attribute must also make the function not considered for inlining.

Nothing specific to "memset" should be implemented.

To allow inlining eventually the inliner would have to propagate the clearing
requirement up to the functions inlined to.

Note that secure stack does not only mean to clear local arrays as a programmer
would be able to do with memset (if the compiler were not optimizing that away)
but also ensuring that all spill slots are cleared as (old) register values
carrying secure information may leak to them otherwise.

Reply via email to