Re: [PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Christophe Leroy
Le 30/08/2024 à 18:17, Jason A. Donenfeld a écrit : On Fri, Aug 30, 2024 at 05:57:08PM +0200, Christophe Leroy wrote: @@ -14,6 +14,10 @@ ifeq ($(uname_M),x86_64) TEST_GEN_PROGS += vdso_test_getrandom TEST_GEN_PROGS += vdso_test_chacha endif +ifeq ($(ARCH),powerpc) +TEST_GEN_PROGS += vds

Re: [PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Christophe Leroy
Le 30/08/2024 à 18:42, Christophe Leroy a écrit : Le 30/08/2024 à 18:14, Jason A. Donenfeld a écrit : On Fri, Aug 30, 2024 at 05:57:08PM +0200, Christophe Leroy wrote: + *    r5: 8-byte counter input/output (saved on stack) + * + *    r14-r15: counter + */ +SYM_FUNC_START(__arch_chacha20_b

Re: [PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Christophe Leroy
Le 30/08/2024 à 18:14, Jason A. Donenfeld a écrit : On Fri, Aug 30, 2024 at 05:57:08PM +0200, Christophe Leroy wrote: + * r5: 8-byte counter input/output (saved on stack) + * + * r14-r15: counter + */ +SYM_FUNC_START(__arch_chacha20_blocks_nostack) + stwur1, -96(r1) +

Re: [PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Jason A. Donenfeld
On Fri, Aug 30, 2024 at 05:57:08PM +0200, Christophe Leroy wrote: > @@ -14,6 +14,10 @@ ifeq ($(uname_M),x86_64) > TEST_GEN_PROGS += vdso_test_getrandom > TEST_GEN_PROGS += vdso_test_chacha > endif > +ifeq ($(ARCH),powerpc) > +TEST_GEN_PROGS += vdso_test_getrandom > +TEST_GEN_PROGS += vdso_test_c

Re: [PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Jason A. Donenfeld
On Fri, Aug 30, 2024 at 05:57:08PM +0200, Christophe Leroy wrote: > + * r5: 8-byte counter input/output (saved on stack) > + * > + * r14-r15: counter > + */ > +SYM_FUNC_START(__arch_chacha20_blocks_nostack) > + stwur1, -96(r1) > + stw r5, 20(r1) > + stmwr14, 24(r1) > +

[PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Christophe Leroy
To be consistent with other VDSO functions, the function is called __kernel_getrandom() __arch_chacha20_blocks_nostack() fonction is implemented basically with 32 bits operations. It performs 4 QUARTERROUND operations in parallele. There are enough registers to avoid using the stack: On input: