-
Notifications
You must be signed in to change notification settings - Fork 566
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
i#5383: Fix macOS preload on a64 #7170
base: master
Are you sure you want to change the base?
Conversation
This fixes build issues and issues with the preload
It appears I broke the x86 macOS tests, not sure what's going on there yet |
If it helps: check out the "Debugging Tests on Github Actions Runner" section at https://dynamorio.org/page_test_suite.html, which documents a way to ssh into the failing test machine. |
Alright somehow adding
|
I don't think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add "Issue #5383" at the end of the PR description as suggested in the commit template.
(Thank you for contributing in making DynamoRIO work better on MacOS!)
ASSERT(sizeof(mc->simd) == sizeof(fpc->__v)); | ||
memcpy(&mc->simd, &fpc->__v, sizeof(mc->simd)); | ||
for (int i = 0; i < proc_num_simd_registers(); i++) { | ||
memcpy(&mc->simd[i], &fpc->__v[i], sizeof(fpc->__v[i])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ASSERT(sizeof(mc->simd[i]) == sizeof(fpc->__v[i]))
before this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see below comment
ASSERT(sizeof(mc->simd) == sizeof(fpc->__v)); | ||
memcpy(&fpc->__v, &mc->simd, sizeof(mc->simd)); | ||
for (int i = 0; i < proc_num_simd_registers(); i++) { | ||
memcpy(&fpc->__v[i], &mc->simd[i], sizeof(fpc->__v[i])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ASSERT(sizeof(mc->simd[i]) == sizeof(fpc->__v[i]))
before this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh uh these things aren't the same size since simd got enlarged. We might need to zero the upper bits then? But none of the other arches in sigcontext_to_mcontext_simd seem to zero the upper bits...
dr_simd_t is 512-bit on aarch64
__v is __uint128_t https://github.com/apple-oss-distributions/xnu/blob/8d741a5de7ff4191bf97d57b9f54c2f6d4a15585/osfmk/mach/arm/_structs.h#L573
This fixes several build and runtime issues under macOS on ARM64 on macOS 14.4.1 (Sonoma)
FEATURE_PAUTH
is now detected on macOS using a sysctl (capability MSRs cannot be read in userspace on M3 at least)_init
needs__attribute__((constructor))
to be run by dyldPLATFORM_SUPPORTS_SCATTER_GATHER
is broken, disabled for now on a64 macOSsimd
size and was failing on an assertKnown issues that remain:
-vm_size 500M
seems to fix this. i#5383: Fix macOS arm64 test build/run #7171 adds this flag to tests on macOS+ARM64. Another option is to make this the default on macOS+ARM64.vmh_exit
are reached upon process exitThe end result is that the
bbcount
tool works on a simple toy program on macOS, in debug mode, without hitting any asserts: