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

Fix jump_i386_sysv_macho writing garbage to the x87 control word #98

Merged
merged 2 commits into from Feb 18, 2019

Conversation

Projects
None yet
2 participants
@tux3
Copy link
Contributor

commented Feb 18, 2019

I'm running into crashes on 32bit iOS devices caused by the x87 FPU control word not being saved correctly.
I'm not familiar with the boost.context implementation, but it seems this line is overwriting the control word right before it is loaded.

I think the macho code may have been modeled after the elf version,
which writes the returned transport_t through a pointer in eax,
however macho is expected to return its transport_t result in eax:edx.

The macho code mistakenly wrote its "data" return value through eax.
This happens to overwrite the saved fc_x87_cw before it is loaded,
resulting in floating-point exceptions and crashes in unrelated code.

Does that sound about right?

Fix jump_i386_sysv_macho writing garbage to the x87 control word
It seems the macho code may have been modeled after the elf version,
which writes the returned transport_t through a pointer in eax,
however macho is expected to return its transport_t result in eax:edx.

The macho code mistakenly wrote its "data" return value through eax.
This happens to overwrite the saved fc_x87_cw before it is loaded,
resulting in floating-point exceptions and crashes in unrelated code.

@tux3 tux3 force-pushed the tux3:fix_ios_i386_jump branch from b38f43f to 8e00476 Feb 18, 2019

@tux3 tux3 changed the title Fix jump_i386_sysv_macho writting garbage to the x87 control word Fix jump_i386_sysv_macho writing garbage to the x87 control word Feb 18, 2019

@olk

This comment has been minimized.

Copy link
Member

commented Feb 18, 2019

yes, your are right (but ontop_i386_sysv_macho_gas.S is correct) -ty

@olk olk merged commit a8889e0 into boostorg:develop Feb 18, 2019

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.