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

[NativeAOT] App Store Connect error ITMS-90999: Invalid executable #19387

Closed
tipa opened this issue Nov 2, 2023 · 11 comments
Closed

[NativeAOT] App Store Connect error ITMS-90999: Invalid executable #19387

tipa opened this issue Nov 2, 2023 · 11 comments
Labels
bug If an issue is a bug or a pull request a bug fix nativeaot
Milestone

Comments

@tipa
Copy link

tipa commented Nov 2, 2023

I read about the NativeAOT experimental feature here and wanted to give it a try right away.
The app can be downloaded via TestFlight and is significantly smaller than before (with the Mono AOT) - awesome! I also don't see any functional issues

Steps to Reproduce

  1. Add <PublishAot>true</PublishAot> to .csproj
  2. dotnet publish
  3. Upload resulting .ipa to App Store Connect

Expected Behavior

No warning/error

Actual Behavior

Email from Apple:

We identified one or more issues with a recent delivery for your app, "MyApp" 1.0.0 (1.0.0). Your delivery was successful, but you may wish to correct the following issues in your next delivery: 
ITMS-90999: Invalid executable - The executable in “MyApp.iOS.app” contains multiple segments with the executable permission bit set when it should only contain one. 
After you’ve corrected the issues, you can upload a new binary to App Store Connect. 

Environment

.NET8 RC2.1

@rolfbjarne
Copy link
Member

I've never seen that ITMS message before, and according to Google not many other people has either (https://developer.apple.com/forums/thread/740085 is the only other hit).

Would you be able to attach/provide the .ipa you uploaded?

@rolfbjarne rolfbjarne added this to the Future milestone Nov 6, 2023
@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Nov 6, 2023
@tipa
Copy link
Author

tipa commented Nov 6, 2023

I sent you the .ipa file in a private message. Has Store submission of a NativeAot .ipa been tested by Microsoft?

@rolfbjarne
Copy link
Member

I sent you the .ipa file in a private message.

Thanks!

Has Store submission of a NativeAot .ipa been tested by Microsoft?

Yes, but we might have missed warnings.

@rolfbjarne
Copy link
Member

I wonder if this is the reason:

Load command 4
      cmd LC_SEGMENT_64
  cmdsize 152
  segname __THUNKS
   vmaddr 0x0000000100b84000
   vmsize 0x0000000000008000
  fileoff 10977280
 filesize 32768
  maxprot 0x00000005
 initprot 0x00000005
   nsects 1
    flags 0x0
Section
  sectname __thunks
   segname __THUNKS
      addr 0x0000000100b84000
      size 0x0000000000008000
    offset 10977280
     align 2^14 (16384)
    reloff 0
    nreloc 0
     flags 0x80000400
 reserved1 0
 reserved2 0

This is an executable segment, but the __TEXT segment is also executable.

@filipnavara any reason we can't put the __thunks section in the __TEXT segment?

@rolfbjarne rolfbjarne added bug If an issue is a bug or a pull request a bug fix and removed need-info Waiting for more information before the bug can be investigated labels Nov 6, 2023
@rolfbjarne rolfbjarne modified the milestones: Future, .NET 9 Nov 6, 2023
@filipnavara
Copy link
Contributor

@filipnavara any reason we can't put the __thunks section in the __TEXT segment?

The reason is that the __THUNKS (TEXT) and __THUNKS_DATA (DATA) have to be next to each other. The sections are mapped multiple times to support marshalled delegates. The executable code references the data by relative offset and the data part is modified at runtime.

Fixed number of the marshalled delegates fits into the pre-generated code/data table, and then it gets mapped again at a different memory location. The second mapping needs to a) use the same relative offsets between the code and the data, b) still needs the code part to have valid code signature.

If Apple started blocking that we have a problem. I don't know on any method to ensure an executable layout that would allow the remapping.

@rolfbjarne
Copy link
Member

I don't know on any method to ensure an executable layout that would allow the remapping.

Isn't this what Mono has been doing for years (with no app store warnings)?

@filipnavara
Copy link
Contributor

Isn't this what Mono has been doing for years (with no app store warnings)?

I frankly have no idea. I think Mono may have some fixed limit... @lambdageek, any pointers how marshalled delegates are implemented on Mono/iOS?

@charlesroddie
Copy link

Also got this on uploading to testflight. Something new between dotnet8-rc1 and latest dotnet8.

@filipnavara
Copy link
Contributor

The vm_remap trick in Mono is actually quite cool. I think it can be improved with the VM_FLAGS_OVERWRITE flag to avoid the retry loop and it may be quite reliable way to map the trampoline pages without having them as consecutive blocks in the executable file.

/cc @ivanpovazan

@rolfbjarne
Copy link
Member

This issue was moved to dotnet/runtime#94655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix nativeaot
Projects
Status: Done
Development

No branches or pull requests

4 participants