Skip to content

Commit

Permalink
fixup signal
Browse files Browse the repository at this point in the history
  • Loading branch information
thehajime committed Oct 9, 2024
1 parent a14e430 commit 0d60af3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions arch/x86/um/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
return err;

#ifndef CONFIG_MMU
/* XXX: need to push handler address at SP */
/* we need to push handler address at top of stack, as
* __kernel_vsyscall, called after this returns with ret with
* stack contents, thus push the handler here. */
frame = (struct rt_sigframe __user *) ((unsigned long) frame -
sizeof(unsigned long));
err |= __put_user((unsigned long)ksig->ka.sa.sa_handler,
Expand Down Expand Up @@ -571,7 +573,17 @@ SYSCALL_DEFINE0(rt_sigreturn)
struct rt_sigframe __user *frame =
(struct rt_sigframe __user *)(sp - sizeof(long));
#ifndef CONFIG_MMU
/* XXX: need to pop handler address at SP */
/**
* we enter here with:
*
* __restore_rt:
* mov $15, %rax
* call *%rax (translated from syscall)
*
* (code is from musl libc)
* so, stack needs to be popped of "call"ed address before
* looking at rt_sigframe.
*/
frame = (struct rt_sigframe __user *)((unsigned long)frame + sizeof(long));
#endif
struct ucontext __user *uc = &frame->uc;
Expand Down

0 comments on commit 0d60af3

Please sign in to comment.