Message ID | 20190430170520.29470-3-sudeep.holla@arm.com |
---|---|
State | Superseded |
Headers | show |
Series | ptrace: cleanup PTRACE_SYSEMU handling and add support for arm64 | expand |
On 04/30, Sudeep Holla wrote: > > The usage of emulated/_TIF_SYSCALL_EMU flags in syscall_trace_enter > seems to be bit overcomplicated than required. Let's simplify it. > > Cc: Andy Lutomirski <luto@kernel.org> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Borislav Petkov <bp@alien8.de> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 7bc105f47d21..c647ddfd5579 100644 --- a/arch/x86/entry/common.c +++ b/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_TRACE | _TIF_SYSCALL_EMU)) { + ret = tracehook_report_syscall_entry(regs); + if (ret || (work & _TIF_SYSCALL_EMU)) + return -1L; + } #ifdef CONFIG_SECCOMP /*
The usage of emulated/_TIF_SYSCALL_EMU flags in syscall_trace_enter seems to be bit overcomplicated than required. Let's simplify it. Cc: Andy Lutomirski <luto@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> --- arch/x86/entry/common.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) -- 2.17.1