-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
C++ crashes when calling any function in nativeaot shared library #110074
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
Tagging subscribers to this area: @dotnet/gc |
If I modify the source code and return directly in the first line of the NUMASupportInitialize function, will it work? |
@CeSun are you running in a docker container? And what is the distro you are using? |
@janvorli Hi, Thanks for your reply, I am using HarmonyOS Next, a new mobile operating system developed by Huawei. This system is similar to Android. And on this system, you can call the native shared library of linux-musl. Currently, this system is in the public beta stage. I have two devices, one with enforcing selinux and the other with disabled selinux. On the device with disabled selinux, the native shared library released by nativeaot works fine, but not on the other. But in the future, the selinux status of the system used by users will be enforcing |
I have also posted a work order in the Huawei Developer Center to seek help from Huawei and am waiting for a response. |
It should work as-if there's no NUMA support, like the non TARGET_LINUX path. |
I also noticed the macro "TARGET_LINUX", but I know nothing about NUMA. |
NUMA refers to Non-Unified Memory Access, for different physical memory controllers connected with different CPU core(s). Accessing memory or cache connected with different memory controller requires going through the slow interconnect bus, like multiple CPU chips. |
@CeSun do you know if the crash happened while calling the syscall or at some later point? |
I was testing with: #include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/syscall.h>
int main(void)
{
if (syscall(__NR_get_mempolicy, NULL, NULL, 0, 0, 0) < 0)
printf("syscall failed with errno %d: %s\n", errno, strerror(errno));
else
printf("didn't fail\n");
return 0;
}
|
when calling the syscall |
@am11 |
@CeSun, I couldn't figure out which "class" to use in SELinux profile, so I went with seccomp security model to repro it. To do that, first the host kernel needs to support
With docker mac (whose host doesn't have
We were handling errno 38 but not 1, so this is somewhat of a corner case (host kernel supports |
@CeSun does it crash for you or does it print the "syscall failed with errno ..." message? If it crashes, then I think it is a likely a bug in the syscall implementation. My theory would be that it for some reason may not properly handle the first argument being NULL. |
The system developer said it was caused by selinux permissions. Is there a way to bypass this system call?
runtime/src/coreclr/gc/unix/numasupport.cpp
Line 57 in 35f2b13
syscall Disassembly:201
NUMASupportInitialize() 0x0000005c8b963458
GCToOSInterface::Initialize() 0x0000005c8b962480
::PalInit() 0x0000005c8b96072c
::RhInitialize(bool) 0x0000005c8b91b1f0
InitializeRuntime() 0x0000005c8b914ebc
Thread::EnsureRuntimeInitialized() 0x0000005c8b91d0e8
Thread::ReversePInvokeAttachOrTrapThread(ReversePInvokeFrame*) 0x0000005c8b91d094
libavalonia_Entry_napi_init__RegisterEntryModule napi_init.cs:12
::RegisterAvaloniaNativeModule() napi_init.cpp:16
The text was updated successfully, but these errors were encountered: