From 80927bf0e19666768488bbd0b76e0d7fc02b4436 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 4 Dec 2023 17:39:07 -0800 Subject: [PATCH] FEXLoader: Temporarily disable CLONE_CLEAR_SIGHAND This flag breaks FEX heavily for now. glibc 2.38 started using this flag as an optimization for posix_spawn. It will fall back to a "non-optimized" implementation if the clone syscall returns EINVAL. For now do this while we investigate a more proper implementation. Should be backported to 2312.1. --- Source/Tools/FEXLoader/LinuxSyscalls/Syscalls.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Tools/FEXLoader/LinuxSyscalls/Syscalls.cpp b/Source/Tools/FEXLoader/LinuxSyscalls/Syscalls.cpp index 431eca4df..1a2849670 100644 --- a/Source/Tools/FEXLoader/LinuxSyscalls/Syscalls.cpp +++ b/Source/Tools/FEXLoader/LinuxSyscalls/Syscalls.cpp @@ -525,6 +525,14 @@ static uint64_t Clone3Handler(FEXCore::Core::CpuStateFrame *Frame, FEX::HLE::clo uint64_t CloneHandler(FEXCore::Core::CpuStateFrame *Frame, FEX::HLE::clone3_args *args) { uint64_t flags = args->args.flags; + if (flags & CLONE_CLEAR_SIGHAND) { + // CLONE_CLEAR_SIGHAND was added in kernel 5.5. FEX doesn't properly support this. + // glibc started using this flag in 2.38 as an optimization for posix_spawn. + // If clone returns EINVAL or ENOSYS then it will fallback to the non-optimized path. + LogMan::Msg::IFmt("CLONE_CLEAR_SIGHAND passed to clone3. Returning EINVAL."); + return -EINVAL; + } + auto HasUnhandledFlags = [](FEX::HLE::clone3_args *args) -> bool { constexpr uint64_t UNHANDLED_FLAGS = CLONE_NEWNS |