[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87efbe166y.fsf@concordia.ellerman.id.au>
Date: Thu, 22 Nov 2018 08:17:25 +1100
From: Michael Ellerman <mpe@...erman.id.au>
To: "Dmitry V. Levin" <ldv@...linux.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>
Cc: Oleg Nesterov <oleg@...hat.com>, Breno Leitao <leitao@...ian.org>,
Andy Lutomirski <luto@...nel.org>,
Eugene Syromyatnikov <esyr@...hat.com>,
Elvira Khabirova <lineprinter@...linux.org>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call
Hi Dmitry,
Thanks for the patch.
"Dmitry V. Levin" <ldv@...linux.org> writes:
> From: Elvira Khabirova <lineprinter@...linux.org>
>
> Arch code should use tracehook_*() helpers as documented
> in include/linux/tracehook.h,
> ptrace_report_syscall() is not expected to be used outside that file.
>
> Co-authored-by: Dmitry V. Levin <ldv@...linux.org>
> Fixes: 5521eb4bca2d ("powerpc/ptrace: Add support for PTRACE_SYSEMU")
> Signed-off-by: Elvira Khabirova <lineprinter@...linux.org>
> Signed-off-by: Dmitry V. Levin <ldv@...linux.org>
> ---
>
> v3: add a descriptive comment
> v2: explicitly ignore tracehook_report_syscall_entry() return code
>
> arch/powerpc/kernel/ptrace.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> index afb819f4ca68..e84220d91bbd 100644
> --- a/arch/powerpc/kernel/ptrace.c
> +++ b/arch/powerpc/kernel/ptrace.c
> @@ -3266,7 +3266,12 @@ long do_syscall_trace_enter(struct pt_regs *regs)
> user_exit();
>
> if (test_thread_flag(TIF_SYSCALL_EMU)) {
> - ptrace_report_syscall(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.
> + */
> + (void) tracehook_report_syscall_entry(regs);
Unfortunately the (void) cast doesn't work to suppress the must check
warning.
arch/powerpc/kernel/ptrace.c:3274:3: error: ignoring return value of 'tracehook_report_syscall_entry', declared with attribute warn_unused_result [-Werror=unused-result]
AFAIK we don't have a way to suppress that.
I guess we should rewrite it to only call
tracehook_report_syscall_entry() once, like x86 does.
I'll try and get a patch for that done & tested.
cheers
Powered by blists - more mailing lists