Skip to content

Sync SystemNative pinvoke tables with dotnet/runtime#11531

Open
jonathanpeppers wants to merge 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers/android-missing-native-symbols
Open

Sync SystemNative pinvoke tables with dotnet/runtime#11531
jonathanpeppers wants to merge 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers/android-missing-native-symbols

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

The SystemNative_* pinvoke table in generate-pinvoke-tables.cc (both CLR and MonoVM) had drifted from the .NET 11 runtime shipped via the VMR (dotnet/dotnet @ 3c45e4f3e8, Microsoft.NETCore.App.Ref 11.0.0-preview.5). This causes a SIGABRT when managed code tries to call native functions that exist in libSystem.Native.so but are missing from the pinvoke override table -- for example, Ping.Send() crashes because SystemNative_IsAtomicNonInheritablePipeCreationSupported was not listed.

Changes

Synced both CLR and MonoVM tables to match the VMR's entrypoints.c, then ran build-tools/scripts/generate-pinvoke-tables.sh to regenerate the pinvoke-tables.include files.

Removed (no longer in runtime):

  • SystemNative_GetFileSystemType
  • SystemNative_GetFormatInfoForMountPoint
  • SystemNative_LowLevelFutex_WaitOnAddress / WaitOnAddressTimeout / WakeByAddressSingle
  • SystemNative_ReadProcessStatusInfo

Added (new in runtime):

  • SystemNative_IsAtomicNonInheritablePipeCreationSupported
  • SystemNative_GetFileSystemTypeNameForMountPoint
  • SystemNative_GetNextAreaInfo
  • SystemNative_GetPlatformSIGSTOP
  • SystemNative_LowLevelCrossProcessMutex_* (8 functions)
  • SystemNative_ReadFromNonblocking / ReadProcessInfo / ReadThreadInfo / ReadV
  • SystemNative_WriteToNonblocking / WriteV

Test

Added a PingTest that exercises Ping.Send("127.0.0.1") on device to catch this class of regression.

Fixes #11530

Update the SystemNative entries in both CLR and MonoVM
generate-pinvoke-tables.cc to match the .NET 11 runtime from
the VMR (dotnet/dotnet @ 3c45e4f3e8), then regenerate the
pinvoke-tables.include files.

Removed (no longer in runtime):
- SystemNative_GetFileSystemType
- SystemNative_GetFormatInfoForMountPoint
- SystemNative_LowLevelFutex_WaitOnAddress
- SystemNative_LowLevelFutex_WaitOnAddressTimeout
- SystemNative_LowLevelFutex_WakeByAddressSingle
- SystemNative_ReadProcessStatusInfo

Added:
- SystemNative_GetFileSystemTypeNameForMountPoint
- SystemNative_GetNextAreaInfo
- SystemNative_GetPlatformSIGSTOP
- SystemNative_IsAtomicNonInheritablePipeCreationSupported
- SystemNative_LowLevelCrossProcessMutex_* (8 functions)
- SystemNative_ReadFromNonblocking
- SystemNative_ReadProcessInfo
- SystemNative_ReadThreadInfo
- SystemNative_ReadV
- SystemNative_WriteToNonblocking
- SystemNative_WriteV

Also add a PingTest that exercises Ping.Send() on localhost to
ensure the pinvoke resolution works end-to-end on device.

Fixes: dotnet#11530

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 28, 2026 20:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Syncs the native SystemNative_* pinvoke override tables used by the CoreCLR and MonoVM Android runtimes to match the .NET 11 VMR (entrypoints.c), addressing crashes when managed code calls missing SystemNative_* exports (e.g., Ping.Send()).

Changes:

  • Updated CoreCLR and MonoVM generate-pinvoke-tables.cc symbol lists to match the .NET 11 runtime entrypoints.
  • Regenerated CoreCLR and MonoVM pinvoke-tables.include with updated counts/hashes (494 → 507 entries).
  • Added an on-device Ping.Send("127.0.0.1") NUnit test and included it in Mono.Android.NET-Tests.csproj.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Mono.Android-Tests/Mono.Android-Tests/System.Net.NetworkInformation/PingTest.cs Adds a device test exercising Ping.Send() to cover the reported crash scenario.
tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj Includes the new PingTest.cs in the test project build.
src/native/mono/pinvoke-override/generate-pinvoke-tables.cc Updates the MonoVM pinvoke symbol source list to match .NET 11 runtime entrypoints.
src/native/mono/pinvoke-override/pinvoke-tables.include Regenerates the MonoVM pinvoke override table with updated entries/count.
src/native/clr/pinvoke-override/generate-pinvoke-tables.cc Updates the CoreCLR pinvoke symbol source list to match .NET 11 runtime entrypoints.
src/native/clr/pinvoke-override/pinvoke-tables.include Regenerates the CoreCLR pinvoke override table with updated entries/count.

@simonrozsival
Copy link
Copy Markdown
Member

/azp run Xamarin.Android-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@simonrozsival
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CoreCLR Ping causes SIGABRT on Android

3 participants