lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 4 Mar 2019 09:36:27 +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>
Subject: Re: [PATCH 4/6] powerpc: use common ptrace_syscall_enter hook to
 handle _TIF_SYSCALL_EMU

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 do_syscall_trace_enter.
>
> Cc: Oleg Nesterov <oleg@...hat.com>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>
> ---
>  arch/powerpc/kernel/ptrace.c | 50 ++++++++++++++++--------------------
>  1 file changed, 22 insertions(+), 28 deletions(-)
>
> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> index cb7e1439cafb..978cd2aac29e 100644
> --- a/arch/powerpc/kernel/ptrace.c
> +++ b/arch/powerpc/kernel/ptrace.c
> @@ -3264,37 +3264,31 @@ long do_syscall_trace_enter(struct pt_regs *regs)
>  {
>  u32 flags;
>
> -user_exit();

We'd better keep the user_exit() at here in case both context tracking and SYSCALL_EMU
are enabled.

> -
> -flags = READ_ONCE(current_thread_info()->flags) &
> -(_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE);
> +if (unlikely(ptrace_syscall_enter(regs))) {
> +/*
> + * A nonzero return code from tracehook_report_syscall_entry()
> + * tells us to prevent the syscall execution, but we are not
> + * going to execute it anyway.
> + *
> + * Returning -1 will skip the syscall execution. We want to
> + * avoid clobbering any registers, so we don't goto the skip
> + * label below.
> + */
> +return -1;
> +}
>
> -if (flags) {
> -int rc = tracehook_report_syscall_entry(regs);
> +user_exit();
>
> -if (unlikely(flags & _TIF_SYSCALL_EMU)) {
> -/*
> - * A nonzero return code from
> - * tracehook_report_syscall_entry() tells us to prevent
> - * the syscall execution, but we are not going to
> - * execute it anyway.
> - *
> - * Returning -1 will skip the syscall execution. We want
> - * to avoid clobbering any registers, so we don't goto
> - * the skip label below.
> - */
> -return -1;
> -}
> +flags = READ_ONCE(current_thread_info()->flags) & _TIF_SYSCALL_TRACE;
>
> -if (rc) {
> -/*
> - * The tracer decided to abort the syscall. Note that
> - * the tracer may also just change regs->gpr[0] to an
> - * invalid syscall number, that is handled below on the
> - * exit path.
> - */
> -goto skip;
> -}
> +if (flags && tracehook_report_syscall_entry(regs)) {
> +/*
> + * The tracer decided to abort the syscall. Note that
> + * the tracer may also just change regs->gpr[0] to an
> + * invalid syscall number, that is handled below on the
> + * exit path.
> + */
> +goto skip;
>  }
>
>  /* Run seccomp after ptrace; allow it to set gpr[3]. */
>
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ