[jdk13u-dev] RFR: 8267235: [macos_aarch64] InterpreterRuntime::throw_pending_exception messing up LR results in crash
Alan Hayward
github.com+4146708+a74nh at openjdk.java.net
Fri May 21 15:30:01 UTC 2021
On Fri, 21 May 2021 13:25:48 GMT, Alan Hayward <github.com+4146708+a74nh at openjdk.org> wrote:
>> Hello, the final callee which does return is pthread_jit_write_protect_np
>> it does pacibsp at the beginning and i was told it's intentional:
>>>pthread_jit_write_protect_np now needs to push a frame in 11.4, so it PACs lr before spilling it and authenticates it before returning.
>>>the shared cache in arm64 processes is arm64e and the B keys are enabled, allowing non-ABI-visible ptrauth in first-party libraries including libpthread.
>>
>> This fix is more about saving LR before call and restoring it after call, as LR is not callee-saved.
>> So I think it's better to restore LR to proper state than stripping PAC signature in it. it's not even ARM64E process here so I'm unsure if we should use some PAC-related asm code.
>> BTW, if I stop these clang optimisations with attributes and throw_pending_exception returns on it's own then it restores LR from the stack and everything runs just fine.
>>
>> What you said is better be done as part of http://openjdk.java.net/jeps/8264131 in future.
>
>>and authenticates it before returning
>
> Which means the pac signature will have been removed. So there is something more subtle going on. But that's probably irrelevant, because....
>
>>LR is not callee-saved
>
> Agreed. Which means we can't rely on it. In practice it always is restored.... except in this one case :) So, yes, adr is the correct thing to do here.
>
> Ok, I'm happy with this change.
[ This review was meant for the mainline patch, not jdk13 - I clicked on the wrong link. Either way, mainline one had been pushed anyway ]
-------------
PR: https://git.openjdk.java.net/jdk13u-dev/pull/226
More information about the jdk-updates-dev
mailing list