Re: [PATCH v4 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC64

From
Jason A. Donenfeld <Jason@zx2c4.com>
Date
2024-09-02 14:00:32
Also in
linux-fsdevel, linux-kselftest, linux-mm, linuxppc-dev, lkml, llvm
Reply to
Christophe Leroy, 2024-09-02
On Mon, Sep 02, 2024 at 03:12:47PM +0200, Christophe Leroy wrote:

Le 02/09/2024 à 14:41, Jason A. Donenfeld a écrit :
quoted
On Mon, Sep 02, 2024 at 02:04:42PM +0200, Christophe Leroy wrote:
quoted
  SYM_FUNC_START(__arch_chacha20_blocks_nostack)
  #ifdef __powerpc64__
-	blr
+	std	r5, -216(r1)
+
+	std	r14, -144(r1)
+	std	r15, -136(r1)
+	std	r16, -128(r1)
+	std	r17, -120(r1)
+	std	r18, -112(r1)
+	std	r19, -104(r1)
+	std	r20, -96(r1)
+	std	r21, -88(r1)
+	std	r22, -80(r1)
+	std	r23, -72(r1)
+	std	r24, -64(r1)
+	std	r25, -56(r1)
+	std	r26, -48(r1)
+	std	r27, -40(r1)
+	std	r28, -32(r1)
+	std	r29, -24(r1)
+	std	r30, -16(r1)
+	std	r31, -8(r1)
  #else
  	stwu	r1, -96(r1)
  	stw	r5, 20(r1)
+#ifdef __BIG_ENDIAN__
  	stmw	r14, 24(r1)
+#else
+	stw	r14, 24(r1)
+	stw	r15, 28(r1)
+	stw	r16, 32(r1)
+	stw	r17, 36(r1)
+	stw	r18, 40(r1)
+	stw	r19, 44(r1)
+	stw	r20, 48(r1)
+	stw	r21, 52(r1)
+	stw	r22, 56(r1)
+	stw	r23, 60(r1)
+	stw	r24, 64(r1)
+	stw	r25, 68(r1)
+	stw	r26, 72(r1)
+	stw	r27, 76(r1)
+	stw	r28, 80(r1)
+	stw	r29, 84(r1)
+	stw	r30, 88(r1)
+	stw	r31, 92(r1)
+#endif
+#endif
This confuses me. Why are you adding code to the !__powerpc64__ branch
in this commit? (Also, why does stmw not work on LE?)
That's for the VDSO32 ie running 32 bits binaries on a 64 bits kernel.

"Programming Environments Manual for 32-Bit Implementations of the 
PowerPC™ Architecture" say: In some implementations operating with 
little-endian byte order, execution of an lmw or stmw instruction
causes the system alignment error handler to be invoked

And GCC doesn't like it either:

tools/arch/powerpc/vdso/vgetrandom-chacha.S:84: Error: `stmw' invalid 
when little-endian
Does it make sense to do all the 32-bit stuff in the PPC32 commit (and
then you can introduce the selftests there without the error you
mentioned), and then add the 64-bit stuff in this commit?
Thread (15 messages) 15 messages, 2 authors, last reply 2024-09-02
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help