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

Unimplemented Syscalls #87

Open
rennergade opened this issue Jan 15, 2025 · 4 comments
Open

Unimplemented Syscalls #87

rennergade opened this issue Jan 15, 2025 · 4 comments
Assignees
Labels

Comments

@rennergade
Copy link
Contributor

There's been discussion that when compiling applications (coreutils, python etc) that they are using syscalls that we haven't implemented.

I believe this is due to the configure script. From some quick research:

configure generates short C programs that attempt to include specific headers and call the desired system calls. It then tries to compile these programs. If the compilation succeeds, the script concludes that the system call or feature is available.

I think the easiest way to fix this is to undefine unimplemented syscalls in libc.

@qianxichen233
Copy link
Contributor

Yeah, this is one way to fix them. I think there might be a huge amount of syscalls in glibc (probably around 300-400), so finding the glibc entries for these syscalls and undefine them might take some time because there isn't an universal folder that just hold all the syscall files, many syscalls files are seperated into different locations and we need to find them first.
Besides, I think there are also syscalls that are just variants of syscalls that we already support (e.g. dup3 syscall). For I guess we also need to filter out all the possible variants of syscalls that we can support and support them as well?

@qianxichen233
Copy link
Contributor

And I also think there should be many non-syscall functions in glibc are using these unimplemented syscalls as well. So if we just undefine the syscalls, we also need to recursively undefine(or comment out) all functions that used these syscalls as well.

@Yaxuan-w
Copy link
Member

Yaxuan-w commented Jan 15, 2025

because there isn't an universal folder that just hold all the syscall files, many syscalls files are seperated into different locations and we need to find them first.

Agreed. Also some syscalls are implemented inside the variant syscall (eg: readlinkat/readlink). So finding the variances might be more efficient

@rennergade
Copy link
Contributor Author

That makes sense.

It may be useful to take a look at what macros already exist in libc, and why we see these pop up in lind-wasm vs lind-nacl. For example someone mentioned dup3 which hadn't shown up in lind-nacl compilations. It seems like there is a __USE_GNU macro that toggles whether that syscall is implemented.

There's probably a few macro defines differing between the two platforms producing different compilation results, and just getting those to match would probably simplify the development process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants