-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Arm-64: Add initial support for PAC-RET #110472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 55 commits
33c53fa
c45b4a8
19b977a
c2c03f9
c64cc1f
cfddf71
3bf9346
042210f
435a901
e9f101c
1dae16f
a1265fb
8a05d92
98246b7
cb3879b
5a24d2a
ba343d2
e414fc7
f3b9e61
bb67312
abfe3d4
0d0fc7f
8394024
ddf6c3d
2b6bf2b
b408ec5
a5a94a7
240b551
09a6c40
1dcf083
618b79c
25c7f72
1e6b5b6
6aebd8b
b230513
b9802ed
9c216f5
f5b6ffa
57112e3
7d92dae
6ef4025
03cde20
beb7829
8e1a725
fb3ab0e
457dd89
a17e8ba
268a895
526b7c2
711d1fc
a99f639
eefb18b
8e087f5
a1298d7
36f166e
989ff17
05f8731
260a807
526717a
2c81d43
7b552e5
f36e335
a862791
8f5b485
e7bc0fa
f53b929
82b0709
7e207a4
52f63d8
79a3fbc
e1ba37b
75316bc
c9f8bd1
b8574ab
333b5b2
cecc9f4
34401fb
0bc660e
3c00fb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4731,6 +4731,9 @@ void CodeGen::genPushCalleeSavedRegisters() | |
| } | ||
| #endif // DEBUG | ||
|
|
||
| // Sign LR as part of Pointer Authentication (PAC) support | ||
| GetEmitter()->emitPacInProlog(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either in this PR or in a follow-up PR, you might want to consider moving the pac instructions closer to where we save
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, number of things will need to be redone to get SP signing in place. |
||
|
|
||
| // The frameType number is arbitrary, is defined below, and corresponds to one of the frame styles we | ||
| // generate based on various sizes. | ||
| int frameType = 0; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,6 +125,7 @@ CONFIG_STRING(JitInlineMethodsWithEHRange, "JitInlineMethodsWithEHRange") | |
|
|
||
| CONFIG_INTEGER(JitLongAddress, "JitLongAddress", 0) // Force using the large pseudo instruction form for long address | ||
| CONFIG_INTEGER(JitMaxUncheckedOffset, "JitMaxUncheckedOffset", 8) | ||
| RELEASE_CONFIG_INTEGER(JitPacEnabled, "JitPacEnabled", 1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a remainder to turn it off before merging.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving them enabled until CI is happy. |
||
|
|
||
| // | ||
| // MinOpts | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,11 @@ static Thread* g_RuntimeInitializingThread; | |
|
|
||
| #endif //!DACCESS_COMPILE | ||
|
|
||
| #if defined(TARGET_ARM64) | ||
| extern "C" void* PacStripPtr(void* ptr); | ||
| extern "C" void* PacSignPtr(void* ptr); | ||
| #endif // TARGET_ARM64 | ||
|
|
||
| ee_alloc_context::PerThreadRandom::PerThreadRandom() | ||
| { | ||
| minipal_xoshiro128pp_init(&random_state, (uint32_t)PalGetTickCount64()); | ||
|
|
@@ -805,6 +810,10 @@ void Thread::HijackReturnAddressWorker(StackFrameIterator* frameIterator, Hijack | |
| CrossThreadUnhijack(); | ||
|
|
||
| void* pvRetAddr = *ppvRetAddrLocation; | ||
| #if defined(TARGET_ARM64) | ||
| pvRetAddr = PacStripPtr(pvRetAddr); | ||
| #endif // TARGET_ARM64 | ||
|
|
||
| ASSERT(pvRetAddr != NULL); | ||
| ASSERT(StackFrameIterator::IsValidReturnAddress(pvRetAddr)); | ||
|
|
||
|
|
@@ -817,6 +826,9 @@ void Thread::HijackReturnAddressWorker(StackFrameIterator* frameIterator, Hijack | |
| #endif | ||
|
|
||
| *ppvRetAddrLocation = (void*)pfnHijackFunction; | ||
| #if defined(TARGET_ARM64) | ||
| *ppvRetAddrLocation = PacSignPtr(*ppvRetAddrLocation); | ||
|
||
| #endif // TARGET_ARM64 | ||
SwapnilGaikwad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| STRESS_LOG2(LF_STACKWALK, LL_INFO10000, "InternalHijack: TgtThread = %llx, IP = %p\n", | ||
| GetPalThreadIdForLogging(), frameIterator->GetRegisterSet()->GetIP()); | ||
|
|
@@ -944,7 +956,11 @@ void Thread::UnhijackWorker() | |
|
|
||
| // Restore the original return address. | ||
| ASSERT(m_ppvHijackedReturnAddressLocation != NULL); | ||
|
|
||
| *m_ppvHijackedReturnAddressLocation = m_pvHijackedReturnAddress; | ||
| #if defined(TARGET_ARM64) | ||
| *m_ppvHijackedReturnAddressLocation = PacSignPtr(*m_ppvHijackedReturnAddressLocation); | ||
| #endif // TARGET_ARM64 | ||
|
|
||
| // Clear the hijack state. | ||
| m_ppvHijackedReturnAddressLocation = NULL; | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.