Linux: Fixes 32-bit sigaltstack

Due to an incorrect pointer check, we were never setting the sigaltstack
on 32-bit applications.
Additionally the stack_t type didn't have the members in the correct
order.

This fixes wine 32-bit applications where wine sends an application
SIGUSR1 and expects the altstack to be used. This is because the
altstack has the thread's TEB region at the start of the stack.

Without this when the application was getting sent a SIGUSR1, it would
remain in the application stack, thus getting an invalid TEB and loading
an FS register with zero.
This commit is contained in:
Ryan Houdek committed 2021-08-20 23:55:56 -07:00
1 parent 84f42f6155
commit 7bfa1c4838
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -224,7 +224,7 @@ namespace FEX::HLE::x32 {
stack_t *ss64_ptr{};
stack_t *old64_ptr{};
if (ss64_ptr) {
if (ss) {
ss64 = *ss;
ss64_ptr = &ss64;
}
+3 -3
View File
@@ -242,23 +242,23 @@ FEX_ANNOTATE("alias-x86_32-stack_t")
FEX_ANNOTATE("fex-match")
stack_t32 {
compat_ptr<void> ss_sp;
compat_size_t ss_size;
int32_t ss_flags;
compat_size_t ss_size;
stack_t32() = delete;
operator stack_t() const {
stack_t ss{};
ss.ss_sp = ss_sp;
ss.ss_size = ss_size;
ss.ss_flags = ss_flags;
ss.ss_size = ss_size;
return ss;
}
stack_t32(stack_t ss)
: ss_sp {ss.ss_sp} {
ss_size = ss.ss_size;
ss_flags = ss.ss_flags;
ss_size = ss.ss_size;
}
};