linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Breno Leitao <leitao@debian.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] selftests/powerpc: Allocate base registers
Date: Tue, 23 Oct 2018 16:39:18 -0500	[thread overview]
Message-ID: <20181023213917.GS5205@gate.crashing.org> (raw)
In-Reply-To: <1540326197-15537-1-git-send-email-leitao@debian.org>

On Tue, Oct 23, 2018 at 05:23:16PM -0300, Breno Leitao wrote:
> Some ptrace selftests are passing input operands using a constraint that
> can allocate any register for the operand, and using these registers on
> load/store operations.
> 
> If the register allocated by the compiler happens to be zero (r0), it might
> cause an invalid memory address access, since load and store operations
> consider the content of 0x0 address if the base register is r0, instead
> of the content of the r0 register. For example:
> 
> 	r1 := 0xdeadbeef
> 	r0 := 0xdeadbeef
> 	
> 	ld r2, 0(r1) /* will load into r2 the content of r1 address */
> 	ld r2, 0(r0) /* will load into r2 the context of 0x0 */

That isn't valid syntax: you have to write
	ld r2, 0(0)

(s/context/content/ btw)

> In order to avoid this possible problem, the inline assembly constraint
> should be aware that these registers will be used as a base register, thus,
> r0 should not be alocated.

(allocated)

The patch looks fine :-)

Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>


Segher

      parent reply	other threads:[~2018-10-23 21:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 20:23 [PATCH 1/2] selftests/powerpc: Allocate base registers Breno Leitao
2018-10-23 20:23 ` [PATCH 2/2] selftests/powerpc: Skip test instead of failing Breno Leitao
2018-10-23 20:41   ` Tyrel Datwyler
2018-10-24 14:11     ` Breno Leitao
2018-10-29 22:08       ` Thiago Jung Bauermann
2018-10-30 15:16         ` Michael Ellerman
2018-10-31  0:09           ` Tyrel Datwyler
2018-10-31  9:42             ` Michael Ellerman
2018-10-31  9:41     ` Michael Ellerman
2018-10-23 21:39 ` Segher Boessenkool [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181023213917.GS5205@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=leitao@debian.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).