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 <seg...@kernel.crashing.org>


Segher

Reply via email to