diff options
author | Breno Leitao <leitao@debian.org> | 2018-10-31 17:38:20 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-11-25 09:11:21 +0300 |
commit | 5249497a7bb6334fcc128588d6a7e1e21786515a (patch) | |
tree | 04e8d1ab64c3680fa060eb3d03cd11eac4f661dd /tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c | |
parent | bce85a167b336da80642952b222588c25c8613d7 (diff) | |
download | linux-5249497a7bb6334fcc128588d6a7e1e21786515a.tar.xz |
selftests/powerpc: Allocate base registers
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(1) /* will load into r2 the content of r1 address */
ld r2, 0(0) /* will load into r2 the content of 0x0 */
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 allocated.
Other than that, this patch removes inline assembly operands that are not
used by the tests.
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c')
-rw-r--r-- | tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c index 51427a2465f6..ba04999254e3 100644 --- a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c +++ b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c @@ -74,7 +74,7 @@ trans: "3: ;" : [tfhar] "=r" (tfhar), [res] "=r" (result), - [texasr] "=r" (texasr), [cptr1] "=r" (cptr1) + [texasr] "=r" (texasr), [cptr1] "=b" (cptr1) : [sprn_texasr] "i" (SPRN_TEXASR) : "memory", "r0", "r8", "r31" ); |