[PATCH v7 2/6] syscall.h: add syscall_set_arguments()

Dmitry V. Levin ldv at strace.io
Wed Apr 9 16:18:02 PDT 2025


On Wed, Apr 09, 2025 at 08:52:07AM -0700, Nathan Chancellor wrote:
> On Wed, Apr 09, 2025 at 09:40:18AM +0300, Dmitry V. Levin wrote:
> > On Tue, Apr 08, 2025 at 05:38:03PM -0700, Nathan Chancellor wrote:
> > > diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h
> > > index a5281cdf2b10..34313387f977 100644
> > > --- a/arch/riscv/include/asm/syscall.h
> > > +++ b/arch/riscv/include/asm/syscall.h
> > > @@ -69,8 +69,11 @@ static inline void syscall_get_arguments(struct task_struct *task,
> > >  					 unsigned long *args)
> > >  {
> > >  	args[0] = regs->orig_a0;
> > > -	args++;
> > > -	memcpy(args, &regs->a1, 5 * sizeof(args[0]));
> > > +	args[1] = regs->a1;
> > > +	args[2] = regs->a2;
> > > +	args[3] = regs->a3;
> > > +	args[4] = regs->a4;
> > > +	args[5] = regs->a5;
> > >  }
> > >  
> > >  static inline void syscall_set_arguments(struct task_struct *task,
> > > @@ -78,8 +81,11 @@ static inline void syscall_set_arguments(struct task_struct *task,
> > >  					 const unsigned long *args)
> > >  {
> > >  	regs->orig_a0 = args[0];
> > > -	args++;
> > > -	memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
> > > +	regs->a1 = args[1];
> > > +	regs->a2 = args[2];
> > > +	regs->a3 = args[3];
> > > +	regs->a4 = args[4];
> > > +	regs->a5 = args[5];
> > >  }
> > >  
> > >  static inline int syscall_get_arch(struct task_struct *task)
> > 
> > Looks good, thanks.  How do we proceed from this point?
> 
> I can send a standalone patch for syscall_get_arguments() since that is
> an issue present before your series then Andrew could fold in the same
> change for syscall_set_arguments() into your change that introduces it
> so there is no bisect problem?

Fine with me.  Thanks for taking care of this issue.


-- 
ldv



More information about the linux-riscv mailing list