This series wires up getrandom() vDSO implementation on powerpc. Tested on PPC32. Performance on powerpc 885 (using kernel selftest): ~# ./vdso_test_getrandom bench-single vdso: 2500000 times in 7.897495392 seconds libc: 2500000 times in 56.091632232 seconds syscall: 2500000 times in 55.704851989 seconds Performance on powerpc 8321 (using kernel selftest): ~# ./vdso_test_getrandom bench-single vdso: 2500000 times in 2.017183250 seconds libc: 2500000 times in 13.088533630 seconds syscall: 2500000 times in 12.952458068 seconds Only build tested on PPC64. It doesn't build with CONFIG_COMPAT. This is because unlike gettimeofday.c, getrandom.c includes a lot of headers from outside of include/vdso/ . The same work as done by commit 8c59ab839f52 ("lib/vdso: Enable common headers") needs to be done on lib/vdso/getrandom.c Among the few strange things to be clarified, there is the format on the key passed to __arch_chacha20_blocks_nostack(). In struct vgetrandom_state it is declared as a table of u32, but in reality it seems it is a flat storage that needs to be loaded in reversed byte order, so it should either be defined as a table of bytes, or as a table of __le32 but not a table of u32. Christophe Leroy (9): powerpc/vdso: Don't discard rela sections powerpc/vdso32: Add crtsavres vdso: Add __arch_get_k_vdso_rng_data() vdso: Add missing c-getrandom-y in Makefile vdso: Avoid call to memset() by getrandom vdso: Only use MAP_DROPPABLE when VM_DROPPABLE exists powerpc: Add little endian variants of LHZX_BE and friends powerpc/vdso: Wire up getrandom() vDSO implementation selftests: [NOT TO BE MERGED] Modifications for testing VDSO getrandom implementation on PPC32 arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/asm-compat.h | 40 ++- arch/powerpc/include/asm/vdso/getrandom.h | 61 ++++ arch/powerpc/include/asm/vdso/vsyscall.h | 7 + arch/powerpc/include/asm/vdso_datapage.h | 2 + arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/vdso/Makefile | 44 ++- arch/powerpc/kernel/vdso/getrandom.S | 62 ++++ arch/powerpc/kernel/vdso/gettimeofday.S | 13 - arch/powerpc/kernel/vdso/vdso32.lds.S | 5 +- arch/powerpc/kernel/vdso/vdso64.lds.S | 5 +- arch/powerpc/kernel/vdso/vgetrandom-chacha.S | 297 ++++++++++++++++++ arch/powerpc/kernel/vdso/vgetrandom.c | 12 + arch/x86/include/asm/vdso/vsyscall.h | 7 + drivers/char/random.c | 5 +- include/asm-generic/vdso/vsyscall.h | 7 + include/vdso/limits.h | 4 +- lib/vdso/Makefile | 1 + lib/vdso/getrandom.c | 18 +- tools/testing/selftests/vDSO/Makefile | 2 +- .../selftests/vDSO/vdso_test_getrandom.c | 6 +- 21 files changed, 553 insertions(+), 47 deletions(-) create mode 100644 arch/powerpc/include/asm/vdso/getrandom.h create mode 100644 arch/powerpc/kernel/vdso/getrandom.S create mode 100644 arch/powerpc/kernel/vdso/vgetrandom-chacha.S create mode 100644 arch/powerpc/kernel/vdso/vgetrandom.c -- 2.44.0