diff --git a/tools/fex/patches/0022-proc-status-seccomp-of-calling-thread.patch b/tools/fex/patches/0022-proc-status-seccomp-of-calling-thread.patch new file mode 100644 index 0000000000..e44dce6f65 --- /dev/null +++ b/tools/fex/patches/0022-proc-status-seccomp-of-calling-thread.patch @@ -0,0 +1,51 @@ +From 597bfab6ff068e0f6c08f63d6940486446967b0d Mon Sep 17 00:00:00 2001 +From: maxjivi05 +Date: Wed, 2 Dec 2026 18:21:23 -0500 +Subject: [PATCH] Report the calling thread's seccomp mode in /proc/self/status + +--- + .../LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp | 6 +++++- + .../Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h | 10 ++++++++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp +index 156e3964c..c1a91d122 100644 +--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp ++++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/EmulatedFiles/EmulatedFiles.cpp +@@ -796,7 +796,11 @@ int32_t EmulatedFDManager::ProcStatus(FEXCore::Context::Context* ctx, int32_t fd + Buf[Len] = '\0'; + + uint32_t SeccompMode = SECCOMP_MODE_DISABLED; +- if (auto* Thread = FEX::HLE::ThreadManager::GetCurrentThreadObject()) { ++ auto* Thread = FEX::HLE::_SyscallHandler ? FEX::HLE::_SyscallHandler->TM.FindThreadByTID(::gettid()) : nullptr; ++ if (!Thread) { ++ Thread = FEX::HLE::ThreadManager::GetCurrentThreadObject(); ++ } ++ if (Thread) { + SeccompMode = Thread->SeccompMode; + } + +diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h b/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h +index c5bfe3c25..657de6ceb 100644 +--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h ++++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h +@@ -289,6 +289,16 @@ public: + return &Threads; + } + ++ FEX::HLE::ThreadStateObject* FindThreadByTID(uint32_t TID) { ++ std::lock_guard lk(ThreadCreationMutex); ++ for (auto* Thread : Threads) { ++ if (Thread->ThreadInfo.TID == TID) { ++ return Thread; ++ } ++ } ++ return nullptr; ++ } ++ + private: + struct InvalidationStats { + explicit InvalidationStats(FEXCore::Core::InternalThreadState* Thread) +-- +2.43.0 + diff --git a/tools/nativeguest/hook/signals.c b/tools/nativeguest/hook/signals.c index 3e55ccf06a..3d370bae28 100644 --- a/tools/nativeguest/hook/signals.c +++ b/tools/nativeguest/hook/signals.c @@ -69,7 +69,7 @@ static void ddnatv_sigsys_handler(int sig, siginfo_t *info, void *ctx) { else g_app_sigsys.sa_handler(sig); return; } - if (info->si_code != SYS_SECCOMP) { + if (!host_trap) { int (*real_sig)(int, const struct sigaction *, struct sigaction *) = get_real_sigaction(); if (real_sig) { struct sigaction sa_dfl;