diff mbox series

[v5,2/4] x86/entry: Simplify _TIF_SYSCALL_EMU handling

Message ID 20190611145627.23229-1-sudeep.holla@arm.com
State Accepted
Commit b07d7d5c7b421462dc91f0b775e31aae49804050
Headers show
Series None | expand

Commit Message

Sudeep Holla June 11, 2019, 2:56 p.m. UTC
The usage of emulated and _TIF_SYSCALL_EMU flags in syscall_trace_enter
is more complicated than required.

Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Acked-by: Oleg Nesterov <oleg@redhat.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

---
 arch/x86/entry/common.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

Hi Catalin,

I assume you can now pick up this patch.

Regards,
Sudeep

v4->v5: Updated changelog as suggested by tglx and added his Reviewed-by

--
2.17.1

Comments

Catalin Marinas June 24, 2019, 5:30 p.m. UTC | #1
On Tue, Jun 11, 2019 at 03:56:27PM +0100, Sudeep Holla wrote:
> The usage of emulated and _TIF_SYSCALL_EMU flags in syscall_trace_enter

> is more complicated than required.

> 

> Cc: Andy Lutomirski <luto@kernel.org>

> Cc: Ingo Molnar <mingo@redhat.com>

> Cc: Borislav Petkov <bp@alien8.de>

> Acked-by: Oleg Nesterov <oleg@redhat.com>

> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> ---

>  arch/x86/entry/common.c | 17 ++++++-----------

>  1 file changed, 6 insertions(+), 11 deletions(-)

> 

> Hi Catalin,

> 

> I assume you can now pick up this patch.


I can, unless Thomas picks it up through the tip tree (there is no
dependency on the other patches in this series, which I already queued
via arm64).

-- 
Catalin
Thomas Gleixner June 24, 2019, 5:37 p.m. UTC | #2
On Mon, 24 Jun 2019, Catalin Marinas wrote:
> On Tue, Jun 11, 2019 at 03:56:27PM +0100, Sudeep Holla wrote:

> > The usage of emulated and _TIF_SYSCALL_EMU flags in syscall_trace_enter

> > is more complicated than required.

> > 

> > Cc: Andy Lutomirski <luto@kernel.org>

> > Cc: Ingo Molnar <mingo@redhat.com>

> > Cc: Borislav Petkov <bp@alien8.de>

> > Acked-by: Oleg Nesterov <oleg@redhat.com>

> > Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> > ---

> >  arch/x86/entry/common.c | 17 ++++++-----------

> >  1 file changed, 6 insertions(+), 11 deletions(-)

> > 

> > Hi Catalin,

> > 

> > I assume you can now pick up this patch.

> 

> I can, unless Thomas picks it up through the tip tree (there is no

> dependency on the other patches in this series, which I already queued

> via arm64).


Last time I checked I had no dependencies either. I'll recheck later
tonight.

Thanks,

	tglx
Thomas Gleixner June 26, 2019, 6:45 p.m. UTC | #3
On Mon, 24 Jun 2019, Thomas Gleixner wrote:
> On Mon, 24 Jun 2019, Catalin Marinas wrote:

> > On Tue, Jun 11, 2019 at 03:56:27PM +0100, Sudeep Holla wrote:

> > > The usage of emulated and _TIF_SYSCALL_EMU flags in syscall_trace_enter

> > > is more complicated than required.

> > > 

> > > Cc: Andy Lutomirski <luto@kernel.org>

> > > Cc: Ingo Molnar <mingo@redhat.com>

> > > Cc: Borislav Petkov <bp@alien8.de>

> > > Acked-by: Oleg Nesterov <oleg@redhat.com>

> > > Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> > > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> > > ---

> > >  arch/x86/entry/common.c | 17 ++++++-----------

> > >  1 file changed, 6 insertions(+), 11 deletions(-)

> > > 

> > > Hi Catalin,

> > > 

> > > I assume you can now pick up this patch.

> > 

> > I can, unless Thomas picks it up through the tip tree (there is no

> > dependency on the other patches in this series, which I already queued

> > via arm64).

> 

> Last time I checked I had no dependencies either. I'll recheck later

> tonight.


Forgot of course. But go ahead and route it with the others.

Thanks,

	tglx
diff mbox series

Patch

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index a986b3c8294c..0a61705d62ec 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -72,23 +72,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_TRACE | _TIF_SYSCALL_EMU)) {
+		ret = tracehook_report_syscall_entry(regs);
+		if (ret || (work & _TIF_SYSCALL_EMU))
+			return -1L;
+	}

 #ifdef CONFIG_SECCOMP
 	/*