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

[release/6.0] [MonoVM] Fix calculation of code size for AOT assemblies mixing JIT and LLVM #58503

Merged
merged 1 commit into from
Sep 2, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 1, 2021

Backport of #58491 to release/6.0

/cc @lambdageek @filipnavara

Customer Impact

iOS apps built with LLVM are compiled into several Mach-O object files. These files are linked together using a native linker. When using LLVM AOT to publish iOS apps, two object files are created for each input assembly: an object file generated by LLVM, and an object file generated by mini. The mini-generated symbols and LLVM-generated symbols are separately colocated in the output binary, rather than being interleaved per-assembly.

This breaks exception handling: the AOT runtime assumes that, for each assembly, mini-generated and LLVM-generated code will be adjacent in memory. When this assumption is violated, the unwinder is fed bogus data, and any exception thrown by or meant to be caught by an LLVM-generated function will instead trigger the fallback unhandled exception handler and crash the app.

Testing

CI. Successful manual validation on an iPhone SE with the following test case: https://gist.github.com/imhameed/ccd542f151624c6399bd6d5c0f74b085

Risk

Moderate. The fix is in a part of the AOT runtime that runs early during app startup, but the exception handling failures might happen much later, making potential regressions difficult to diagnose.

As a fallback, it is possible to use Mono mini AOT compilation instead of LLVM AOT.

@SamMonoRT
Copy link
Member

@marek-safar - this needs your approval for RC2 submission.

@marek-safar marek-safar merged commit 1b47dd9 into release/6.0 Sep 2, 2021
@marek-safar marek-safar deleted the backport/pr-58491-to-release/6.0 branch September 2, 2021 07:00
@ghost ghost locked as resolved and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants