[mono][loader] Set status on success; avoid mmap on Android (#21609)
commit3a98eea66d20fb1db6c468690afbe500fc762ff9
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Wed, 25 Jan 2023 14:28:28 +0000 (25 09:28 -0500)
committerGitHub <noreply@github.com>
Wed, 25 Jan 2023 14:28:28 +0000 (25 09:28 -0500)
tree4a14b02a653c4e370816fb4c009a214040410598
parent7f69cba5b99f25627fd72c6be7379ac74b5bb1fe
[mono][loader] Set status on success; avoid mmap on Android (#21609)

* [mono][loader] Set status on success

Manual backport of https://github.com/dotnet/runtime/pull/80949 to mono/mono

Emebedders that call `mono_assembly_load_from_full` may observe a non-NULL return value and an uninitialized MonoImageOpenStatus, which may lead to incorrect diagnostics in code like:

```
MonoImageOpenStatus status;
MonoAssembly *assembly = mono_assembly_load_from_full (image, name, status, refonly);
if (!assembly || status != MONO_IMAGE_OK) {
   fprintf(stderr, "Failure due to: %s\n", mono_image_strerror (status));
   abort();
}
```
Which will print `Failure due to: Internal error`

Addresses https://github.com/xamarin/xamarin-android/issues/7658

* [loader] Make mono_image_laod_time_date_stamp a no-op on Android

Avoid an mmap that will fail since Android uses a custom
loader and the assemblies aren't on disk
mono/metadata/assembly.c
mono/metadata/image.c