-
Notifications
You must be signed in to change notification settings - Fork 1.5k
arm64: Add PAuth helpers for signing, stripping and authentication of pointers #2262
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: dev
Are you sure you want to change the base?
Conversation
Add UC_CTL_PAUTH_SIGN, UC_CTL_PAUTH_STRIP and UC_CTL_PAUTH_AUTH as an architecture-independent interface to pointer authentication operations without having to execute instructions on the virtual CPU. This is useful in many scenarios, for instance when rebasing signed pointers as part of loading code that runs with PAuth. The C interfaces are covered by a unit test. The Python interfaces have been tested in a real world project.
|
Converted to draft for now, some of the Windows and alpine test failures do look related to PAuth. Not sure how my changes would be the root cause of these failures just yet, could also be dormant bugs uncovered by the tests I added? Will investigate. If someone actually using the Windows or alpine builds of Unicorn wants to give me a hand, please reach out. |
bb34ca0 to
fb3adb1
Compare
|
So for alpine-x86 and windows-x64 MINGW32, the segfault happens because in The odd one out is windows-x64 MINGW64, where the |
This sounds like a memory corruption happening elsewhere. Unfortunately there seems no memory sanitizer on Windows but maybe you could try ASAN/MSAN on Linux? |
Fixes issue where literal arguments would be written to variable argument memory as an int, but subsequently read from va_list as a uint64_t, which on some platforms might be a different size and lead to corruption of later arguments, breaking PAuth helper functionality or causing segmentation faults.
acabb19 to
209f87d
Compare
|
My hunch was correct, The implementation pulls We wrap the vararg That we then call as if it was a function: However, note the literal The simple fix would be to require callers to use Pushed a fix, removed the debug code. This should be ready to go in once the CI completes. |
|
Failed CI checks are unrelated to this PR. |
Add
UC_CTL_PAUTH_SIGN,UC_CTL_PAUTH_STRIPandUC_CTL_PAUTH_AUTHas an architecture-independent interface to pointer authentication operations without having to execute instructions on the virtual CPU. This is useful in many scenarios, for instance when rebasing signed pointers as part of loading code that runs with PAuth.The C interfaces are covered by a unit test. The Python interfaces have been tested in a real world project.
Minor changes included:
__ctl_wrto work for n input 1 output parameter_pac) to avoid confusion with PAuth unit test