From f76170eab448009686eb5efbc7f57ae92a4938bb Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 9 Jan 2026 20:25:51 -0800 Subject: [PATCH] Linux: Fixes personality inheritence UML disables ASLR using a personality. FEX in the ELFCodeLoader was accidentally erasing personalities. This caused UML to do a bootloop trying to repeat disable ASLR. It now gets ASLR disabled, but fails shortly afterwards. For #5206 --- Source/Tools/FEXInterpreter/ELFCodeLoader.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Tools/FEXInterpreter/ELFCodeLoader.h b/Source/Tools/FEXInterpreter/ELFCodeLoader.h index 6272a3c98..92c49e0ed 100644 --- a/Source/Tools/FEXInterpreter/ELFCodeLoader.h +++ b/Source/Tools/FEXInterpreter/ELFCodeLoader.h @@ -411,7 +411,9 @@ public: // Set the process personality here // Also, what about ADDR_LIMIT_3GB & co ? - if (-1 == personality(PER_LINUX | (ExecuteAll ? READ_IMPLIES_EXEC : 0))) { + uint32_t Personality = personality(~0ULL); + Personality |= ExecuteAll ? READ_IMPLIES_EXEC : 0; + if (-1 == personality(Personality)) { LogMan::Msg::EFmt("Setting personality failed"); return false; } @@ -419,7 +421,7 @@ public: if (Thread) { // Update the thread persona. auto ThreadObject = static_cast(Thread->FrontendPtr); - ThreadObject->persona = ::personality(0xffffffff); + ThreadObject->persona = Personality; } // What about ASLR and such ? @@ -545,7 +547,6 @@ public: #define ASLR_LOAD #ifdef ASLR_LOAD // Only enable ASLR randomization if the personality has it enabled. - uint32_t Personality = personality(~0ULL); bool NoRandomize = (Personality & ADDR_NO_RANDOMIZE) == ADDR_NO_RANDOMIZE; if (!NoRandomize) {