Skip to content
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

Wrong stack pointer offset in objc_msgSend.aarch64.S leads to register corruption #265

Closed
hmelder opened this issue Jan 3, 2024 · 1 comment · Fixed by #266
Closed
Labels

Comments

@hmelder
Copy link
Collaborator

hmelder commented Jan 3, 2024

I was working on a test to fix this and stumbled upon #264. This was not trivial to find, as it was causing some random exceptions in libs-base.

diff --git a/objc_msgSend.aarch64.S b/objc_msgSend.aarch64.S
index 25cbfd6..e9e30ba 100644
--- a/objc_msgSend.aarch64.S
+++ b/objc_msgSend.aarch64.S
@@ -169,7 +169,7 @@ CDECL(objc_msgSend_stret):
        EH_NOP
        ldp    x2, x3, [sp, #32]
        EH_NOP
-       ldp    x4, x5, [sp, #64]
+       ldp    x4, x5, [sp, #48]
        EH_NOP
        ldp    x6, x7, [sp, #64]
        EH_NOP

I'll make a PR with this fix and a unit test.

@hmelder hmelder added the bug label Jan 3, 2024
@hmelder
Copy link
Collaborator Author

hmelder commented Jan 3, 2024

This was never triggered by the tests because clang never generated objc_msgSend calls.

We can rerun objc_msgSend.m with -Xclang -fobjc-dispatch-method=non-legacy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant