-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Arm64: [PAC-RET] Add Pointer Authentication support for Arm64 #125436
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
base: main
Are you sure you want to change the base?
Changes from 49 commits
7dfa35d
8551ad0
584a268
8216472
74a5293
c9c43c9
5d6058c
ce5d79b
8db6f6d
872443e
3591b2a
867e149
f00f789
9616e73
4582f73
d1e65cb
e1cfd90
cfe6ab8
bed17cd
cefcd3f
f93804f
280870c
5cc10be
f186f19
941d9e2
8f9645b
a755fba
5bde929
352b3fd
264f1fe
f455dc1
d5a4abb
a02fac8
0d2d0dd
f5b520a
396c868
f7d4548
3ca8d39
e98099e
a1768bd
1827095
b43e5e7
52ca210
e5d5ca3
037a0a4
1e4ae0a
067c38f
fcbcdf5
e1a3695
d288cea
146da5e
ebad545
89a9ded
650ef08
80ed0b4
e17d8e9
22dccb7
21bc75a
cd162df
493eff7
84741a8
bcbc1c1
dfac51c
24d44ea
12ca90d
7df0c1f
0b6b5a2
e9be308
ddccab0
ff1f08e
3a6ad11
e71d980
a07d3bd
af97173
f153e2b
c40c08c
27f8c9b
a6b6641
f5b5954
b6fa62e
401b496
d21c942
9a2a161
82b962d
f4c7ec1
82a8ec4
64c7367
a24b0b7
b5bd6c2
e44b17a
0645777
3ef9668
6bdc21f
a66dd10
4113f04
d539d9d
88b9eb2
363156e
13cf190
d5a1b3c
3da8014
b3ffd12
9dfec15
0f7379b
9f20273
b7f5452
528710b
782e0d8
ba25589
3efd414
98cbb04
e41c3ca
15fe969
0910b0a
0e41b35
dbb330a
2f49693
f564983
473a3a5
295ab9b
82a1e88
ffa7fb5
f5105ff
48d0189
aea1eee
756e59c
1f81993
fcf77c1
faa2a32
ff276e4
7de5a37
c216dc6
0ab4e9a
e4c1e75
fdcb483
f704206
e00e37b
be49175
0d6d757
67a381f
18a9ab7
9a588b5
564fa6a
3b70987
ddd0f17
c520e2f
532df3a
59a90e3
ef9c416
72a79ff
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 |
|---|---|---|
|
|
@@ -64,6 +64,10 @@ EXTERN_C CODE_LOCATION RhpRethrow2; | |
| #define FAILFAST_OR_DAC_FAIL_UNCONDITIONALLY(msg) { ASSERT_UNCONDITIONALLY(msg); RhFailFast(); } | ||
| #endif | ||
|
|
||
| #if defined(TARGET_ARM64) | ||
| extern "C" void* PacStripPtr(void* ptr); | ||
| #endif // TARGET_ARM64 | ||
|
|
||
| StackFrameIterator::StackFrameIterator(Thread * pThreadToWalk, PInvokeTransitionFrame* pInitialTransitionFrame) | ||
| { | ||
| STRESS_LOG0(LF_STACKWALK, LL_INFO10000, "----Init---- [ GC ]\n"); | ||
|
|
@@ -1854,7 +1858,12 @@ void StackFrameIterator::NextInternal() | |
| // if the thread is safe to walk, it better not have a hijack in place. | ||
| ASSERT(!m_pThread->IsHijacked()); | ||
|
|
||
| #if defined(TARGET_ARM64) | ||
| // TODO-PAC: Authenticate instead of stripping the return address. | ||
| SetControlPC(PacStripPtr(dac_cast<PTR_VOID>(PCODEToPINSTR(m_RegDisplay.GetIP())))); | ||
| #else | ||
| SetControlPC(dac_cast<PTR_VOID>(PCODEToPINSTR(m_RegDisplay.GetIP()))); | ||
| #endif // TARGET_ARM64 | ||
|
|
||
| PTR_VOID collapsingTargetFrame = NULL; | ||
|
|
||
|
|
@@ -2185,6 +2194,11 @@ void StackFrameIterator::CalculateCurrentMethodState() | |
| return; | ||
| } | ||
|
|
||
| #if defined(TARGET_ARM64) | ||
| //TODO-PAC: Authenticate instead of stripping the return addresses. | ||
| m_ControlPC = PacStripPtr(m_ControlPC); | ||
|
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. I would expect the stripping to be always done when we are converting return address to a PC. It is hard to see that stripping in the middle like here is done correctly. We should avoid fields that are mix of stripped and signed values depending on the code location.
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. To avoid a location dependent value, I updated the patch to always save plain return address in m_RegDisplay instead of stripping it on-demand at use sites. Not sure if this is an ideal approach but it avoids confusion. |
||
| #endif // TARGET_ARM64 | ||
|
|
||
| // Assume that the caller is likely to be in the same module | ||
| if (m_pCodeManager == NULL || !m_pCodeManager->FindMethodInfo(m_ControlPC, &m_methodInfo)) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.