RFR: 8266749: AArch64: Backtracing broken on PAC enabled systems [v2]
Alan Hayward
github.com+4146708+a74nh at openjdk.java.net
Fri May 21 08:30:43 UTC 2021
On Thu, 20 May 2021 21:35:42 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
>> For the values being stripped in this patch, they will always be return addresses saved on the stack. My first choice here was ptrauth_key_return_address, but I wanted it to be a little more generic and:
>> ptrauth_key_return_address = ptrauth_key_process_dependent_code = ptrauth_key_asib [1]
>>
>> For a strip function, the key shouldn't matter as xpaci/xaplri instructions work for both IA and IB keys. However when I've dumped my test binaries on mac, it looked like the compiler used generic bitmasking instead of the xpac instructions. So it's possible the relevant key does matter here. Using the IB key ensures ptrauth_strip() always does the stripping (according to ptrauth.h comments), which is probably the safest option for now. I suspect full mac arm64e support would eventually require having multiple strip functions (pauth_strip_retaddr(), pauth_strip_functptr(), etc)
>>
>> [1] https://opensource.apple.com/source/xnu/xnu-4903.241.1/EXTERNAL_HEADERS/ptrauth.h.auto.html
>
> I don't 100% understand this piece of code on macOS (I stripped non macOS code from it for clarity):
>
>
> inline address pauth_strip_pointer(address ptr) {
> ptrauth_strip(ptr, ptrauth_key_asib);
> return ptr;
> }
>
>
> shouldn't it be something more like:
>
>
> inline address pauth_strip_pointer(address ptr) {
> return ptrauth_strip(ptr, ptrauth_key_asib);
> }
>
>
> or
>
>
> inline address pauth_strip_pointer(address ptr) {
> ptr = ptrauth_strip(ptr, ptrauth_key_asib);
> return ptr;
> }
>
> The original code compiles with **"Expression result unused"** for me.
Good spot. I'll fix this.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4029
More information about the hotspot-dev
mailing list