FEX-Emu / FEX

A fast usermode x86 and x86-64 emulator for Arm64 Linux
https://fex-emu.com
MIT License
2.36k stars 123 forks source link

FEXServer: Listen on both abstract & named sockets #4159

Closed asahilina closed 1 week ago

asahilina commented 2 weeks ago

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 commented 1 week ago

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 commented 1 week ago

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).

asahilina commented 1 week ago

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

asahilina commented 1 week ago

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

Sonicadvance1 commented 1 week ago

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

asahilina commented 1 week ago

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 commented 1 week ago

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

asahilina commented 1 week ago

Added to the docs.