Hi, Richard,

Now, the documentation (gcc.info) is like following, let me know any issue 
there:

thanks.

Qing
==============

'zero_call_used_regs ("CHOICE")'

     The 'zero_call_used_regs' attribute causes the compiler to zero a
     subset of all call-used registers(1) at function return.  This is
     used to increase program security by either mitigating
     Return-Oriented Programming (ROP) or preventing information leakage
     through registers.

     In order to satisfy users with different security needs and control
     the run-time overhead at the same time, CHOICE parameter provides a
     flexible way to choose the subset of the call-used registers to be
     zeroed.

     The three basic values of CHOICE are:

        * 'skip' doesn't zero any call-used registers.

        * 'used' only zeros call-used registers that are used in the
          function.  A "used" register is one whose content has been set
          or referenced in the function.

        * 'all' zeros all call-used registers.

     In addition to these three basic choices, it is possible to modify
     'used' or 'all' as follows:

        * Adding '-gpr' restricts the zeroing to general-purpose
          registers.

        * Adding '-arg' restricts the zeroing to registers that can
          sometimes be used to pass function arguments.  This includes
          all argument registers defined by the platform's calling
          conversion, regardless of whether the function uses those
          registers for function arguments or not.

     The modifiers can be used individually or together.  If they are
     used together, they must appear in the order above.

     The full list of CHOICEs is therefore:

     'skip'
          doesn't zero any call-used register.

     'used'
          only zeros call-used registers that are used in the function.

     'used-gpr'
          only zeros call-used general purpose registers that are used
          in the function.

     'used-arg'
          only zeros call-used registers that are used in the function
          and pass arguments.

     'used-gpr-arg'
          only zeros call-used general purpose registers that are used
          in the function and pass arguments.

     'all'
          zeros all call-used registers.

     'all-gpr'
          zeros all call-used general purpose registers.

     'all-arg'
          zeros all call-used registers that pass arguments.

     'all-gpr-arg'
          zeros all call-used general purpose registers that pass
          arguments.

     Of this list, 'used-arg', 'used-gpr-arg', 'all-arg', and
     'all-gpr-arg' are mainly used for ROP mitigation.

     The default for the attribute is controlled by
     '-fzero-call-used-regs'.

   ---------- Footnotes ----------

   (1) A "call-used" register is a register whose contents can be
changed by a function call; therefore, a caller cannot assume that the
register has the same contents on return from the function as it had
before calling the function.  Such registers are also called
"call-clobbered", "caller-saved", or "volatileā€.


'-fzero-call-used-regs=CHOICE'
     Zero call-used registers at function return to increase program
     security by either mitigating Return-Oriented Programming (ROP) or
     preventing information leakage through registers.

     The possible values of CHOICE are the same as for the
     'zero_call_used_regs' attribute (*note Function Attributes::).  The
     default is 'skip'.

     You can control this behavior for a specific function by using the
     function attribute 'zero_call_used_regs' (*note Function
     Attributes::).

Reply via email to