From fe1f00aadbcc003fdf4e619aaf8a2da455c0008a Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 12 Aug 2022 22:52:30 -0700 Subject: [PATCH] FEXServer: Support socket path override This is necessary for the fexserver to function correctly when chrooting in to our rootfs and doing things. Requires independent rootfs script modifications which will come with the next rootfs update. Problem comes down to a chroot supporting multiple users, where our typical use case is only one user. Bind the server file to a single server for the entire chroot session regardless of users, solving this problem inside the chroot. Fixes apt-get inside of chroot, which runs as user _apt. --- External/FEXCore/Source/Interface/Config/Config.json.in | 7 +++++++ Source/Common/FEXServerClient.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/External/FEXCore/Source/Interface/Config/Config.json.in b/External/FEXCore/Source/Interface/Config/Config.json.in index a4b3a9962..3f3af3b5a 100644 --- a/External/FEXCore/Source/Interface/Config/Config.json.in +++ b/External/FEXCore/Source/Interface/Config/Config.json.in @@ -351,6 +351,13 @@ "Desc": [ "Loads an AOT IR cache for the loaded executable." ] + }, + "ServerSocketPath": { + "Type": "str", + "Default": "", + "Desc": [ + "Override for a FEXServer socket path. Only useful for chroots." + ] } } }, diff --git a/Source/Common/FEXServerClient.cpp b/Source/Common/FEXServerClient.cpp index b61c8a85b..0d8667a2c 100644 --- a/Source/Common/FEXServerClient.cpp +++ b/Source/Common/FEXServerClient.cpp @@ -101,7 +101,12 @@ namespace FEXServerClient { } std::string GetServerSocketFile() { - return fmt::format("{}/{}.FEXServer.socket", std::filesystem::temp_directory_path().string(), ::geteuid()); + FEX_CONFIG_OPT(ServerSocketPath, SERVERSOCKETPATH); + if (ServerSocketPath().empty()) { + return fmt::format("{}/{}.FEXServer.socket", std::filesystem::temp_directory_path().string(), ::geteuid()); + } + + return ServerSocketPath; } int GetServerFD() {