From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: Haibo Xu <haibo.xu@arm.com>, Steve Capper <Steve.Capper@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
jdike@addtoit.com, x86@kernel.org,
Will Deacon <will.deacon@arm.com>,
linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
Richard Weinberger <richard@nod.at>,
Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>,
Andy Lutomirski <luto@kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Thomas Gleixner <tglx@linutronix.de>, Bin Lu <bin.lu@arm.com>,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/6] ptrace: introduce ptrace_syscall_enter to consolidate PTRACE_SYSEMU handling
Date: Mon, 18 Mar 2019 17:31:47 +0300 [thread overview]
Message-ID: <20190318143147.GB27941@altlinux.org> (raw)
In-Reply-To: <20190318104925.16600-3-sudeep.holla@arm.com>
[-- Attachment #1.1: Type: text/plain, Size: 2341 bytes --]
On Mon, Mar 18, 2019 at 10:49:21AM +0000, Sudeep Holla wrote:
> Currently each architecture handles PTRACE_SYSEMU in very similar way.
> It's completely arch independent and can be handled in the code helping
> to consolidate PTRACE_SYSEMU handling.
>
> Let's introduce a hook 'ptrace_syscall_enter' that arch specific syscall
> entry code can call.
>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
> include/linux/ptrace.h | 1 +
> kernel/ptrace.c | 22 ++++++++++++++++++++++
> 2 files changed, 23 insertions(+)
>
> diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
> index edb9b040c94c..e30f51e3363e 100644
> --- a/include/linux/ptrace.h
> +++ b/include/linux/ptrace.h
> @@ -407,6 +407,7 @@ static inline void user_single_step_report(struct pt_regs *regs)
> #define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
> #endif
>
> +extern long ptrace_syscall_enter(struct pt_regs *regs);
> extern int task_current_syscall(struct task_struct *target, long *callno,
> unsigned long args[6], unsigned int maxargs,
> unsigned long *sp, unsigned long *pc);
> diff --git a/kernel/ptrace.c b/kernel/ptrace.c
> index 4fa3b7f4c3c7..c9c505c483df 100644
> --- a/kernel/ptrace.c
> +++ b/kernel/ptrace.c
> @@ -29,6 +29,7 @@
> #include <linux/hw_breakpoint.h>
> #include <linux/cn_proc.h>
> #include <linux/compat.h>
> +#include <linux/tracehook.h>
>
> /*
> * Access another process' address space via ptrace.
> @@ -557,6 +558,27 @@ static int ptrace_detach(struct task_struct *child, unsigned int data)
> return 0;
> }
>
> +/*
> + * Hook to check and report for PTRACE_SYSEMU, can be called from arch
> + * arch syscall entry code
> + */
> +long ptrace_syscall_enter(struct pt_regs *regs)
> +{
> +#ifdef TIF_SYSCALL_EMU
> + if (test_thread_flag(TIF_SYSCALL_EMU)) {
> + if (tracehook_report_syscall_entry(regs))
> + /*
> + * We can ignore the return code here as we need
> + * return -1 always for syscall emulation irrespective
> + * of whether the tracehook report fails or succeed.
> + */
> + ;
This is problematic as it causes build errors with -Werror=empty-body,
see https://lore.kernel.org/lkml/20181218205305.26647-1-malat@debian.org/
--
ldv
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-03-18 14:31 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 10:49 [PATCH v2 0/6] ptrace: consolidate PTRACE_SYSEMU handling and add support for arm64 Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 1/6] ptrace: move clearing of TIF_SYSCALL_EMU flag to core Sudeep Holla
2019-03-18 17:29 ` Oleg Nesterov
2019-03-18 10:49 ` [PATCH v2 2/6] ptrace: introduce ptrace_syscall_enter to consolidate PTRACE_SYSEMU handling Sudeep Holla
2019-03-18 14:31 ` Dmitry V. Levin [this message]
2019-03-18 14:55 ` Sudeep Holla
2019-03-18 14:41 ` Dmitry V. Levin
2019-03-18 14:57 ` Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook Sudeep Holla
2019-03-18 15:33 ` Oleg Nesterov
2019-04-30 16:44 ` Sudeep Holla
2019-05-01 15:57 ` Oleg Nesterov
2019-05-01 16:51 ` Sudeep Holla
2019-04-30 16:46 ` Andy Lutomirski
2019-04-30 17:09 ` Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 4/6] powerpc: use common ptrace_syscall_enter hook to handle _TIF_SYSCALL_EMU Sudeep Holla
2019-03-18 14:26 ` Dmitry V. Levin
2019-03-18 14:59 ` Sudeep Holla
2019-03-18 17:20 ` Oleg Nesterov
2019-03-18 17:24 ` Sudeep Holla
2019-03-18 17:33 ` Oleg Nesterov
2019-03-18 17:40 ` Sudeep Holla
2019-03-19 17:08 ` Oleg Nesterov
2019-03-19 17:32 ` Oleg Nesterov
2019-04-03 16:50 ` Will Deacon
2019-03-18 10:49 ` [PATCH v2 5/6] arm64: add PTRACE_SYSEMU{, SINGLESTEP} definations to uapi headers Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 6/6] arm64: ptrace: add support for syscall emulation Sudeep Holla
2019-03-19 3:26 ` Haibo Xu (Arm Technology China)
2019-03-18 20:04 ` [PATCH v2 0/6] ptrace: consolidate PTRACE_SYSEMU handling and add support for arm64 Andy Lutomirski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190318143147.GB27941@altlinux.org \
--to=ldv@altlinux.org \
--cc=Steve.Capper@arm.com \
--cc=bin.lu@arm.com \
--cc=catalin.marinas@arm.com \
--cc=haibo.xu@arm.com \
--cc=jdike@addtoit.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=oleg@redhat.com \
--cc=paulus@samba.org \
--cc=richard@nod.at \
--cc=sudeep.holla@arm.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).