diff options
author | Lynn Boger <laboger@linux.vnet.ibm.com> | 2017-04-12 14:22:16 -0400 |
---|---|---|
committer | Lynn Boger <laboger@linux.vnet.ibm.com> | 2017-04-17 21:24:35 +0000 |
commit | 7d4cca07d2c6890fb39635aaa5b3b8d902bf2cbf (patch) | |
tree | 5df4eabafd7d8311530f9bb4658111a17c351348 /src/runtime/sys_linux_ppc64x.s | |
parent | 16db1892d32bffdcc636665ba0325142b3c7ad72 (diff) | |
download | go-7d4cca07d2c6890fb39635aaa5b3b8d902bf2cbf.tar.gz go-7d4cca07d2c6890fb39635aaa5b3b8d902bf2cbf.zip |
cmd/asm: detect invalid DS form offsets for ppc64x
While debugging a recent regression it was discovered that
the assembler for ppc64x was not always generating the correct
instruction for DS form loads and stores. When an instruction
is DS form then the offset must be a multiple of 4, and if it
isn't then bits outside the offset field were being incorrectly
set resulting in unexpected and incorrect instructions.
This change adds a check to determine when the opcode is DS form
and then verifies that the offset is a multiple of 4 before
generating the instruction, otherwise logs an error.
This also changes a few asm files that were using unaligned offsets
for DS form loads and stores. In the runtime package these were
instructions intended to cause a crash so using aligned or unaligned
offsets doesn't change that behavior.
Change-Id: Ie3a7e1e65dcc9933b54de7a46a054da8459cb56f
Reviewed-on: https://go-review.googlesource.com/40476
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Diffstat (limited to 'src/runtime/sys_linux_ppc64x.s')
-rw-r--r-- | src/runtime/sys_linux_ppc64x.s | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index b43bda1ef2..ef7dab21b7 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -189,7 +189,7 @@ TEXT runtime·rtsigprocmask(SB),NOSPLIT|NOFRAME,$0-28 MOVW size+24(FP), R6 SYSCALL $SYS_rt_sigprocmask BVC 2(PC) - MOVD R0, 0xf1(R0) // crash + MOVD R0, 0xf0(R0) // crash RET TEXT runtime·rt_sigaction(SB),NOSPLIT|NOFRAME,$0-36 @@ -273,7 +273,7 @@ TEXT runtime·munmap(SB),NOSPLIT|NOFRAME,$0 MOVD n+8(FP), R4 SYSCALL $SYS_munmap BVC 2(PC) - MOVD R0, 0xf3(R0) + MOVD R0, 0xf0(R0) RET TEXT runtime·madvise(SB),NOSPLIT|NOFRAME,$0 @@ -366,7 +366,7 @@ TEXT runtime·sigaltstack(SB),NOSPLIT|NOFRAME,$0 MOVD old+8(FP), R4 SYSCALL $SYS_sigaltstack BVC 2(PC) - MOVD R0, 0xf1(R0) // crash + MOVD R0, 0xf0(R0) // crash RET TEXT runtime·osyield(SB),NOSPLIT|NOFRAME,$0 |