On Mon, Mar 18, 2019 at 05:26:18PM +0300, Dmitry V. Levin wrote:
> On Mon, Mar 18, 2019 at 10:49:23AM +0000, Sudeep Holla wrote:
> > Now that we have a new hook ptrace_syscall_enter that can be called from
> > syscall entry code and it handles PTRACE_SYSEMU in generic code, we
> > can do some cleanup using the same in do_syscall_trace_enter.
> > 
> > Cc: Oleg Nesterov <o...@redhat.com>
> > Cc: Paul Mackerras <pau...@samba.org>
> > Cc: Michael Ellerman <m...@ellerman.id.au>
> > Signed-off-by: Sudeep Holla <sudeep.ho...@arm.com>
> > ---
> >  arch/powerpc/kernel/ptrace.c | 48 ++++++++++++++++--------------------
> >  1 file changed, 21 insertions(+), 27 deletions(-)
> > 
> > diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> > index 2e2183b800a8..05579a5dcb12 100644
> > --- a/arch/powerpc/kernel/ptrace.c
> > +++ b/arch/powerpc/kernel/ptrace.c
> > @@ -3278,35 +3278,29 @@ long do_syscall_trace_enter(struct pt_regs *regs)
> >  
> >     user_exit();
> >  
> > -   flags = READ_ONCE(current_thread_info()->flags) &
> > -           (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE);
> > -
> > -   if (flags) {
> > -           int rc = tracehook_report_syscall_entry(regs);
> > +   if (unlikely(ptrace_syscall_enter(regs))) {
> > +           /*
> > +            * A nonzero return code from tracehook_report_syscall_entry()
> > +            * tells us to prevent the syscall execution, but we are not
> > +            * going to execute it anyway.
> > +            *
> > +            * Returning -1 will skip the syscall execution. We want to
> > +            * avoid clobbering any registers, so we don't goto the skip
> > +            * label below.
> > +            */
> > +           return -1;
> > +   }
> 
> This comment is out of sync with the changed code.

Still applicable indirectly as ptrace_syscall_enter just executes
tracehook_report_syscall_entry, but I agree needs rewording, will update.

--
Regards,
Sudeep

Reply via email to