[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb9ef619-4af8-71e1-5aee-0b6294ac488b@arm.com>
Date: Mon, 4 Mar 2019 08:25:28 +0000
From: "Haibo Xu (Arm Technology China)" <Haibo.Xu@....com>
To: Sudeep Holla <Sudeep.Holla@....com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
CC: Catalin Marinas <Catalin.Marinas@....com>,
Will Deacon <Will.Deacon@....com>,
Oleg Nesterov <oleg@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Richard Weinberger <richard@....at>,
"jdike@...toit.com" <jdike@...toit.com>,
Steve Capper <Steve.Capper@....com>,
"Bin Lu (Arm Technology China)" <Bin.Lu@....com>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH 3/6] x86: clean up _TIF_SYSCALL_EMU handling using
ptrace_syscall_enter hook
On 2019/3/1 2:32, Sudeep Holla wrote:
> Now that we have a new hook ptrace_syscall_enter that can be called from
> syscall entry code and it handles PTRACE_SYSEMU in generic code, we
> can do some cleanup using the same in syscall_trace_enter.
>
> Further the extra logic to find single stepping PTRACE_SYSEMU_SINGLESTEP
> in syscall_slow_exit_work seems unnecessary. Let's remove the same.
I think we should not change the logic here. Is so, it will double the report of syscall
when PTRACE_SYSEMU_SINGLESTEP is enabled.
>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>
> ---
> arch/x86/entry/common.c | 22 ++++------------------
> 1 file changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> index 7bc105f47d21..36457c1f87d2 100644
> --- 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;
>
> #ifdef CONFIG_SECCOMP
> @@ -227,15 +221,7 @@ static void syscall_slow_exit_work(struct pt_regs *regs, u32 cached_flags)
> if (cached_flags & _TIF_SYSCALL_TRACEPOINT)
> trace_sys_exit(regs, regs->ax);
>
> -/*
> - * If TIF_SYSCALL_EMU is set, we only get here because of
> - * TIF_SINGLESTEP (i.e. this is PTRACE_SYSEMU_SINGLESTEP).
> - * We already reported this syscall instruction in
> - * syscall_trace_enter().
> - */
> -step = unlikely(
> -(cached_flags & (_TIF_SINGLESTEP | _TIF_SYSCALL_EMU))
> -== _TIF_SINGLESTEP);
> +step = unlikely((cached_flags & _TIF_SINGLESTEP));
> if (step || cached_flags & _TIF_SYSCALL_TRACE)
> tracehook_report_syscall_exit(regs, step);
> }
>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Powered by blists - more mailing lists