diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2022-06-27 17:02:27 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-07-25 05:05:15 +0300 |
commit | fd19a1f72aa7bf687609e0810e644fe5b3846342 (patch) | |
tree | f774997258a395fc1b22f93afcb9de482b7dcd49 /tools/testing | |
parent | 2b461880c20777d317b4ad24ef040918860133ca (diff) | |
download | linux-fd19a1f72aa7bf687609e0810e644fe5b3846342.tar.xz |
selftests/powerpc: Ensure 16-byte stack pointer alignment
The PUSH/POP_BASIC_STACK helpers in basic_asm.h do not ensure that the
stack pointer is always 16-byte aligned, which is required per the ABI.
Fix the macros to do the alignment if the caller fails to.
Currently only one caller passes a non-aligned size, tm_signal_self(),
which hasn't been caught in testing, presumably because it's a leaf
function.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220627140239.2464900-1-mpe@ellerman.id.au
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/powerpc/include/basic_asm.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/powerpc/include/basic_asm.h b/tools/testing/selftests/powerpc/include/basic_asm.h index 886dc026fe7a..807e83e821ec 100644 --- a/tools/testing/selftests/powerpc/include/basic_asm.h +++ b/tools/testing/selftests/powerpc/include/basic_asm.h @@ -58,7 +58,7 @@ #define PUSH_BASIC_STACK(_extra) \ mflr r0; \ std r0, STACK_FRAME_LR_POS(%r1); \ - stdu %r1, -(_extra + STACK_FRAME_MIN_SIZE)(%r1); \ + stdu %r1, -(((_extra + 15) & ~15) + STACK_FRAME_MIN_SIZE)(%r1); \ mfcr r0; \ stw r0, STACK_FRAME_CR_POS(%r1); \ std %r2, STACK_FRAME_TOC_POS(%r1); @@ -67,7 +67,7 @@ ld %r2, STACK_FRAME_TOC_POS(%r1); \ lwz r0, STACK_FRAME_CR_POS(%r1); \ mtcr r0; \ - addi %r1, %r1, (_extra + STACK_FRAME_MIN_SIZE); \ + addi %r1, %r1, (((_extra + 15) & ~15) + STACK_FRAME_MIN_SIZE); \ ld r0, STACK_FRAME_LR_POS(%r1); \ mtlr r0; |