Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

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:
r3: output bytes
r4: 32-byte key input
r5: 8-byte counter input/output
r6: number of 64-byte blocks to write to output

During operation:
stack: pointer to counter (r5) and non-volatile registers (r14-131)
r0: counter of blocks (initialised with r6)
r4: Value '4' after key has been read, used for indexing
r5-r12: key
r14-r15: block counter
r16-r31: chacha state

At the end:
r0, r6-r12: Zeroised
r5, r14-r31: Restored

Performance on powerpc 885 (using kernel selftest):
~# ./vdso_test_getrandom bench-single
vdso: 25000000 times in 62.938002291 seconds
libc: 25000000 times in 535.581916866 seconds
syscall: 25000000 times in 531.525042806 seconds

Performance on powerpc 8321 (using kernel selftest):
~# ./vdso_test_getrandom bench-single
vdso: 25000000 times in 16.899318858 seconds
libc: 25000000 times in 131.050596522 seconds
syscall: 25000000 times in 129.794790389 seconds

This first patch adds support for VDSO32. As selftests cannot easily
be generated only for VDSO32, and because the following patch brings
support for VDSO64 anyway, this patch opts out all code in
__arch_chacha20_blocks_nostack() so that vdso_test_chacha will not
fail to compile and will not crash on PPC64/PPC64LE, allthough the
selftest itself will fail.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

authored by

Christophe Leroy and committed by
Jason A. Donenfeld
53cee505 a6b67eb0

+454 -5
+1
arch/powerpc/Kconfig
··· 311 311 select SYSCTL_EXCEPTION_TRACE 312 312 select THREAD_INFO_IN_TASK 313 313 select TRACE_IRQFLAGS_SUPPORT 314 + select VDSO_GETRANDOM if VDSO32 314 315 # 315 316 # Please keep this list sorted alphabetically. 316 317 #
+1 -1
arch/powerpc/include/asm/mman.h
··· 6 6 7 7 #include <uapi/asm/mman.h> 8 8 9 - #ifdef CONFIG_PPC64 9 + #if defined(CONFIG_PPC64) && !defined(BUILD_VDSO) 10 10 11 11 #include <asm/cputable.h> 12 12 #include <linux/mm.h>
+54
arch/powerpc/include/asm/vdso/getrandom.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2024 Christophe Leroy <christophe.leroy@csgroup.eu>, CS GROUP France 4 + */ 5 + #ifndef _ASM_POWERPC_VDSO_GETRANDOM_H 6 + #define _ASM_POWERPC_VDSO_GETRANDOM_H 7 + 8 + #ifndef __ASSEMBLY__ 9 + 10 + static __always_inline int do_syscall_3(const unsigned long _r0, const unsigned long _r3, 11 + const unsigned long _r4, const unsigned long _r5) 12 + { 13 + register long r0 asm("r0") = _r0; 14 + register unsigned long r3 asm("r3") = _r3; 15 + register unsigned long r4 asm("r4") = _r4; 16 + register unsigned long r5 asm("r5") = _r5; 17 + register int ret asm ("r3"); 18 + 19 + asm volatile( 20 + " sc\n" 21 + " bns+ 1f\n" 22 + " neg %0, %0\n" 23 + "1:\n" 24 + : "=r" (ret), "+r" (r4), "+r" (r5), "+r" (r0) 25 + : "r" (r3) 26 + : "memory", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "cr0", "ctr"); 27 + 28 + return ret; 29 + } 30 + 31 + /** 32 + * getrandom_syscall - Invoke the getrandom() syscall. 33 + * @buffer: Destination buffer to fill with random bytes. 34 + * @len: Size of @buffer in bytes. 35 + * @flags: Zero or more GRND_* flags. 36 + * Returns: The number of bytes written to @buffer, or a negative value indicating an error. 37 + */ 38 + static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsigned int flags) 39 + { 40 + return do_syscall_3(__NR_getrandom, (unsigned long)buffer, 41 + (unsigned long)len, (unsigned long)flags); 42 + } 43 + 44 + static __always_inline struct vdso_rng_data *__arch_get_vdso_rng_data(void) 45 + { 46 + return NULL; 47 + } 48 + 49 + ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, 50 + size_t opaque_len, const struct vdso_rng_data *vd); 51 + 52 + #endif /* !__ASSEMBLY__ */ 53 + 54 + #endif /* _ASM_POWERPC_VDSO_GETRANDOM_H */
+6
arch/powerpc/include/asm/vdso/vsyscall.h
··· 17 17 } 18 18 #define __arch_get_k_vdso_data __arch_get_k_vdso_data 19 19 20 + static __always_inline 21 + struct vdso_rng_data *__arch_get_k_vdso_rng_data(void) 22 + { 23 + return &vdso_data->rng_data; 24 + } 25 + 20 26 /* The asm-generic header needs to be included after the definitions above */ 21 27 #include <asm-generic/vdso/vsyscall.h> 22 28
+2
arch/powerpc/include/asm/vdso_datapage.h
··· 83 83 __u32 compat_syscall_map[SYSCALL_MAP_SIZE]; /* Map of compat syscalls */ 84 84 85 85 struct vdso_data data[CS_BASES]; 86 + struct vdso_rng_data rng_data; 86 87 }; 87 88 88 89 #else /* CONFIG_PPC64 */ ··· 96 95 __u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */ 97 96 __u32 compat_syscall_map[0]; /* No compat syscalls on PPC32 */ 98 97 struct vdso_data data[CS_BASES]; 98 + struct vdso_rng_data rng_data; 99 99 }; 100 100 101 101 #endif /* CONFIG_PPC64 */
+1
arch/powerpc/kernel/asm-offsets.c
··· 335 335 336 336 /* datapage offsets for use by vdso */ 337 337 OFFSET(VDSO_DATA_OFFSET, vdso_arch_data, data); 338 + OFFSET(VDSO_RNG_DATA_OFFSET, vdso_arch_data, rng_data); 338 339 OFFSET(CFG_TB_TICKS_PER_SEC, vdso_arch_data, tb_ticks_per_sec); 339 340 #ifdef CONFIG_PPC64 340 341 OFFSET(CFG_ICACHE_BLOCKSZ, vdso_arch_data, icache_block_size);
+11 -3
arch/powerpc/kernel/vdso/Makefile
··· 8 8 obj-vdso32 = sigtramp32-32.o gettimeofday-32.o datapage-32.o cacheflush-32.o note-32.o getcpu-32.o 9 9 obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o note-64.o getcpu-64.o 10 10 11 + obj-vdso32 += getrandom-32.o vgetrandom-chacha-32.o 12 + 11 13 ifneq ($(c-gettimeofday-y),) 12 14 CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y) 13 15 # Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true ··· 17 15 # compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code 18 16 # generation is minimal, it will just use r29 instead. 19 17 CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) $(call cc-option, -ffixed-r30) 18 + endif 19 + 20 + ifneq ($(c-getrandom-y),) 21 + CFLAGS_vgetrandom-32.o += -include $(c-getrandom-y) 20 22 endif 21 23 22 24 # Build rules ··· 31 25 VDSOCC := $(CC) 32 26 endif 33 27 34 - targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o 28 + targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday-32.o vgetrandom-32.o 35 29 targets += crtsavres-32.o 36 30 obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) 37 31 targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o 38 32 obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) 39 33 40 - ccflags-y := -fno-common -fno-builtin 34 + ccflags-y := -fno-common -fno-builtin -DBUILD_VDSO 41 35 ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN) 42 36 ccflags-y += $(call cc-option, -fno-stack-protector) 43 37 ccflags-y += -DDISABLE_BRANCH_PROFILING ··· 69 63 CPPFLAGS_vdso64.lds += -P -C 70 64 71 65 # link rule for the .so file, .lds has to be first 72 - $(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/crtsavres-32.o FORCE 66 + $(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o FORCE 73 67 $(call if_changed,vdso32ld_and_check) 74 68 $(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o FORCE 75 69 $(call if_changed,vdso64ld_and_check) ··· 80 74 $(obj)/crtsavres-32.o: %-32.o: $(srctree)/arch/powerpc/lib/crtsavres.S FORCE 81 75 $(call if_changed_dep,vdso32as) 82 76 $(obj)/vgettimeofday-32.o: %-32.o: %.c FORCE 77 + $(call if_changed_dep,vdso32cc) 78 + $(obj)/vgetrandom-32.o: %-32.o: %.c FORCE 83 79 $(call if_changed_dep,vdso32cc) 84 80 $(obj-vdso64): %-64.o: %.S FORCE 85 81 $(call if_changed_dep,vdso64as)
+50
arch/powerpc/kernel/vdso/getrandom.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + /* 3 + * Userland implementation of getrandom() for processes 4 + * for use in the vDSO 5 + * 6 + * Copyright (C) 2024 Christophe Leroy <christophe.leroy@csgroup.eu>, CS GROUP France 7 + */ 8 + #include <asm/processor.h> 9 + #include <asm/ppc_asm.h> 10 + #include <asm/vdso.h> 11 + #include <asm/vdso_datapage.h> 12 + #include <asm/asm-offsets.h> 13 + #include <asm/unistd.h> 14 + 15 + /* 16 + * The macro sets two stack frames, one for the caller and one for the callee 17 + * because there are no requirement for the caller to set a stack frame when 18 + * calling VDSO so it may have omitted to set one, especially on PPC64 19 + */ 20 + 21 + .macro cvdso_call funct 22 + .cfi_startproc 23 + PPC_STLU r1, -PPC_MIN_STKFRM(r1) 24 + .cfi_adjust_cfa_offset PPC_MIN_STKFRM 25 + mflr r0 26 + PPC_STLU r1, -PPC_MIN_STKFRM(r1) 27 + .cfi_adjust_cfa_offset PPC_MIN_STKFRM 28 + PPC_STL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1) 29 + .cfi_rel_offset lr, PPC_MIN_STKFRM + PPC_LR_STKOFF 30 + get_realdatapage r8, r11 31 + addi r8, r8, VDSO_RNG_DATA_OFFSET 32 + bl CFUNC(DOTSYM(\funct)) 33 + PPC_LL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1) 34 + cmpwi r3, 0 35 + mtlr r0 36 + addi r1, r1, 2 * PPC_MIN_STKFRM 37 + .cfi_restore lr 38 + .cfi_def_cfa_offset 0 39 + crclr so 40 + bgelr+ 41 + crset so 42 + neg r3, r3 43 + blr 44 + .cfi_endproc 45 + .endm 46 + 47 + .text 48 + V_FUNCTION_BEGIN(__kernel_getrandom) 49 + cvdso_call __c_kernel_getrandom 50 + V_FUNCTION_END(__kernel_getrandom)
+1
arch/powerpc/kernel/vdso/vdso32.lds.S
··· 128 128 #if defined(CONFIG_PPC64) || !defined(CONFIG_SMP) 129 129 __kernel_getcpu; 130 130 #endif 131 + __kernel_getrandom; 131 132 132 133 local: *; 133 134 };
+312
arch/powerpc/kernel/vdso/vgetrandom-chacha.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2024 Christophe Leroy <christophe.leroy@csgroup.eu>, CS GROUP France 4 + */ 5 + 6 + #include <linux/linkage.h> 7 + 8 + #include <asm/ppc_asm.h> 9 + 10 + #define dst_bytes r3 11 + #define key r4 12 + #define counter r5 13 + #define nblocks r6 14 + 15 + #define idx_r0 r0 16 + #define val4 r4 17 + 18 + #define const0 0x61707865 19 + #define const1 0x3320646e 20 + #define const2 0x79622d32 21 + #define const3 0x6b206574 22 + 23 + #define key0 r5 24 + #define key1 r6 25 + #define key2 r7 26 + #define key3 r8 27 + #define key4 r9 28 + #define key5 r10 29 + #define key6 r11 30 + #define key7 r12 31 + 32 + #define counter0 r14 33 + #define counter1 r15 34 + 35 + #define state0 r16 36 + #define state1 r17 37 + #define state2 r18 38 + #define state3 r19 39 + #define state4 r20 40 + #define state5 r21 41 + #define state6 r22 42 + #define state7 r23 43 + #define state8 r24 44 + #define state9 r25 45 + #define state10 r26 46 + #define state11 r27 47 + #define state12 r28 48 + #define state13 r29 49 + #define state14 r30 50 + #define state15 r31 51 + 52 + .macro quarterround4 a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 a4 b4 c4 d4 53 + add \a1, \a1, \b1 54 + add \a2, \a2, \b2 55 + add \a3, \a3, \b3 56 + add \a4, \a4, \b4 57 + xor \d1, \d1, \a1 58 + xor \d2, \d2, \a2 59 + xor \d3, \d3, \a3 60 + xor \d4, \d4, \a4 61 + rotlwi \d1, \d1, 16 62 + rotlwi \d2, \d2, 16 63 + rotlwi \d3, \d3, 16 64 + rotlwi \d4, \d4, 16 65 + add \c1, \c1, \d1 66 + add \c2, \c2, \d2 67 + add \c3, \c3, \d3 68 + add \c4, \c4, \d4 69 + xor \b1, \b1, \c1 70 + xor \b2, \b2, \c2 71 + xor \b3, \b3, \c3 72 + xor \b4, \b4, \c4 73 + rotlwi \b1, \b1, 12 74 + rotlwi \b2, \b2, 12 75 + rotlwi \b3, \b3, 12 76 + rotlwi \b4, \b4, 12 77 + add \a1, \a1, \b1 78 + add \a2, \a2, \b2 79 + add \a3, \a3, \b3 80 + add \a4, \a4, \b4 81 + xor \d1, \d1, \a1 82 + xor \d2, \d2, \a2 83 + xor \d3, \d3, \a3 84 + xor \d4, \d4, \a4 85 + rotlwi \d1, \d1, 8 86 + rotlwi \d2, \d2, 8 87 + rotlwi \d3, \d3, 8 88 + rotlwi \d4, \d4, 8 89 + add \c1, \c1, \d1 90 + add \c2, \c2, \d2 91 + add \c3, \c3, \d3 92 + add \c4, \c4, \d4 93 + xor \b1, \b1, \c1 94 + xor \b2, \b2, \c2 95 + xor \b3, \b3, \c3 96 + xor \b4, \b4, \c4 97 + rotlwi \b1, \b1, 7 98 + rotlwi \b2, \b2, 7 99 + rotlwi \b3, \b3, 7 100 + rotlwi \b4, \b4, 7 101 + .endm 102 + 103 + #define QUARTERROUND4(a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,a4,b4,c4,d4) \ 104 + quarterround4 state##a1 state##b1 state##c1 state##d1 \ 105 + state##a2 state##b2 state##c2 state##d2 \ 106 + state##a3 state##b3 state##c3 state##d3 \ 107 + state##a4 state##b4 state##c4 state##d4 108 + 109 + /* 110 + * Very basic 32 bits implementation of ChaCha20. Produces a given positive number 111 + * of blocks of output with a nonce of 0, taking an input key and 8-byte 112 + * counter. Importantly does not spill to the stack. Its arguments are: 113 + * 114 + * r3: output bytes 115 + * r4: 32-byte key input 116 + * r5: 8-byte counter input/output (saved on stack) 117 + * r6: number of 64-byte blocks to write to output 118 + * 119 + * r0: counter of blocks (initialised with r6) 120 + * r4: Value '4' after key has been read. 121 + * r5-r12: key 122 + * r14-r15: counter 123 + * r16-r31: state 124 + */ 125 + SYM_FUNC_START(__arch_chacha20_blocks_nostack) 126 + #ifdef __powerpc64__ 127 + #else 128 + stwu r1, -96(r1) 129 + stw counter, 20(r1) 130 + #ifdef __BIG_ENDIAN__ 131 + stmw r14, 24(r1) 132 + #else 133 + stw r14, 24(r1) 134 + stw r15, 28(r1) 135 + stw r16, 32(r1) 136 + stw r17, 36(r1) 137 + stw r18, 40(r1) 138 + stw r19, 44(r1) 139 + stw r20, 48(r1) 140 + stw r21, 52(r1) 141 + stw r22, 56(r1) 142 + stw r23, 60(r1) 143 + stw r24, 64(r1) 144 + stw r25, 68(r1) 145 + stw r26, 72(r1) 146 + stw r27, 76(r1) 147 + stw r28, 80(r1) 148 + stw r29, 84(r1) 149 + stw r30, 88(r1) 150 + stw r31, 92(r1) 151 + #endif 152 + 153 + lwz counter0, 0(counter) 154 + lwz counter1, 4(counter) 155 + mr idx_r0, nblocks 156 + subi dst_bytes, dst_bytes, 4 157 + 158 + lwz key0, 0(key) 159 + lwz key1, 4(key) 160 + lwz key2, 8(key) 161 + lwz key3, 12(key) 162 + lwz key4, 16(key) 163 + lwz key5, 20(key) 164 + lwz key6, 24(key) 165 + lwz key7, 28(key) 166 + 167 + li val4, 4 168 + .Lblock: 169 + li r31, 10 170 + 171 + lis state0, const0@ha 172 + lis state1, const1@ha 173 + lis state2, const2@ha 174 + lis state3, const3@ha 175 + addi state0, state0, const0@l 176 + addi state1, state1, const1@l 177 + addi state2, state2, const2@l 178 + addi state3, state3, const3@l 179 + 180 + mtctr r31 181 + 182 + mr state4, key0 183 + mr state5, key1 184 + mr state6, key2 185 + mr state7, key3 186 + mr state8, key4 187 + mr state9, key5 188 + mr state10, key6 189 + mr state11, key7 190 + 191 + mr state12, counter0 192 + mr state13, counter1 193 + 194 + li state14, 0 195 + li state15, 0 196 + 197 + .Lpermute: 198 + QUARTERROUND4( 0, 4, 8,12, 1, 5, 9,13, 2, 6,10,14, 3, 7,11,15) 199 + QUARTERROUND4( 0, 5,10,15, 1, 6,11,12, 2, 7, 8,13, 3, 4, 9,14) 200 + 201 + bdnz .Lpermute 202 + 203 + addis state0, state0, const0@ha 204 + addis state1, state1, const1@ha 205 + addis state2, state2, const2@ha 206 + addis state3, state3, const3@ha 207 + addi state0, state0, const0@l 208 + addi state1, state1, const1@l 209 + addi state2, state2, const2@l 210 + addi state3, state3, const3@l 211 + 212 + add state4, state4, key0 213 + add state5, state5, key1 214 + add state6, state6, key2 215 + add state7, state7, key3 216 + add state8, state8, key4 217 + add state9, state9, key5 218 + add state10, state10, key6 219 + add state11, state11, key7 220 + 221 + add state12, state12, counter0 222 + add state13, state13, counter1 223 + 224 + #ifdef __BIG_ENDIAN__ 225 + stwbrx state0, val4, dst_bytes 226 + addi dst_bytes, dst_bytes, 8 227 + stwbrx state1, 0, dst_bytes 228 + stwbrx state2, val4, dst_bytes 229 + addi dst_bytes, dst_bytes, 8 230 + stwbrx state3, 0, dst_bytes 231 + stwbrx state4, val4, dst_bytes 232 + addi dst_bytes, dst_bytes, 8 233 + stwbrx state5, 0, dst_bytes 234 + stwbrx state6, val4, dst_bytes 235 + addi dst_bytes, dst_bytes, 8 236 + stwbrx state7, 0, dst_bytes 237 + stwbrx state8, val4, dst_bytes 238 + addi dst_bytes, dst_bytes, 8 239 + stwbrx state9, 0, dst_bytes 240 + stwbrx state10, val4, dst_bytes 241 + addi dst_bytes, dst_bytes, 8 242 + stwbrx state11, 0, dst_bytes 243 + stwbrx state12, val4, dst_bytes 244 + addi dst_bytes, dst_bytes, 8 245 + stwbrx state13, 0, dst_bytes 246 + stwbrx state14, val4, dst_bytes 247 + addi dst_bytes, dst_bytes, 8 248 + stwbrx state15, 0, dst_bytes 249 + #else 250 + stw state0, 4(dst_bytes) 251 + stw state1, 8(dst_bytes) 252 + stw state2, 12(dst_bytes) 253 + stw state3, 16(dst_bytes) 254 + stw state4, 20(dst_bytes) 255 + stw state5, 24(dst_bytes) 256 + stw state6, 28(dst_bytes) 257 + stw state7, 32(dst_bytes) 258 + stw state8, 36(dst_bytes) 259 + stw state9, 40(dst_bytes) 260 + stw state10, 44(dst_bytes) 261 + stw state11, 48(dst_bytes) 262 + stw state12, 52(dst_bytes) 263 + stw state13, 56(dst_bytes) 264 + stw state14, 60(dst_bytes) 265 + stwu state15, 64(dst_bytes) 266 + #endif 267 + 268 + subic. idx_r0, idx_r0, 1 /* subi. can't use r0 as source */ 269 + 270 + addic counter0, counter0, 1 271 + addze counter1, counter1 272 + 273 + bne .Lblock 274 + 275 + lwz counter, 20(r1) 276 + stw counter0, 0(counter) 277 + stw counter1, 4(counter) 278 + 279 + li r6, 0 280 + li r7, 0 281 + li r8, 0 282 + li r9, 0 283 + li r10, 0 284 + li r11, 0 285 + li r12, 0 286 + 287 + #ifdef __BIG_ENDIAN__ 288 + lmw r14, 24(r1) 289 + #else 290 + lwz r14, 24(r1) 291 + lwz r15, 28(r1) 292 + lwz r16, 32(r1) 293 + lwz r17, 36(r1) 294 + lwz r18, 40(r1) 295 + lwz r19, 44(r1) 296 + lwz r20, 48(r1) 297 + lwz r21, 52(r1) 298 + lwz r22, 56(r1) 299 + lwz r23, 60(r1) 300 + lwz r24, 64(r1) 301 + lwz r25, 68(r1) 302 + lwz r26, 72(r1) 303 + lwz r27, 76(r1) 304 + lwz r28, 80(r1) 305 + lwz r29, 84(r1) 306 + lwz r30, 88(r1) 307 + lwz r31, 92(r1) 308 + #endif 309 + addi r1, r1, 96 310 + #endif /* __powerpc64__ */ 311 + blr 312 + SYM_FUNC_END(__arch_chacha20_blocks_nostack)
+14
arch/powerpc/kernel/vdso/vgetrandom.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Powerpc userspace implementation of getrandom() 4 + * 5 + * Copyright (C) 2024 Christophe Leroy <christophe.leroy@csgroup.eu>, CS GROUP France 6 + */ 7 + #include <linux/time.h> 8 + #include <linux/types.h> 9 + 10 + ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, 11 + size_t opaque_len, const struct vdso_rng_data *vd) 12 + { 13 + return __cvdso_getrandom_data(vd, buffer, len, flags, opaque_state, opaque_len); 14 + }
+1 -1
tools/testing/selftests/vDSO/Makefile
··· 9 9 TEST_GEN_PROGS += vdso_standalone_test_x86 10 10 endif 11 11 TEST_GEN_PROGS += vdso_test_correctness 12 - ifeq ($(ARCH)$(CONFIG_X86_32),$(filter $(ARCH)$(CONFIG_X86_32),x86 x86_64 loongarch arm64)) 12 + ifeq ($(ARCH)$(CONFIG_X86_32),$(filter $(ARCH)$(CONFIG_X86_32),x86 x86_64 loongarch arm64 powerpc)) 13 13 TEST_GEN_PROGS += vdso_test_getrandom 14 14 TEST_GEN_PROGS += vdso_test_chacha 15 15 endif