-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[android] arm64 running on x64 emulator unexpected FPSIMD_MAGIC assert #62201
Comments
Tagging subscribers to 'arch-android': @steveisok, @akoeplinger Issue DetailsRecent versions (API 30 x86_64) of the Android emultator can run arm64 binaries on an x86_64 emultator using some kind of binary translation. When an app is running in this environment, it looks like the As a result this code asserts: runtime/src/mono/mono/utils/mono-context.c Lines 536 to 539 in b1b7ad4
Instead of looking at the first context in Potentially we can assume that the offset won't change between calls to Reproduction steps for XA:
|
@jonathanpeppers can you verify/update the repro steps /cc @grendello |
I think as long as you're using VS 2022, the issue should repro. To workaround, you can either go to Or |
Moving to 7.0 |
cc @fanyang-mono -- moving to 8.0.0 |
Setting Setting Using |
I couldn't reproduce this issue anymore. Here is what I've tried on API 30 x86_64 emulator using
The app worked fine. Here is the dotnet version that I used
@Falco20019 Could you try this version of dotnet to see if the issue is still there? If so, could you provide a reproduction app? |
I can have a test with the SDK, but I will need to target .NET 6 as the application is bound to that right now. Preparation for .NET 8 has not yet started since our company IT requires us to get approval to use Preview releases of software. We currently build using latest .NET 7 SDK targeting .NET 6. |
@Falco20019 Unfortunately, we've dropped the supporte for .NET6 alreaday. See detailes at https://dotnet.microsoft.com/en-us/platform/support/policy/maui. I went ahead and tried targeting .NET7. I couldn't reproduce the issue. Is there anything else that you would like me to try to reproduce the issue? |
@fanyang-mono Thanks for letting me know about the lifecycle. Since we are not actively using MAUI itself, I was not aware. But since the code path I mentioned hasn't changed in 2 years, it should still trigger Make sure to also set the You also need to add native libs to see if they are missing or not. The app itself started fine, but the native libs were missing. We needed the The emulator I tried was the official API 31 from Google through the device manager. |
@Falco20019 What are the values your project set each of |
I was able to reproduce the crash now. This is related to https://github.com/xamarin/xamarin-android/issues/7444 and more detailed reproduction steps could be found there. |
To clarify, I was only able to reproduce the ICU caused crash mentioned in https://github.com/xamarin/xamarin-android/issues/7444 by adding |
@Falco20019 Did you hit the |
I hit the Regarding support, the policy also states that the workload is independent of the .NET SDK and these are the workloads we currently use for targeting Android on .NET 6:
We use |
@Falco20019 On this page (https://dotnet.microsoft.com/en-us/platform/support/policy/maui), it listed the supporting timeframe for workloads not sdk. The support for Looking forward to your reproduction steps. :) |
But isn't using the workload maui-android in version 7.0.86 using .NET MAUI 7? Even if targeting net6.0-android? There is no separate workload installed for .NET 6 and also when I do a diagnosis output of the build it says it's using the targets from 7.x. That's why I was wondering about the lifecycle note. The workload used is the latest stable and should therefore not be .NET MAUI 6 independent of the target SDK. At least to my understanding. |
@jonathanpeppers Could you please provide some insights here, regarding to @Falco20019's workflow? |
If you specify
We install the Even if you're building with the .NET 7 SDK, you need to specify |
Thanks for the clarifications to both of you! I also highly appreciate the addition of the EOL warning in the upcoming patch :) This will bring the difference in the supported lifecycle to more people's attention. Your input also helped me to already adjust our internal decisions. While we earlier decided to go LTS, we will now try to stay on LATEST instead. I try to send in the recreational steps by mid of next week. |
I was able to create some really minimal recreational steps, not even depending on any external libraries.
This will reproducibly result in the app failing, even when targeting .NET MAUI 7:
I tested it against the x86_64 emulators for API 30, 31 and 33 and all are crashing. If I try it with |
Just for my understanding, the Mono stuff is compiled into the .NET runtime (not We understand that .NET MAUI 6 is EOL and don't expect any backport. Just checking for workarounds until we can switch to .NET 8 in November as it was decided to not invest any more time into supporting .NET 7 so shortly before .NET MAUI 8 gets released. |
That's correct. |
The fix to this issue has been backported to .NET7 servicing and will be available soon. |
https://github.com/dotnet/runtime/blob/v7.0.10/src/mono/mono/utils/mono-context.c#L543 seems to not contain your change (whereas The currently released version is 7.0.9. I assume this will then come with 7.0.11 expected to release on September 12th, right? That would be a bummer since it means another month of not being able to test anything. We will try to use |
Recent versions (API 30 x86_64) of the Android emultator can run arm64 binaries on an x86_64 emultator using some kind of binary translation. When an app is running in this environment, it looks like the
struct sigcontext
__reserved
field is not laid out with thefpsimd_context
first.As a result this code asserts:
runtime/src/mono/mono/utils/mono-context.c
Lines 536 to 539 in b1b7ad4
Linux kernel
sigcontext
__reserved
noteInstead of looking at the first context in
__reserved
and asserting that it hasFPSIMD_MAGIC
, we should checkhead.magic == FPSIMD_MAGIC
and if not, move forward byhead.size
bytes and try again until we seehead.magic == 0
(the last block).Potentially we can assume that the offset won't change between calls to
mono_sigctx_to_monoctx
and cache the pre-computed offset (and assert that the magic is the right one).Reproduction steps for XA:
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
to the csproj file$(AndroidSupportedAbis)
if there is any in the .csproj file<RuntimeIdentifiers>android-arm;android-arm64</RuntimeIdentifiers>
to the csproj filedotnet build -c Release -t:Run
The text was updated successfully, but these errors were encountered: