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] [day] [month] [year] [list]
Message-Id: <1190680460.12382.11.camel@localhost.localdomain>
Date:	Tue, 25 Sep 2007 10:34:20 +1000
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	Roland McGrath <roland@...hat.com>
Cc:	Paul Mackerras <paulus@...ba.org>, linuxppc-dev@...abs.org,
	David Woodhouse <dwmw2@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] powerpc: FULL_REGS on exec


On Mon, 2007-09-24 at 16:52 -0700, Roland McGrath wrote:
> When PTRACE_O_TRACEEXEC is used, a ptrace call to fetch the registers at
> the PTRACE_EVENT_EXEC stop (PTRACE_PEEKUSR) will oops in CHECK_FULL_REGS.
> With recent versions, "gdb --args /bin/sh -c 'exec /bin/true'" and "run" at
> the (gdb) prompt is sufficient to produce this.  I also have written an
> isolated test case, see https://bugzilla.redhat.com/show_bug.cgi?id=301791#c15.
> 
> This change fixes the problem by clearing the low bit of pt_regs.trap in
> start_thread so that FULL_REGS is true again.  This is correct since all of
> the GPRs that "full" refers to are cleared in start_thread.

Looks good, nice catch.

> Signed-off-by: Roland McGrath <roland@...hat.com>

Signed-off-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>

> ---
>  arch/powerpc/kernel/process.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index e477c9d..fd799d2 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -605,6 +605,13 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
>  	regs->ccr = 0;
>  	regs->gpr[1] = sp;
>  
> +	/*
> +	 * We have just cleared all the nonvolatile GPRs, so make
> +	 * FULL_REGS(regs) return true.  This is necessary to allow
> +	 * ptrace to examine the thread immediately after exec.
> +	 */
> +	regs->trap &= ~1UL;
> +
>  #ifdef CONFIG_PPC32
>  	regs->mq = 0;
>  	regs->nip = start;
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@...abs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ