From: Sudeep Holla Date: Tue, 11 Jun 2019 14:56:27 +0000 (+0100) Subject: x86/entry: Simplify _TIF_SYSCALL_EMU handling X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b07d7d5c7b421462dc91f0b775e31aae49804050;p=openwrt%2Fstaging%2Fblogic.git x86/entry: Simplify _TIF_SYSCALL_EMU handling The usage of emulated and _TIF_SYSCALL_EMU flags in syscall_trace_enter is more complicated than required. Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Borislav Petkov Acked-by: Oleg Nesterov Reviewed-by: Thomas Gleixner Signed-off-by: Sudeep Holla Signed-off-by: Catalin Marinas --- 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 /*