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

FEXServer: Listen on both abstract & named sockets #4159

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

asahilina
Copy link
Contributor

Abstract sockets have one limitation: they are bound to a network namespace. Chromium/CEF sandboxes using a new netns, which breaks connecting to the FEXServer.

To work around this, use and try both abstract and named sockets. As long as either the filesystem or the network is unsandboxed, things will work. If both are sandboxed, there isn't much we can do... but at that point we shouldn't be reinitializing the FEXServer connection anyway since the FS should be available on FEXInterpreter startup.

@Sonicadvance1
Copy link
Member

Looks like you got clipped by the glibc fault test path. Will need a backtrace to see where glibc is attempting to do an allocation in this mode.

@asahilina asahilina force-pushed the fexserver-two-sockets branch from 6e06cd4 to 6bc8107 Compare November 18, 2024 13:25
@asahilina
Copy link
Contributor Author

I think I fixed it? I don't really know how to run the test, but the only code I can think of that would do allocations behind my back is std::filesystem::temp_directory_path()... (this was actually already used here in the past when the socket was not abstract, but I think that glibc test didn't exist back then).

Apparently this causes allocations which are banned in some paths?
@asahilina asahilina force-pushed the fexserver-two-sockets branch from 6bc8107 to 2f8f479 Compare November 18, 2024 16:47
@asahilina
Copy link
Contributor Author

Oookay, that's another issue, but now I don't know why it didn't fail before. Third time's the charm?

@asahilina
Copy link
Contributor Author

And now the glibc thing again... I have no idea what it could be then. How do I run those tests locally?

@Sonicadvance1
Copy link
Member

Build FEX with -DENABLE_GLIBC_ALLOCATOR_HOOK_FAULT=True -DENABLE_JEMALLOC_GLIBC_ALLOC=False to enable the glibc fault checking. and then for the gcc tests specifically that are failing would be ninja gcc_target_tests_64

This triggers glibc allocation.

Signed-off-by: Asahi Lina <[email protected]>
Abstract sockets have one limitation: they are bound to a network
namespace. Chromium/CEF sandboxes using a new netns, which breaks
connecting to the FEXServer.

To work around this, use and try *both* abstract and named sockets. As
long as either the filesystem or the network is unsandboxed, things will
work. If both are sandboxed, there isn't much we can do... but at that
point we shouldn't be reinitializing the FEXServer connection anyway
since the FS should be available on FEXInterpreter startup.
@asahilina asahilina force-pushed the fexserver-two-sockets branch from 2f8f479 to d761fc4 Compare November 19, 2024 16:58
@asahilina
Copy link
Contributor Author

Oof, it was both std::filesystem::temp_directory_path() as I suspected and strerror(). Which means this was always broken, it's just that the messages never got printed during the tests until now... and I had a missing errno check that was causing one of them to log unnecessarily.

@Sonicadvance1
Copy link
Member

Looks like we should add std::filesystem::temp_directory_path to the Programming Concerns document.

@asahilina
Copy link
Contributor Author

Added to the docs.

@Sonicadvance1 Sonicadvance1 merged commit d5c9655 into FEX-Emu:main Nov 19, 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.

2 participants