PING [Patch][Middle-end]Add -fzero-call-used-regs=[skip|used-gpr|all-gpr|used|all]

Richard Sandiford richard.sandiford@arm.com
Wed Sep 23 14:22:01 GMT 2020


Qing Zhao <QING.ZHAO@ORACLE.COM> writes:
>> On Sep 23, 2020, at 5:43 AM, Richard Sandiford <richard.sandiford@arm.com> wrote:
>> 
>> Qing Zhao <QING.ZHAO@ORACLE.COM> writes:
>>>> On Sep 22, 2020, at 1:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Tue, Sep 22, 2020 at 11:25 AM Qing Zhao <QING.ZHAO@oracle.com <mailto:QING.ZHAO@oracle.com>> wrote:
>>>>>> On Sep 22, 2020, at 11:31 AM, Richard Sandiford <richard.sandiford@arm.com> wrote:
>>>>>> Taking each in turn: what is the reason for not clearing mask registers?
>>>>>> And what is the reason for not clearing mm0-7?  In each case, is it a
>>>>>> performance or a correctness issue?
>>>>> 
>>>>> Could you please provide more information on the above questions? (Why we exclude mask registers and mm0-7 registers from ALL on x86?)
>>>>> 
>>>> 
>>>> No particular reason.  You can add them.
>>> 
>>> Okay, thanks.
>>> 
>>> Then I guess that the reason we didn’t zero mask registers and mm0-7 registers on x86  is mainly for the performance consideration.
>>> There might not be too much benefit for mitigating ROP attack if we zero these additional registers, but we will got much more performance overhead.
>>> 
>>> What’s you opinion, Richard?
>> 
>> Dropping them is fine with me FWIW.  That seems like a natural use
>> for the new hook: drop zeroing that isn't actively wrong, but isn't
>> likely to be useful either.
>
> Okay, I will add a  new hook for this purpose.

It doesn't need to be a new hook.  The one I mentioned before
would enough:

> The kind of target hook interface I was thinking of was:
>
>   HARD_REG_SET TARGET_EMIT_MOVE_ZEROS (const HARD_REG_SET &regs)
>
> which:
>
> - emits zeroing instructions for some target-specific subset of REGS
>
> - returns the set of registers that were actually cleared

Not clearing mm0-7 and k0-7 would come under the first bullet point.

Thanks,
Richard


More information about the Gcc-patches mailing list