public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390: trim ancient junk from copy_thread()
@ 2023-03-06  0:55 Al Viro
  2023-03-06 14:02 ` Heiko Carstens
  0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2023-03-06  0:55 UTC (permalink / raw)
  To: linux-s390; +Cc: linux-s390

Setting and ->psw.addr in childregs of kernel thread is a rudiment of
the old kernel_thread()/kernel_execve() implementation.  Mainline hadn't
been using them since 2012.

And clarify the assigments to frame->sf.gprs - the array stores grp6..gpr15
values to be set by __switch_to(), so frame->sf.gprs[5] actually affects
grp11, etc.  Better spell that as frame->sf.gprs[11 - 6]...
    
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 67df64ef4839..87ca3a727604 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -136,12 +136,12 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 	p->thread.last_break = 1;
 
 	frame->sf.back_chain = 0;
-	frame->sf.gprs[5] = (unsigned long)frame + sizeof(struct stack_frame);
-	frame->sf.gprs[6] = (unsigned long)p;
+	frame->sf.gprs[11 - 6] = (unsigned long)&frame->childregs;
+	frame->sf.gprs[12 - 6] = (unsigned long)p;
 	/* new return point is ret_from_fork */
-	frame->sf.gprs[8] = (unsigned long)ret_from_fork;
+	frame->sf.gprs[14 - 6] = (unsigned long)ret_from_fork;
 	/* fake return stack for resume(), don't go back to schedule */
-	frame->sf.gprs[9] = (unsigned long)frame;
+	frame->sf.gprs[15 - 6] = (unsigned long)frame;
 
 	/* Store access registers to kernel stack of new process. */
 	if (unlikely(args->fn)) {
@@ -149,8 +149,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 		memset(&frame->childregs, 0, sizeof(struct pt_regs));
 		frame->childregs.psw.mask = PSW_KERNEL_BITS | PSW_MASK_IO |
 					    PSW_MASK_EXT | PSW_MASK_MCHECK;
-		frame->childregs.psw.addr =
-				(unsigned long)__ret_from_fork;
 		frame->childregs.gprs[9] = (unsigned long)args->fn;
 		frame->childregs.gprs[10] = (unsigned long)args->fn_arg;
 		frame->childregs.orig_gpr2 = -1;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390: trim ancient junk from copy_thread()
  2023-03-06  0:55 [PATCH] s390: trim ancient junk from copy_thread() Al Viro
@ 2023-03-06 14:02 ` Heiko Carstens
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2023-03-06 14:02 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-s390

On Mon, Mar 06, 2023 at 12:55:33AM +0000, Al Viro wrote:
> Setting and ->psw.addr in childregs of kernel thread is a rudiment of
> the old kernel_thread()/kernel_execve() implementation.  Mainline hadn't
> been using them since 2012.
> 
> And clarify the assigments to frame->sf.gprs - the array stores grp6..gpr15
> values to be set by __switch_to(), so frame->sf.gprs[5] actually affects
> grp11, etc.  Better spell that as frame->sf.gprs[11 - 6]...
>     
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
> index 67df64ef4839..87ca3a727604 100644
> --- a/arch/s390/kernel/process.c
> +++ b/arch/s390/kernel/process.c

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-06 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-06  0:55 [PATCH] s390: trim ancient junk from copy_thread() Al Viro
2023-03-06 14:02 ` Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox