Skip to content

[native] update p/invoke tables for libSystem.Native.so #10330

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

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

jonathanpeppers
Copy link
Member

Fixes: #10329
Context: dotnet/runtime#116639

Some SystemNative_ methods were removed/changed
in .NET 10 Preview 6. We should update our tables.

Fixes: #10329
Context: dotnet/runtime#116639

Some `SystemNative_` methods were removed/changed
in .NET 10 Preview 6. We should update our tables.
Copy link
Member

@filipnavara filipnavara left a comment

Choose a reason for hiding this comment

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

Tested locally and it fixed the error on our app.

jonathanpeppers added a commit that referenced this pull request Jul 23, 2025
Context: #10330

The problem fixed in #10330 makes me think we are missing a test.
@jonathanpeppers jonathanpeppers merged commit 26aefff into main Jul 24, 2025
59 checks passed
@jonathanpeppers jonathanpeppers deleted the dev/peppers/fix-10329 branch July 24, 2025 01:36
jonathanpeppers added a commit that referenced this pull request Jul 24, 2025
Context: #10330

The problem fixed in #10330 makes me think we are missing a test.

And indeed, this crashed on CoreCLR!

    07-23 22:46:43.058  7510  7535 I NUnit   : DirectoryTest
    07-23 22:46:43.058  7510  7535 I NUnit   : GetFiles 
    07-23 22:46:43.061  7510  7535 D monodroid-assembly: [precompiled] clr_pinvoke_override ("libSystem.Native", "SystemNative_Stat")
    07-23 22:46:43.062  7510  7535 D monodroid: [precompiled] p/invoke found
    07-23 22:46:43.070  7510  7534 I droid.NET_Test: Explicit concurrent copying GC freed 45(32KB) AllocSpace objects, 0(0B) LOS objects, 57% free, 1148KB/2684KB, paused 1.838ms total 7.423ms
    07-23 22:46:43.072  7510  7535 D monodroid-assembly: [precompiled] clr_pinvoke_override ("libSystem.Native", "SystemNative_OpenDir")
    07-23 22:46:43.072  7510  7535 D monodroid: [precompiled] p/invoke found
    07-23 22:46:43.072  7510  7535 D monodroid-assembly: [precompiled] clr_pinvoke_override ("libSystem.Native", "SystemNative_ReadDir")
    07-23 22:46:43.072  7510  7535 D monodroid-assembly: Symbol 'SystemNative_ReadDir' in library 'libSystem.Native' not found in the generated tables, falling back to slow path
    07-23 22:46:43.072  7510  7535 F monodroid-assembly: Missing pinvoke SystemNative_ReadDir@libSystem.Native
    07-23 22:46:43.072  7510  7535 F monodroid-assembly: Abort at precompiled.cc:88:3 ('static void *xamarin::android::PinvokeOverride::monodroid_pinvoke_override(const char *, const char *)')
    --------- beginning of crash
    07-23 22:46:43.073  7510  7535 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7535 (Instrumentation), pid 7510 (droid.NET_Tests)
    07-23 22:46:43.094  7550  7550 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
    07-23 22:46:43.095  1870  1870 I /system/bin/tombstoned: received crash request for pid 7535
    07-23 22:46:43.096  7550  7550 I crash_dump64: performing dump of process 7510 (target tid = 7535)
    07-23 22:46:43.099  7550  7550 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    07-23 22:46:43.099  7550  7550 F DEBUG   : Build fingerprint: 'Android/sdk_phone_x86_64/generic_x86_64:10/QSR1.210820.001/7663313:userdebug/test-keys'
    07-23 22:46:43.099  7550  7550 F DEBUG   : Revision: '0'
    07-23 22:46:43.099  7550  7550 F DEBUG   : ABI: 'x86_64'
    07-23 22:46:43.100  7550  7550 F DEBUG   : Timestamp: 2025-07-23 22:46:43+0000
    07-23 22:46:43.100  7550  7550 F DEBUG   : pid: 7510, tid: 7535, name: Instrumentation  >>> Mono.Android.NET_Tests <<<
    07-23 22:46:43.100  7550  7550 F DEBUG   : uid: 10119
    07-23 22:46:43.100  7550  7550 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
    07-23 22:46:43.100  7550  7550 F DEBUG   : Abort message: 'Missing pinvoke SystemNative_ReadDir@libSystem.Native'
    07-23 22:46:43.100  7550  7550 F DEBUG   :     rax 0000000000000000  rbx 0000000000001d56  rcx 000078b597d263f8  rdx 0000000000000006
    07-23 22:46:43.100  7550  7550 F DEBUG   :     r8  000078b50724aa40  r9  0000000000000000  r10 000078b4b9e158d0  r11 0000000000000246
    07-23 22:46:43.100  7550  7550 F DEBUG   :     r12 000078b507358b00  r13 000078b4b9e159c0  r14 000078b4b9e15958  r15 0000000000001d6f
    07-23 22:46:43.100  7550  7550 F DEBUG   :     rdi 0000000000001d56  rsi 0000000000001d6f
    07-23 22:46:43.100  7550  7550 F DEBUG   :     rbp 000078b4b9e15a70  rsp 000078b4b9e158c8  rip 000078b597d263f8
    07-23 22:46:43.263  7550  7550 F DEBUG   : 
    07-23 22:46:43.263  7550  7550 F DEBUG   : backtrace:
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #00 pc 00000000000943f8  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+24) (BuildId: b5c6019a3b4ea61b5e9a2f56319b584e)
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #1 pc 0000000000097146  /apex/com.android.runtime/lib64/bionic/libc.so (abort+182) (BuildId: b5c6019a3b4ea61b5e9a2f56319b584e)
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #2 pc 00000000000c41c9  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk!libnet-android.release.so (offset 0x1850000) (xamarin::android::Helpers::abort_application(_LogCategories, char const*, bool, std::__ndk1::source_location)+425) (BuildId: f25730a1c837257e71f58c776b710328f9824f26)
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #3 pc 00000000000cee85  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk!libnet-android.release.so (offset 0x1850000) (xamarin::android::PinvokeOverride::monodroid_pinvoke_override(char const*, char const*)+8725) (BuildId: f25730a1c837257e71f58c776b710328f9824f26)
    07-23 22:46:43.264  7550  7550 F DEBUG   :       #4 pc 00000000000cf191  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk!libnet-android.release.so (offset 0x1850000) (xamarin::android::Host::clr_pinvoke_override(char const*, char const*)+225) (BuildId: f25730a1c837257e71f58c776b710328f9824f26)
    07-23 22:46:43.264  7550  7550 F DEBUG   :       #5 pc 00000000003f21f6  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk

With the fix in place in #10330, it passes.
jonathanpeppers added a commit that referenced this pull request Jul 24, 2025
Fixes: #10329
Context: dotnet/runtime#116639

Some `SystemNative_` methods were removed/changed
in .NET 10 Preview 6. We should update our tables.
jonathanpeppers added a commit that referenced this pull request Jul 24, 2025
Context: #10330

The problem fixed in #10330 makes me think we are missing a test.

And indeed, this crashed on CoreCLR!

    07-23 22:46:43.058  7510  7535 I NUnit   : DirectoryTest
    07-23 22:46:43.058  7510  7535 I NUnit   : GetFiles 
    07-23 22:46:43.061  7510  7535 D monodroid-assembly: [precompiled] clr_pinvoke_override ("libSystem.Native", "SystemNative_Stat")
    07-23 22:46:43.062  7510  7535 D monodroid: [precompiled] p/invoke found
    07-23 22:46:43.070  7510  7534 I droid.NET_Test: Explicit concurrent copying GC freed 45(32KB) AllocSpace objects, 0(0B) LOS objects, 57% free, 1148KB/2684KB, paused 1.838ms total 7.423ms
    07-23 22:46:43.072  7510  7535 D monodroid-assembly: [precompiled] clr_pinvoke_override ("libSystem.Native", "SystemNative_OpenDir")
    07-23 22:46:43.072  7510  7535 D monodroid: [precompiled] p/invoke found
    07-23 22:46:43.072  7510  7535 D monodroid-assembly: [precompiled] clr_pinvoke_override ("libSystem.Native", "SystemNative_ReadDir")
    07-23 22:46:43.072  7510  7535 D monodroid-assembly: Symbol 'SystemNative_ReadDir' in library 'libSystem.Native' not found in the generated tables, falling back to slow path
    07-23 22:46:43.072  7510  7535 F monodroid-assembly: Missing pinvoke SystemNative_ReadDir@libSystem.Native
    07-23 22:46:43.072  7510  7535 F monodroid-assembly: Abort at precompiled.cc:88:3 ('static void *xamarin::android::PinvokeOverride::monodroid_pinvoke_override(const char *, const char *)')
    --------- beginning of crash
    07-23 22:46:43.073  7510  7535 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7535 (Instrumentation), pid 7510 (droid.NET_Tests)
    07-23 22:46:43.094  7550  7550 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
    07-23 22:46:43.095  1870  1870 I /system/bin/tombstoned: received crash request for pid 7535
    07-23 22:46:43.096  7550  7550 I crash_dump64: performing dump of process 7510 (target tid = 7535)
    07-23 22:46:43.099  7550  7550 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    07-23 22:46:43.099  7550  7550 F DEBUG   : Build fingerprint: 'Android/sdk_phone_x86_64/generic_x86_64:10/QSR1.210820.001/7663313:userdebug/test-keys'
    07-23 22:46:43.099  7550  7550 F DEBUG   : Revision: '0'
    07-23 22:46:43.099  7550  7550 F DEBUG   : ABI: 'x86_64'
    07-23 22:46:43.100  7550  7550 F DEBUG   : Timestamp: 2025-07-23 22:46:43+0000
    07-23 22:46:43.100  7550  7550 F DEBUG   : pid: 7510, tid: 7535, name: Instrumentation  >>> Mono.Android.NET_Tests <<<
    07-23 22:46:43.100  7550  7550 F DEBUG   : uid: 10119
    07-23 22:46:43.100  7550  7550 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
    07-23 22:46:43.100  7550  7550 F DEBUG   : Abort message: 'Missing pinvoke SystemNative_ReadDir@libSystem.Native'
    07-23 22:46:43.100  7550  7550 F DEBUG   :     rax 0000000000000000  rbx 0000000000001d56  rcx 000078b597d263f8  rdx 0000000000000006
    07-23 22:46:43.100  7550  7550 F DEBUG   :     r8  000078b50724aa40  r9  0000000000000000  r10 000078b4b9e158d0  r11 0000000000000246
    07-23 22:46:43.100  7550  7550 F DEBUG   :     r12 000078b507358b00  r13 000078b4b9e159c0  r14 000078b4b9e15958  r15 0000000000001d6f
    07-23 22:46:43.100  7550  7550 F DEBUG   :     rdi 0000000000001d56  rsi 0000000000001d6f
    07-23 22:46:43.100  7550  7550 F DEBUG   :     rbp 000078b4b9e15a70  rsp 000078b4b9e158c8  rip 000078b597d263f8
    07-23 22:46:43.263  7550  7550 F DEBUG   : 
    07-23 22:46:43.263  7550  7550 F DEBUG   : backtrace:
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #00 pc 00000000000943f8  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+24) (BuildId: b5c6019a3b4ea61b5e9a2f56319b584e)
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #1 pc 0000000000097146  /apex/com.android.runtime/lib64/bionic/libc.so (abort+182) (BuildId: b5c6019a3b4ea61b5e9a2f56319b584e)
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #2 pc 00000000000c41c9  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk!libnet-android.release.so (offset 0x1850000) (xamarin::android::Helpers::abort_application(_LogCategories, char const*, bool, std::__ndk1::source_location)+425) (BuildId: f25730a1c837257e71f58c776b710328f9824f26)
    07-23 22:46:43.263  7550  7550 F DEBUG   :       #3 pc 00000000000cee85  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk!libnet-android.release.so (offset 0x1850000) (xamarin::android::PinvokeOverride::monodroid_pinvoke_override(char const*, char const*)+8725) (BuildId: f25730a1c837257e71f58c776b710328f9824f26)
    07-23 22:46:43.264  7550  7550 F DEBUG   :       #4 pc 00000000000cf191  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk!libnet-android.release.so (offset 0x1850000) (xamarin::android::Host::clr_pinvoke_override(char const*, char const*)+225) (BuildId: f25730a1c837257e71f58c776b710328f9824f26)
    07-23 22:46:43.264  7550  7550 F DEBUG   :       #5 pc 00000000003f21f6  /data/app/Mono.Android.NET_Tests-3-1TDlT55wuyU7WHXRhzQQ==/split_config.x86_64.apk

With the fix in place in #10330, it passes.
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.

P/Invoke override tables seem to be out of date
2 participants