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

Support CLONE_FS and CLONE_FILES with fork() semantics #4157

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

asahilina
Copy link
Contributor

Needed by Discord, part of the Chromium sandbox code. The warning still triggers because Chromium asks for CLONE_VM on x86_64, but that can be safely ignored (CLONE_FS is the one that matters).

I'm not sure if this is exactly the right semantics, but it seems like an improvement at least?

With this and a hack to allow the FEXServer connection to fail (which happens because the sandbox puts the process in a new netns so the UNIX socket doesn't work, not sure what to do about that...), Discord gets as far as the main window and then crashes (without these changes it dies very early).

@neobrain
Copy link
Member

What's the difference between fork and clone3 as used here? Are they equivalent as long as these new flags aren't set?

@asahilina
Copy link
Contributor Author

What's the difference between fork and clone3 as used here? Are they equivalent as long as these new flags aren't set?

I think so but I haven't found an exact reference for what clone3() inputs are strictly identical to fork(), so this is just what I gather from skimming the manpage...

@Sonicadvance1
Copy link
Member

Needs code formatted.

Needed by Discord, part of the Chromium sandbox code. The warning still
triggers because Chromium asks for CLONE_VM on x86_64, but that can be
safely ignored (CLONE_FS is the one that matters).
@asahilina
Copy link
Contributor Author

Should be fixed I think!

@Sonicadvance1
Copy link
Member

What's the difference between fork and clone3 as used here? Are they equivalent as long as these new flags aren't set?

Clone/clone3 supports everything that fork and vfork can do, just in a more configurable syscall. There's a good chance that for FEX to properly implement vfork, that we will need to use clone, so we can pivot the host stack at the point of calling even.

@Sonicadvance1 Sonicadvance1 merged commit bcfdf39 into FEX-Emu:main Nov 18, 2024
12 checks passed
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.

3 participants