From 6347458b01d8812df349ad1622a32a0c7493e480 Mon Sep 17 00:00:00 2001 From: jewelcodes Date: Tue, 26 Nov 2024 19:07:11 -0500 Subject: [PATCH] x86_64: allocate memory for siginfo and context for signals --- src/platform/x86_64/ipc/signal.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/platform/x86_64/ipc/signal.c b/src/platform/x86_64/ipc/signal.c index 26621fa..05d6351 100644 --- a/src/platform/x86_64/ipc/signal.c +++ b/src/platform/x86_64/ipc/signal.c @@ -24,8 +24,23 @@ int platformSignalSetup(Thread *t) { void *trampoline = uxmalloc(sigstubSize); if(!trampoline) return -1; + void *siginfo = umalloc(sizeof(siginfo_t)); + if(!siginfo) { + free(trampoline); + return -1; + } + + void *sigctx = umalloc(PLATFORM_CONTEXT_SIZE); + if(!sigctx) { + free(trampoline); + free(siginfo); + return -1; + } + memcpy(trampoline, sigstub, sigstubSize); t->signalTrampoline = (uintptr_t) trampoline; + t->siginfo = (uintptr_t) siginfo; + t->signalUserContext = (uintptr_t) sigctx; return 0; }