[RFC PATCH 09/13] x86/um: nommu: signal handling

Johannes Berg johannes at sipsolutions.net
Fri Oct 25 02:30:41 PDT 2024


On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote:
> This commit updates the behavior of signal handling under !MMU
> environment. 1) the stack preparation for the signal handlers and
> 2) retoration of stack after rt_sigreturn(2) syscall.  Those are 

typo: restoration

> @@ -562,6 +574,20 @@ SYSCALL_DEFINE0(rt_sigreturn)
>  	unsigned long sp = PT_REGS_SP(&current->thread.regs);
>  	struct rt_sigframe __user *frame =
>  		(struct rt_sigframe __user *)(sp - sizeof(long));
> +#ifndef CONFIG_MMU
> +	/**
> +	 * 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;

you shouldn't put code in the middle of variable declarations ...

I see why, but probably just split #if/#else/#endif?

johannes



More information about the linux-um mailing list