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
This commit is contained in:
Ryan Houdek committed 2026-01-10 16:22:10 -08:00
1 parent 1d411df274
commit f76170eab4
1 file changed
+4 -3
+4 -3
View File
@@ -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<FEX::HLE::ThreadStateObject*>(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) {