Skip to content

Commit

Permalink
x86_64: allocate memory for siginfo and context for signals
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Nov 27, 2024
1 parent eb4f6d2 commit 6347458
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/platform/x86_64/ipc/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6347458

Please sign in to comment.