x86/entry: Simplify _TIF_SYSCALL_EMU handling
authorSudeep Holla <sudeep.holla@arm.com>
Tue, 11 Jun 2019 14:56:27 +0000 (15:56 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 27 Jun 2019 09:14:06 +0000 (10:14 +0100)
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>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/x86/entry/common.c

index a986b3c8294c8df7ee0157b27b665cfc4e05d894..0a61705d62ec37b2fb03426caef26ba4a063d182 100644 (file)
@@ -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
        /*