diff --git a/tools/fex/patches/0023-read-host-status-directly.patch b/tools/fex/patches/0023-read-host-status-directly.patch new file mode 100644 index 0000000000..43a5701ede --- /dev/null +++ b/tools/fex/patches/0023-read-host-status-directly.patch @@ -0,0 +1,40 @@ +From e865603a39eeeb42b8573abf35845c2d0d008c4a Mon Sep 17 00:00:00 2001 +From: maxjivi05 +Date: Wed, 2 Dec 2026 18:25:20 -0500 +Subject: [PATCH] Read FEX's own /proc/self/status through the raw openat + syscall + +--- + .../LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp | 2 +- + Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp +index c1a91d122..5394b1603 100644 +--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp ++++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp +@@ -784,7 +784,7 @@ int32_t EmulatedFDManager::ProcStatus(FEXCore::Context::Context* ctx, int32_t fd + char Buf[8192]; + ssize_t Len = 0; + { +- int HostFD = ::open("/proc/self/status", O_RDONLY | O_CLOEXEC); ++ int HostFD = static_cast(::syscall(SYS_openat, AT_FDCWD, "/proc/self/status", O_RDONLY | O_CLOEXEC)); + if (HostFD >= 0) { + Len = ::read(HostFD, Buf, sizeof(Buf) - 1); + ::close(HostFD); +diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp +index ca4c86063..6680a93ac 100644 +--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp ++++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp +@@ -133,7 +133,7 @@ namespace { + } + + bool HasHostTracer() { +- const int fd = ::open("/proc/self/status", O_RDONLY | O_CLOEXEC); ++ const int fd = static_cast(::syscall(SYS_openat, AT_FDCWD, "/proc/self/status", O_RDONLY | O_CLOEXEC)); + if (fd < 0) { + return true; + } +-- +2.43.0 +