[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250125204815.GA12624@strace.io>
Date: Sat, 25 Jan 2025 22:48:15 +0200
From: "Dmitry V. Levin" <ldv@...ace.io>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>,
Alexey Gladkov <legion@...nel.org>, Oleg Nesterov <oleg@...hat.com>,
Eugene Syromyatnikov <evgsyr@...il.com>,
Mike Frysinger <vapier@...too.org>,
Renzo Davoli <renzo@...unibo.it>,
Davide Berardi <berardi.dav@...il.com>,
strace-devel@...ts.strace.io,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Nicholas Piggin <npiggin@...il.com>,
Naveen N Rao <naveen@...nel.org>, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/7] powerpc: properly negate error in
syscall_set_return_value()
On Sat, Jan 25, 2025 at 11:17:58PM +1100, Michael Ellerman wrote:
> "Dmitry V. Levin" <ldv@...ace.io> writes:
> > On Thu, Jan 23, 2025 at 08:28:15PM +0200, Dmitry V. Levin wrote:
> ...
> >> After looking at system_call_exception() I doubt this inconsistency can be
> >> easily avoided, so I don't see how this patch could be enhanced further,
> >> and what else could I do with the patch besides dropping it and letting
> >> !trap_is_scv case be unsupported by PTRACE_SET_SYSCALL_INFO API, which
> >> would be unfortunate.
> >
> > If you say this would bring some consistency, I can extend the patch with
> > something like this:
>
> Yes that would improve things IMHO, with one caveat ....
>
> > diff --git a/arch/powerpc/kernel/ptrace/ptrace.c b/arch/powerpc/kernel/ptrace/ptrace.c
> > index 727ed4a14545..dda276a934fd 100644
> > --- a/arch/powerpc/kernel/ptrace/ptrace.c
> > +++ b/arch/powerpc/kernel/ptrace/ptrace.c
> > @@ -207,7 +207,7 @@ static int do_seccomp(struct pt_regs *regs)
> > * syscall parameter. This is different to the ptrace ABI where
> > * both r3 and orig_gpr3 contain the first syscall parameter.
> > */
> > - regs->gpr[3] = -ENOSYS;
> > + syscall_set_return_value(current, regs, -ENOSYS, 0);
> >
> > /*
> > * We use the __ version here because we have already checked
> > @@ -225,7 +225,7 @@ static int do_seccomp(struct pt_regs *regs)
> > * modify the first syscall parameter (in orig_gpr3) and also
> > * allow the syscall to proceed.
> > */
> > - regs->gpr[3] = regs->orig_gpr3;
> > + syscall_set_return_value(current, regs, 0, regs->orig_gpr3);
>
> This case should remain as-is. The orig_gpr3 value here is not a syscall
> error code, it's the original r3 value, which is a syscall parameter.
I agree, but shouldn't CCR.SO be cleared somehow after it was set earlier by
syscall_set_return_value(current, regs, -ENOSYS, 0);
?
--
ldv
Powered by blists - more mailing lists