RFR: 8264130: PAC-RET protection for Linux/AArch64 [v4]

Alan Hayward duke at openjdk.java.net
Mon Nov 15 11:40:39 UTC 2021


On Mon, 15 Nov 2021 11:30:35 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> In the original code:
>> *save r0 to the lr location on the stack
>> *restore_live_registers
>> *Standard return: remove stack frame, load lr and fp off the stack, jump to lr.
>>  
>> With PAC it would now be:
>> *Sign r0 then save it to the lr location on the stack
>> *restore_live_registers
>> *Standard return: remove stack frame, load lr and fp off the stack, auth lr, jump to lr.
>> 
>> After reading the code in restore_live_registers, it doesn't touch lr and so seemed odd to have the save to the stack, only to restore it directly afterwards.
>
> That's an optimization, though. You shouldn't need to read the code in `restore_live_registers()` to see if it's safe to keep the return address in LR: at best it's pathological coupling, in the sense that the correctness of this code depends on the internal details of  `restore_live_registers()`. Let's keep LR live ranges as short as possible.

Ok, that's fine, I'll update it (It'll simplify the total code diff too).

-------------

PR: https://git.openjdk.java.net/jdk/pull/6334



More information about the build-dev mailing list