From: Oleg Nesterov <oleg@redhat.com>
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, Bin Lu <bin.lu@arm.com>,
Richard Weinberger <richard@nod.at>,
Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook
Date: Mon, 18 Mar 2019 16:33:22 +0100 [thread overview]
Message-ID: <20190318153321.GA23521@redhat.com> (raw)
In-Reply-To: <20190318104925.16600-4-sudeep.holla@arm.com>
On 03/18, Sudeep Holla wrote:
>
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -70,22 +70,16 @@ static long syscall_trace_enter(struct pt_regs *regs)
>
> struct thread_info *ti = current_thread_info();
> unsigned long ret = 0;
> - bool emulated = false;
> u32 work;
>
> if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
> BUG_ON(regs != task_pt_regs(current));
>
> - work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
> -
> - if (unlikely(work & _TIF_SYSCALL_EMU))
> - emulated = true;
> -
> - if ((emulated || (work & _TIF_SYSCALL_TRACE)) &&
> - tracehook_report_syscall_entry(regs))
> + if (unlikely(ptrace_syscall_enter(regs)))
> return -1L;
>
> - if (emulated)
> + work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
> + if ((work & _TIF_SYSCALL_TRACE) && tracehook_report_syscall_entry(regs))
> return -1L;
Well, I won't really argue, but to be honest I think this change doesn't make
the code better... With this patch tracehook_report_syscall_entry() has 2 callers,
to me this just adds some confusion.
I agree that the usage of emulated/_TIF_SYSCALL_EMU looks a bit overcomplicated,
I'd suggest a simple cleanup below.
And it seems that _TIF_WORK_SYSCALL_ENTRY needs some cleanups too... We don't need
"& _TIF_WORK_SYSCALL_ENTRY" in syscall_trace_enter, and _TIF_WORK_SYSCALL_ENTRY
should not include _TIF_NOHZ?
Oleg.
--- x/arch/x86/entry/common.c
+++ x/arch/x86/entry/common.c
@@ -70,23 +70,18 @@ static long syscall_trace_enter(struct pt_regs *regs)
struct thread_info *ti = current_thread_info();
unsigned long ret = 0;
- bool emulated = false;
u32 work;
if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
BUG_ON(regs != task_pt_regs(current));
- work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
+ work = READ_ONCE(ti->flags);
- if (unlikely(work & _TIF_SYSCALL_EMU))
- emulated = true;
-
- if ((emulated || (work & _TIF_SYSCALL_TRACE)) &&
- tracehook_report_syscall_entry(regs))
- return -1L;
-
- if (emulated)
- return -1L;
+ if (work & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
+ ret = tracehook_report_syscall_entry(regs);
+ if (ret || (work & _TIF_SYSCALL_EMU))
+ return -1L;
+ }
#ifdef CONFIG_SECCOMP
/*
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
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, Bin Lu <bin.lu@arm.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>,
Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook
Date: Mon, 18 Mar 2019 16:33:22 +0100 [thread overview]
Message-ID: <20190318153321.GA23521@redhat.com> (raw)
In-Reply-To: <20190318104925.16600-4-sudeep.holla@arm.com>
On 03/18, Sudeep Holla wrote:
>
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -70,22 +70,16 @@ static long syscall_trace_enter(struct pt_regs *regs)
>
> struct thread_info *ti = current_thread_info();
> unsigned long ret = 0;
> - bool emulated = false;
> u32 work;
>
> if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
> BUG_ON(regs != task_pt_regs(current));
>
> - work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
> -
> - if (unlikely(work & _TIF_SYSCALL_EMU))
> - emulated = true;
> -
> - if ((emulated || (work & _TIF_SYSCALL_TRACE)) &&
> - tracehook_report_syscall_entry(regs))
> + if (unlikely(ptrace_syscall_enter(regs)))
> return -1L;
>
> - if (emulated)
> + work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
> + if ((work & _TIF_SYSCALL_TRACE) && tracehook_report_syscall_entry(regs))
> return -1L;
Well, I won't really argue, but to be honest I think this change doesn't make
the code better... With this patch tracehook_report_syscall_entry() has 2 callers,
to me this just adds some confusion.
I agree that the usage of emulated/_TIF_SYSCALL_EMU looks a bit overcomplicated,
I'd suggest a simple cleanup below.
And it seems that _TIF_WORK_SYSCALL_ENTRY needs some cleanups too... We don't need
"& _TIF_WORK_SYSCALL_ENTRY" in syscall_trace_enter, and _TIF_WORK_SYSCALL_ENTRY
should not include _TIF_NOHZ?
Oleg.
--- x/arch/x86/entry/common.c
+++ x/arch/x86/entry/common.c
@@ -70,23 +70,18 @@ static long syscall_trace_enter(struct pt_regs *regs)
struct thread_info *ti = current_thread_info();
unsigned long ret = 0;
- bool emulated = false;
u32 work;
if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
BUG_ON(regs != task_pt_regs(current));
- work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
+ work = READ_ONCE(ti->flags);
- if (unlikely(work & _TIF_SYSCALL_EMU))
- emulated = true;
-
- if ((emulated || (work & _TIF_SYSCALL_TRACE)) &&
- tracehook_report_syscall_entry(regs))
- return -1L;
-
- if (emulated)
- return -1L;
+ if (work & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
+ ret = tracehook_report_syscall_entry(regs);
+ if (ret || (work & _TIF_SYSCALL_EMU))
+ return -1L;
+ }
#ifdef CONFIG_SECCOMP
/*
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Richard Weinberger <richard@nod.at>,
jdike@addtoit.com, Steve Capper <Steve.Capper@arm.com>,
Haibo Xu <haibo.xu@arm.com>, Bin Lu <bin.lu@arm.com>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH v2 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook
Date: Mon, 18 Mar 2019 16:33:22 +0100 [thread overview]
Message-ID: <20190318153321.GA23521@redhat.com> (raw)
In-Reply-To: <20190318104925.16600-4-sudeep.holla@arm.com>
On 03/18, Sudeep Holla wrote:
>
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -70,22 +70,16 @@ static long syscall_trace_enter(struct pt_regs *regs)
>
> struct thread_info *ti = current_thread_info();
> unsigned long ret = 0;
> - bool emulated = false;
> u32 work;
>
> if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
> BUG_ON(regs != task_pt_regs(current));
>
> - work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
> -
> - if (unlikely(work & _TIF_SYSCALL_EMU))
> - emulated = true;
> -
> - if ((emulated || (work & _TIF_SYSCALL_TRACE)) &&
> - tracehook_report_syscall_entry(regs))
> + if (unlikely(ptrace_syscall_enter(regs)))
> return -1L;
>
> - if (emulated)
> + work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
> + if ((work & _TIF_SYSCALL_TRACE) && tracehook_report_syscall_entry(regs))
> return -1L;
Well, I won't really argue, but to be honest I think this change doesn't make
the code better... With this patch tracehook_report_syscall_entry() has 2 callers,
to me this just adds some confusion.
I agree that the usage of emulated/_TIF_SYSCALL_EMU looks a bit overcomplicated,
I'd suggest a simple cleanup below.
And it seems that _TIF_WORK_SYSCALL_ENTRY needs some cleanups too... We don't need
"& _TIF_WORK_SYSCALL_ENTRY" in syscall_trace_enter, and _TIF_WORK_SYSCALL_ENTRY
should not include _TIF_NOHZ?
Oleg.
--- x/arch/x86/entry/common.c
+++ x/arch/x86/entry/common.c
@@ -70,23 +70,18 @@ static long syscall_trace_enter(struct pt_regs *regs)
struct thread_info *ti = current_thread_info();
unsigned long ret = 0;
- bool emulated = false;
u32 work;
if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
BUG_ON(regs != task_pt_regs(current));
- work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
+ work = READ_ONCE(ti->flags);
- if (unlikely(work & _TIF_SYSCALL_EMU))
- emulated = true;
-
- if ((emulated || (work & _TIF_SYSCALL_TRACE)) &&
- tracehook_report_syscall_entry(regs))
- return -1L;
-
- if (emulated)
- return -1L;
+ if (work & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
+ ret = tracehook_report_syscall_entry(regs);
+ if (ret || (work & _TIF_SYSCALL_EMU))
+ return -1L;
+ }
#ifdef CONFIG_SECCOMP
/*
next prev parent reply other threads:[~2019-03-18 15:35 UTC|newest]
Thread overview: 87+ 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 ` Sudeep Holla
2019-03-18 10:49 ` 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 10:49 ` Sudeep Holla
2019-03-18 10:49 ` Sudeep Holla
2019-03-18 17:29 ` Oleg Nesterov
2019-03-18 17:29 ` Oleg Nesterov
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 10:49 ` Sudeep Holla
2019-03-18 10:49 ` Sudeep Holla
2019-03-18 14:31 ` Dmitry V. Levin
2019-03-18 14:31 ` Dmitry V. Levin
2019-03-18 14:31 ` Dmitry V. Levin
2019-03-18 14:55 ` Sudeep Holla
2019-03-18 14:55 ` Sudeep Holla
2019-03-18 14:55 ` Sudeep Holla
2019-03-18 14:41 ` Dmitry V. Levin
2019-03-18 14:41 ` Dmitry V. Levin
2019-03-18 14:41 ` Dmitry V. Levin
2019-03-18 14:57 ` Sudeep Holla
2019-03-18 14:57 ` Sudeep Holla
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 10:49 ` Sudeep Holla
2019-03-18 10:49 ` Sudeep Holla
2019-03-18 15:33 ` Oleg Nesterov [this message]
2019-03-18 15:33 ` Oleg Nesterov
2019-03-18 15:33 ` Oleg Nesterov
2019-04-30 16:44 ` Sudeep Holla
2019-04-30 16:44 ` Sudeep Holla
2019-04-30 16:44 ` Sudeep Holla
2019-05-01 15:57 ` Oleg Nesterov
2019-05-01 15:57 ` Oleg Nesterov
2019-05-01 15:57 ` Oleg Nesterov
2019-05-01 16:51 ` Sudeep Holla
2019-05-01 16:51 ` Sudeep Holla
2019-05-01 16:51 ` Sudeep Holla
2019-04-30 16:46 ` Andy Lutomirski
2019-04-30 16:46 ` Andy Lutomirski
2019-04-30 16:46 ` Andy Lutomirski
2019-04-30 17:09 ` Sudeep Holla
2019-04-30 17:09 ` Sudeep Holla
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 10:49 ` Sudeep Holla
2019-03-18 10:49 ` Sudeep Holla
2019-03-18 14:26 ` Dmitry V. Levin
2019-03-18 14:26 ` Dmitry V. Levin
2019-03-18 14:26 ` Dmitry V. Levin
2019-03-18 14:59 ` Sudeep Holla
2019-03-18 14:59 ` Sudeep Holla
2019-03-18 14:59 ` Sudeep Holla
2019-03-18 17:20 ` Oleg Nesterov
2019-03-18 17:20 ` Oleg Nesterov
2019-03-18 17:20 ` Oleg Nesterov
2019-03-18 17:24 ` Sudeep Holla
2019-03-18 17:24 ` Sudeep Holla
2019-03-18 17:24 ` Sudeep Holla
2019-03-18 17:33 ` Oleg Nesterov
2019-03-18 17:33 ` Oleg Nesterov
2019-03-18 17:33 ` Oleg Nesterov
2019-03-18 17:40 ` Sudeep Holla
2019-03-18 17:40 ` Sudeep Holla
2019-03-18 17:40 ` Sudeep Holla
2019-03-19 17:08 ` Oleg Nesterov
2019-03-19 17:08 ` Oleg Nesterov
2019-03-19 17:08 ` Oleg Nesterov
2019-03-19 17:32 ` Oleg Nesterov
2019-03-19 17:32 ` Oleg Nesterov
2019-03-19 17:32 ` Oleg Nesterov
2019-04-03 16:50 ` Will Deacon
2019-04-03 16:50 ` Will Deacon
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 5/6] arm64: add PTRACE_SYSEMU{,SINGLESTEP} " Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 5/6] arm64: add PTRACE_SYSEMU{, SINGLESTEP} " Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 6/6] arm64: ptrace: add support for syscall emulation Sudeep Holla
2019-03-18 10:49 ` Sudeep Holla
2019-03-18 10:49 ` Sudeep Holla
2019-03-19 3:26 ` Haibo Xu (Arm Technology China)
2019-03-19 3:26 ` Haibo Xu (Arm Technology China)
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
2019-03-18 20:04 ` Andy Lutomirski
2019-03-18 20:04 ` 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=20190318153321.GA23521@redhat.com \
--to=oleg@redhat.com \
--cc=Steve.Capper@arm.com \
--cc=bin.lu@arm.com \
--cc=bp@alien8.de \
--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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.