Skip to content

Commit

Permalink
Merge pull request FEX-Emu#4322 from Sonicadvance1/protect_first_page…
Browse files Browse the repository at this point in the history
…_altstack

SignalDelegator: Protect first page of the altstack
  • Loading branch information
Sonicadvance1 authored Feb 3, 2025
2 parents 713ebf1 + b01a6b9 commit 62cfc26
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,9 @@ void SignalDelegator::RegisterTLSState(FEX::HLE::ThreadStateObject* Thread) {
// Copy the thread object to the start of the alt-stack
memcpy(Thread->SignalInfo.AltStackPtr, &Thread, sizeof(void*));

// Protect the first page of the alt-stack for overflow protection.
mprotect(Thread->SignalInfo.AltStackPtr, 4096, PROT_READ);

// Register the alt stack
const int Result = sigaltstack(&altstack, nullptr);
if (Result == -1) {
Expand Down

0 comments on commit 62cfc26

Please sign in to comment.