Re: [PATCH 01/13] selftests/powerpc: Ensure 16-byte stack pointer alignment

2022-07-29 Thread Michael Ellerman
On Tue, 28 Jun 2022 00:02:27 +1000, Michael Ellerman wrote:
> 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.
> 
> [...]

Applied to powerpc/next.

[01/13] selftests/powerpc: Ensure 16-byte stack pointer alignment

https://git.kernel.org/powerpc/c/fd19a1f72aa7bf687609e0810e644fe5b3846342
[02/13] selftests/powerpc/ptrace: Set LOCAL_HDRS

https://git.kernel.org/powerpc/c/cf4baafd7846b3def67057a09b7603a6b566417a
[03/13] selftests/powerpc/ptrace: Split CFLAGS better

https://git.kernel.org/powerpc/c/3c20a1d07c377d7260ca853e216cc85bbd7857fa
[04/13] selftests/powerpc: Don't save CR by default in asm helpers

https://git.kernel.org/powerpc/c/8f2e02394dc907f5e0140bfab80a9aa11e3449ed
[05/13] selftests/powerpc: Don't save TOC by default in asm helpers

https://git.kernel.org/powerpc/c/cfbc0723d18f5aeab4308c66d7d1992317eed7c9
[06/13] selftests/powerpc: Add 32-bit support to asm helpers

https://git.kernel.org/powerpc/c/bd4d3042e7570fc024b5ff15e895363e4bf5a78f
[07/13] selftests/powerpc/ptrace: Drop unused load_fpr_single_precision()

https://git.kernel.org/powerpc/c/af9f3f31f6cc8e3f637f19189e83d99f3fdd96ad
[08/13] selftests/powerpc/ptrace: Convert to load/store doubles

https://git.kernel.org/powerpc/c/53fa86e7ece54cbb1fae1443bd6b348088d8ce7e
[09/13] selftests/powerpc/ptrace: Build the ptrace-gpr test as 32-bit when 
possible

https://git.kernel.org/powerpc/c/149a497d5fda3e996a00437260a4c170e43909c8
[10/13] selftests/powerpc/ptrace: Do more of ptrace-gpr in asm

https://git.kernel.org/powerpc/c/611e385087efc2cc3a7033aedd3f84ad0cf2a703
[11/13] selftests/powerpc/ptrace: Make child errors more obvious

https://git.kernel.org/powerpc/c/7b1513d02edf4a6334618070641f47abbbef0cef
[12/13] selftests/powerpc/ptrace: Use more interesting values

https://git.kernel.org/powerpc/c/c5a814cc992002c36fa5b7db5fbd55efb7430386
[13/13] selftests/powerpc/ptrace: Add peek/poke of FPRs

https://git.kernel.org/powerpc/c/6c9c7d8fbc3a2a0cfed0e7a5b39581847b632f0b

cheers


[PATCH 01/13] selftests/powerpc: Ensure 16-byte stack pointer alignment

2022-06-27 Thread Michael Ellerman
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 
---
 tools/testing/selftests/powerpc/include/basic_asm.h | 4 ++--
 1 file 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) \
mflrr0; \
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); \
mfcrr0; \
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); \
mtcrr0; \
-   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); \
mtlrr0;
 
-- 
2.35.3