[PATCH v5 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO64

2024-09-02 Thread Christophe Leroy
-by: Christophe Leroy --- v5: - VDSO32 for both PPC32 and PPC64 is in previous patch. This patch have the logic for VDSO64. v4: - Use __BIG_ENDIAN__ which is defined by GCC instead of CONFIG_CPU_BIG_ENDIAN which is unknown by selftests - Implement a cleaner/smaller output copy for little endian

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

2024-09-02 Thread Christophe Leroy
gs 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 --- v5: - Add back vdso symlink that vani

[PATCH v5 3/5] powerpc/vdso: Refactor CFLAGS for CVDSO build

2024-09-02 Thread Christophe Leroy
In order to avoid two much duplication when we add new VDSO functionnalities in C like getrandom, refactor common CFLAGS. Signed-off-by: Christophe Leroy --- v3: Also refactor removed flags --- arch/powerpc/kernel/vdso/Makefile | 32 +-- 1 file changed, 13 insertions

[PATCH v5 2/5] powerpc/vdso32: Add crtsavres

2024-09-02 Thread Christophe Leroy
ve/restore functions when optimising the kernel for size. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/vdso/Makefile | 5 - arch/powerpc/kernel/vdso/gettimeofday.S | 13 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/vdso/Makefi

[PATCH v5 1/5] mm: Define VM_DROPPABLE for powerpc/32

2024-09-02 Thread Christophe Leroy
_ARCH_1 is used for VM_SAO on powerpc and VM_SAO is only for powerpc/64. It is used in combination with PROT_SAO in some parts of code that are restricted to CONFIG_PPC64 through #ifdefs, it is therefore possible to define VM_SAO for CONFIG_PPC64 only. Signed-off-by: Christophe Leroy --- v4:

[PATCH v5 0/5] Wire up getrandom() vDSO implementation on powerpc

2024-09-02 Thread Christophe Leroy
PPC32, second for PPC64 - Moved selftest fixes out of this series Changes in v2: - Define VM_DROPPABLE for powerpc/32 - Fixes generic vDSO getrandom headers to enable CONFIG_COMPAT build. - Fixed size of generation counter - Fixed selftests to work on non x86 architectures Christophe Leroy (5): mm: D

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

2024-09-02 Thread Christophe Leroy
Hi Jason, hi Michael, Le 02/09/2024 à 16:19, Jason A. Donenfeld a écrit : On Mon, Sep 02, 2024 at 04:16:48PM +0200, Christophe Leroy wrote: Can do that, but there will still be a problem with chacha selftests if I don't opt-out the entire function content when it is ppc64. It will

Re: [PATCH] selftests: vDSO: Do not rely on $ARCH for vdso_test_getrandom && vdso_test_chacha

2024-09-02 Thread Christophe Leroy
Le 02/09/2024 à 16:18, Christophe Leroy a écrit : Le 02/09/2024 à 15:57, Jason A. Donenfeld a écrit : On Mon, Sep 02, 2024 at 03:23:47PM +0200, Christophe Leroy wrote: Le 02/09/2024 à 14:37, Mark Brown a écrit : On Mon, Sep 02, 2024 at 02:22:38PM +0200, Christophe Leroy wrote: When

Re: [PATCH] selftests: vDSO: Do not rely on $ARCH for vdso_test_getrandom && vdso_test_chacha

2024-09-02 Thread Christophe Leroy
Le 02/09/2024 à 15:57, Jason A. Donenfeld a écrit : On Mon, Sep 02, 2024 at 03:23:47PM +0200, Christophe Leroy wrote: Le 02/09/2024 à 14:37, Mark Brown a écrit : On Mon, Sep 02, 2024 at 02:22:38PM +0200, Christophe Leroy wrote: When vdso_test_getcpu doesn't find the vDSO entry poin

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

2024-09-02 Thread Christophe Leroy
Le 02/09/2024 à 16:00, Jason A. Donenfeld a écrit : On Mon, Sep 02, 2024 at 03:12:47PM +0200, Christophe Leroy wrote: Le 02/09/2024 à 14:41, Jason A. Donenfeld a écrit : On Mon, Sep 02, 2024 at 02:04:42PM +0200, Christophe Leroy wrote: SYM_FUNC_START(__arch_chacha20_blocks_nostack

Re: [PATCH] selftests: vDSO: Do not rely on $ARCH for vdso_test_getrandom && vdso_test_chacha

2024-09-02 Thread Christophe Leroy
Le 02/09/2024 à 14:37, Mark Brown a écrit : On Mon, Sep 02, 2024 at 02:22:38PM +0200, Christophe Leroy wrote: When vdso_test_getcpu doesn't find the vDSO entry point, it prints an error text and returns KSFT_SKIP I thought it would be more correct to have the same behavio

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

2024-09-02 Thread Christophe Leroy
Le 02/09/2024 à 14:41, Jason A. Donenfeld a écrit : On Mon, Sep 02, 2024 at 02:04:42PM +0200, Christophe Leroy wrote: SYM_FUNC_START(__arch_chacha20_blocks_nostack) #ifdef __powerpc64__ - blr + std r5, -216(r1) + + std r14, -144(r1) + std r15, -136(r1

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

2024-09-02 Thread Christophe Leroy
Le 02/09/2024 à 14:34, Jason A. Donenfeld a écrit : On Mon, Sep 02, 2024 at 02:04:41PM +0200, Christophe Leroy wrote: This first patch adds support for PPC32. As selftests cannot easily be generated only for PPC32, and because the following patch brings support for PPC64 anyway, this patch

Re: [PATCH] selftests: vDSO: Do not rely on $ARCH for vdso_test_getrandom && vdso_test_chacha

2024-09-02 Thread Christophe Leroy
Hi Jason, Le 01/09/2024 à 15:22, Jason A. Donenfeld a écrit : Hi Christophe, Hmm, I'm not so sure I like this very much. I think it's important for these tests to fail when an arch tries to hook up the function to the vDSO, but it's still not exported for some reason. This also regresses the AR

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

2024-09-02 Thread Christophe Leroy
-off-by: Christophe Leroy --- v4: - Use __BIG_ENDIAN__ which is defined by GCC instead of CONFIG_CPU_BIG_ENDIAN which is unknown by selftests - Implement a cleaner/smaller output copy for little endian instead of keeping compat macro. v3: New (split out of previous patch) --- arch/powerpc/Kconfig

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

2024-09-02 Thread Christophe Leroy
n PPC64 so that vdso_test_getrandom returns KSFT_SKIP instead of KSFT_FAIL. Signed-off-by: Christophe Leroy --- v4: - Counter has native byte order - Fix selftest build on ppc64le until implemented. - On ppc64, for now implement __kernel_getrandom to return ENOSYS error - Use stwbrx directly,

[PATCH v4 3/5] powerpc/vdso: Refactor CFLAGS for CVDSO build

2024-09-02 Thread Christophe Leroy
In order to avoid two much duplication when we add new VDSO functionnalities in C like getrandom, refactor common CFLAGS. Signed-off-by: Christophe Leroy --- v3: Also refactor removed flags --- arch/powerpc/kernel/vdso/Makefile | 32 +-- 1 file changed, 13 insertions

[PATCH v4 2/5] powerpc/vdso32: Add crtsavres

2024-09-02 Thread Christophe Leroy
ve/restore functions when optimising the kernel for size. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/vdso/Makefile | 5 - arch/powerpc/kernel/vdso/gettimeofday.S | 13 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/vdso/Makefi

[PATCH v4 1/5] mm: Define VM_DROPPABLE for powerpc/32

2024-09-02 Thread Christophe Leroy
_ARCH_1 is used for VM_SAO on powerpc and VM_SAO is only for powerpc/64. It is used in combination with PROT_SAO in some parts of code that are restricted to CONFIG_PPC64 through #ifdefs, it is therefore possible to define VM_SAO for CONFIG_PPC64 only. Signed-off-by: Christophe Leroy --- v4:

[PATCH v4 0/5] Wire up getrandom() vDSO implementation on powerpc

2024-09-02 Thread Christophe Leroy
Fixed selftests to work on non x86 architectures Christophe Leroy (5): mm: Define VM_DROPPABLE for powerpc/32 powerpc/vdso32: Add crtsavres powerpc/vdso: Refactor CFLAGS for CVDSO build powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32 powerpc/vdso: Wire up getrandom()

Re: [PATCH] selftests: vDSO: Do not rely on $ARCH for vdso_test_getrandom && vdso_test_chacha

2024-09-01 Thread Christophe Leroy
Le 01/09/2024 à 20:02, Jason A. Donenfeld a écrit : On Sun, Sep 01, 2024 at 08:00:30PM +0200, Christophe Leroy wrote: Hi Jason, Le 01/09/2024 à 15:22, Jason A. Donenfeld a écrit : Hi Christophe, Hmm, I'm not so sure I like this very much. I think it's important for these tes

Re: [PATCH] selftests: vDSO: Do not rely on $ARCH for vdso_test_getrandom && vdso_test_chacha

2024-09-01 Thread Christophe Leroy
(CONFIG_X86_32) will evaluate to x86. On arm64 machines, it will evaluate to arm64. On 32-bit x86 machines, it will evaluate to x86y, which won't match the filter list. Reported-by: Mark Brown Reported-by: Christophe Leroy Signed-off-by: Jason A. Donenfeld --- tools/testing/selftests/vDSO/

[PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Christophe Leroy
;nonce' which is not unused anymore after the replacement of libsodium by open coded chacha implementation. Signed-off-by: Christophe Leroy --- .../testing/selftests/vDSO/vdso_test_chacha.c | 39 ++- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/too

[PATCH] selftests: vDSO: Build vDSO tests with O2 optimisation

2024-09-01 Thread Christophe Leroy
TAP version 13 1..1 ok 1 chacha: PASS real0m 32.09s user0m 31.86s sys 0m 0.22s Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing

[PATCH] selftests: vDSO: Do not rely on $ARCH for vdso_test_getrandom && vdso_test_chacha

2024-08-31 Thread Christophe Leroy
vDSO function is not found, just like vdso_test_getcpu or vdso_test_gettimeofday. Signed-off-by: Christophe Leroy --- Based on latest random tree (0dfed8092247) tools/arch/x86/vdso | 1 - tools/testing/selftests/vDSO/Makefile | 10 -- tools

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

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

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

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

2024-08-30 Thread Christophe Leroy
-off-by: Christophe Leroy --- v3: New (split out of previous patch) --- arch/powerpc/Kconfig | 2 +- arch/powerpc/include/asm/mman.h | 2 +- arch/powerpc/kernel/vdso/Makefile| 10 +- arch/powerpc/kernel/vdso/getrandom.S | 8 ++ arch/powerpc

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

2024-08-30 Thread Christophe Leroy
vdso: 2500 times in 16.899318858 seconds libc: 2500 times in 131.050596522 seconds syscall: 2500 times in 129.794790389 seconds Signed-off-by: Christophe Leroy --- v3: - Preserve r13, implies saving r5 on stack - Split PPC64 implementation out. --- arch/power

[PATCH v3 3/5] powerpc/vdso: Refactor CFLAGS for CVDSO build

2024-08-30 Thread Christophe Leroy
In order to avoid two much duplication when we add new VDSO functionnalities in C like getrandom, refactor common CFLAGS. Signed-off-by: Christophe Leroy --- v3: Also refactor removed flags --- arch/powerpc/kernel/vdso/Makefile | 32 +-- 1 file changed, 13 insertions

[PATCH v3 2/5] powerpc/vdso32: Add crtsavres

2024-08-30 Thread Christophe Leroy
ve/restore functions when optimising the kernel for size. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/vdso/Makefile | 5 - arch/powerpc/kernel/vdso/gettimeofday.S | 13 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/vdso/Makefi

[PATCH v3 1/5] mm: Define VM_DROPPABLE for powerpc/32

2024-08-30 Thread Christophe Leroy
_ARCH_1 is used for VM_SAO on powerpc and VM_SAO is only for powerpc/64. Signed-off-by: Christophe Leroy --- v3: Fixed build failure reported by robots. --- fs/proc/task_mmu.c | 4 +++- include/linux/mm.h | 4 +++- include/trace/events/mmflags.h | 4 ++-- 3 files

[PATCH v3 0/5] Wire up getrandom() vDSO implementation on powerpc

2024-08-30 Thread Christophe Leroy
v2: - Define VM_DROPPABLE for powerpc/32 - Fixes generic vDSO getrandom headers to enable CONFIG_COMPAT build. - Fixed size of generation counter - Fixed selftests to work on non x86 architectures Christophe Leroy (5): mm: Define VM_DROPPABLE for powerpc/32 powerpc/vdso32: Add crtsavres

[PATCH 5/5] selftests: vdso: Use parse_vdso.h in vdso_test_abi

2024-08-30 Thread Christophe Leroy
Don't duplicate parse_vdso function prototypes, include the header instead. Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest") Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_test_abi.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) dif

[PATCH 4/5] selftests: vdso: Fix the way vDSO functions are called for powerpc

2024-08-30 Thread Christophe Leroy
a selftest for vDSO getcpu()") Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest") Fixes: b2f1c3db2887 ("kselftest: Extend vdso correctness test to clock_gettime64") Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom") Signed-off-by: Ch

[PATCH 3/5] selftests: vdso: Fix vDSO symbols lookup for powerpc64

2024-08-30 Thread Christophe Leroy
57868 NOTYPE GLOBAL DEFAULT8 __kernel_time 54: 04d084 NOTYPE GLOBAL DEFAULT8 __kernel_clock_g[...] 55: 05bc52 NOTYPE GLOBAL DEFAULT8 __kernel_get_sys[...] Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser&quo

[PATCH 2/5] selftests: vdso: Fix vdso_config for powerpc

2024-08-30 Thread Christophe Leroy
__powerpc64__ needs to be checked first in vdso_config.h Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest") Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_config.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/self

[PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc

2024-08-30 Thread Christophe Leroy
powerpc, vDSO is neither called linux-vdso.so.1 nor linux-gate.so.1 but linux-vdso32.so.1 or linux-vdso64.so.1. Also search those two names before giving up. Fixes: c7e5789b24d3 ("kselftest: Move test_vdso to the vDSO test suite") Signed-off-by: Christophe Leroy --- tools/testing/self

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-29 Thread Christophe Leroy
Le 29/08/2024 à 20:02, Segher Boessenkool a écrit : On Thu, Aug 29, 2024 at 07:36:38PM +0200, Christophe Leroy wrote: Le 28/08/2024 à 19:25, Segher Boessenkool a écrit : Not sure about static binaries, though: do those even use the VDSO? With "static binary" people usual

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-29 Thread Christophe Leroy
Le 28/08/2024 à 19:25, Segher Boessenkool a écrit : Not sure about static binaries, though: do those even use the VDSO? With "static binary" people usually mean "a binary not using any DSOs", I think the VDSO is a DSO, also in this respect? As always, -static builds are *way* less problem

Re: [PATCH] selftests/vDSO: open code basic chacha instead of linking to libsodium

2024-08-28 Thread Christophe Leroy
Le 28/08/2024 à 16:49, Jason A. Donenfeld a écrit : Hi Christophe, On Wed, Aug 28, 2024 at 4:38 PM LEROY Christophe wrote: - key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7] + le32toh(key[0]), le32toh(key[1]), le32toh(key[2]), le32toh(key[3]), +

Re: [PATCH 07/16] powerpc: mm: Support MAP_BELOW_HINT

2024-08-27 Thread Christophe Leroy
Hi Charlie, Le 28/08/2024 à 07:49, Charlie Jenkins a écrit : Add support for MAP_BELOW_HINT to arch_get_mmap_base() and arch_get_mmap_end(). Signed-off-by: Charlie Jenkins --- arch/powerpc/include/asm/task_size_64.h | 36 +++-- 1 file changed, 30 insertions(+), 6

Re: [PATCH v4 3/4] selftests/vDSO: Use KHDR_INCLUDES to locate UAPI headers for vdso_test_getrandom

2024-08-27 Thread Christophe Leroy
Le 27/08/2024 à 17:00, Jason A. Donenfeld a écrit : On Tue, Aug 27, 2024 at 04:50:59PM +0200, Christophe Leroy wrote: Le 27/08/2024 à 16:41, Xi Ruoyao a écrit : On Tue, 2024-08-27 at 16:15 +0200, Jason A. Donenfeld wrote: /* snip */ gcc -std=gnu99 -D_GNU_SOURCE= -isystem /home/zx2c4

Re: [PATCH v4 3/4] selftests/vDSO: Use KHDR_INCLUDES to locate UAPI headers for vdso_test_getrandom

2024-08-27 Thread Christophe Leroy
Le 27/08/2024 à 16:41, Xi Ruoyao a écrit : On Tue, 2024-08-27 at 16:15 +0200, Jason A. Donenfeld wrote: /* snip */ gcc -std=gnu99 -D_GNU_SOURCE= -isystem /home/zx2c4/Projects/random-linux/tools/testing/selftests/../../../tools/include -isystem /home/zx2c4/Projects/random-linux/tools/test

Re: [PATCH v2 02/17] vdso: Clean header inclusion in getrandom

2024-08-26 Thread Christophe Leroy
Le 26/08/2024 à 10:58, Jason A. Donenfeld a écrit : On Mon, Aug 26, 2024 at 10:37:49AM +0200, Christophe Leroy wrote: Le 26/08/2024 à 10:07, Jason A. Donenfeld a écrit : On Thu, Aug 22, 2024 at 09:13:10AM +0200, Christophe Leroy wrote: +#define _PAGE_SIZE (1UL << CONFIG_PAGE

Re: [PATCH v2 02/17] vdso: Clean header inclusion in getrandom

2024-08-26 Thread Christophe Leroy
Le 26/08/2024 à 10:07, Jason A. Donenfeld a écrit : On Thu, Aug 22, 2024 at 09:13:10AM +0200, Christophe Leroy wrote: +#define _PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT) +#define _PAGE_MASK (~(_PAGE_SIZE - 1)) If PAGE_SIZE isn't defined at this point, why not just call it PAGE_S

Re: [PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long

2024-08-26 Thread Christophe Leroy
Le 26/08/2024 à 09:50, Jason A. Donenfeld a écrit : On Thu, Aug 22, 2024 at 09:13:14AM +0200, Christophe Leroy wrote: Performing SMP atomic operations on u64 fails on powerpc32. Random driver generation is handled as unsigned long not u64, see for instance base_cnrg or struct crng. Use the

Re: [PATCH v2 01/17] asm-generic/unaligned.h: Extract common header for vDSO

2024-08-26 Thread Christophe Leroy
Le 26/08/2024 à 09:20, Jason A. Donenfeld a écrit : On Thu, Aug 22, 2024 at 09:13:09AM +0200, Christophe Leroy wrote: include/asm-generic/unaligned.h | 11 +-- include/vdso/unaligned.h| 15 +++ 2 files changed, 16 insertions(+), 10 deletions(-) create mode

[PATCH v2 17/17] selftests: vdso: Add support for vdso_test_random for powerpc

2024-08-22 Thread Christophe Leroy
Add the necessary symbolic link and tell Makefile to build vdso_test_random for powerpc. In makefile, don't use $(uname_M) which is wrong when cross-building for powerpc on an x86_64. Implement the required VDSO_CALL macro to correctly handle errors. Signed-off-by: Christophe Leroy ---

[PATCH v2 16/17] selftests: vdso: Make VDSO function call more generic

2024-08-22 Thread Christophe Leroy
number of arguments and the arguments. Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_call.h | 12 tools/testing/selftests/vDSO/vdso_test_getrandom.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests

[PATCH v2 15/17] selftests: vdso: Fix build of test_vdso_chacha

2024-08-22 Thread Christophe Leroy
so it goes prior to glibc's include directory. Replace -isystem by -idirafter But this implies that now tools/include/linux/linkage.h is included instead of include/linux/linkage.h, so define a stub for SYM_FUNC_START() and SYM_FUNC_END(). Signed-off-by: Christophe Leroy --- tools/include/linux/l

[PATCH v2 14/17] selftests: vdso: Make test_vdso_getrandom look for the right vDSO function

2024-08-22 Thread Christophe Leroy
rings. Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_config.h | 8 +++- tools/testing/selftests/vDSO/vdso_test_getrandom.c | 8 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/te

[PATCH v2 13/17] selftests: vdso: Don't hard-code location of vDSO sources

2024-08-22 Thread Christophe Leroy
/vdso arch/loongarch/vdso Don't hard-code vdso sources location in selftest Makefile, instead create a vdso/ symbolic link in tools/arch/$arch/ and update Makefile accordingly. Signed-off-by: Christophe Leroy --- tools/arch/x86/vdso | 1 + tools/testing/selftests

[PATCH v2 12/17] selftests: vdso: Fix powerpc64 vdso_config

2024-08-22 Thread Christophe Leroy
__powerpc__ is also defined on powerpc64 so __powerpc64__ needs to be checked first. Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest") Signed-off-by: Christophe Leroy --- tools/testing/selftests/vDSO/vdso_config.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) di

[PATCH v2 11/17] powerpc/vdso: Wire up getrandom() vDSO implementation

2024-08-22 Thread Christophe Leroy
.088533630 seconds syscall: 250 times in 12.952458068 seconds Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/mman.h | 2 +- arch/powerpc/include/asm/vdso/getrandom.h| 67 + arch/powerpc/includ

[PATCH v2 10/17] powerpc/vdso: Refactor CFLAGS for CVDSO build

2024-08-22 Thread Christophe Leroy
In order to avoid duplication when we add new VDSO functionnalities in C like getrandom, refactor common CFLAGS. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/vdso/Makefile | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kernel/vdso

[PATCH v2 09/17] powerpc/vdso32: Add crtsavres

2024-08-22 Thread Christophe Leroy
ve/restore functions when optimising the kernel for size. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/vdso/Makefile | 5 - arch/powerpc/kernel/vdso/gettimeofday.S | 13 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/vdso/Makefi

[PATCH v2 08/17] powerpc: Add little endian variants of LWZX_BE and STWX_BE

2024-08-22 Thread Christophe Leroy
To support getrandom in VDSO which is based on little endian storage, add macros equivalent to LWZX_BE and STWX_BE for little endian accesses. Put them outside of __powerpc64__ #ifdef so that they can also be used for PPC32. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/asm

[PATCH v2 07/17] mm: Define VM_DROPPABLE for powerpc/32

2024-08-22 Thread Christophe Leroy
_ARCH_1 is used for VM_SAO on powerpc and VM_SAO is only for powerpc/64. Signed-off-by: Christophe Leroy --- fs/proc/task_mmu.c | 4 +++- include/linux/mm.h | 4 +++- include/trace/events/mmflags.h | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git

[PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-22 Thread Christophe Leroy
With the current implementation, __cvdso_getrandom_data() calls memset(), which is unexpected in the VDSO. Rewrite opaque data initialisation to avoid memset(). Signed-off-by: Christophe Leroy --- lib/vdso/getrandom.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff

[PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long

2024-08-22 Thread Christophe Leroy
ation which is already an unsigned long. Signed-off-by: Christophe Leroy --- include/vdso/datapage.h | 2 +- include/vdso/getrandom.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index b85f24cac3f5..00b66a9b5778 100644

[PATCH v2 04/17] vdso: Add missing c-getrandom-y in Makefile

2024-08-22 Thread Christophe Leroy
Same as for gettimeofday CVDSO implementation, add c-getrandom-y to ease the inclusion of lib/vdso/getrandom.c in architectures VDSO builds. Signed-off-by: Christophe Leroy --- lib/vdso/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/vdso/Makefile b/lib/vdso/Makefile index

[PATCH v2 02/17] vdso: Clean header inclusion in getrandom

2024-08-22 Thread Christophe Leroy
, redefine them from CONFIG_PAGE_SHIFT in the same way as commit cffaefd15a8f ("vdso: Use CONFIG_PAGE_SHIFT in vdso/datapage.h") Signed-off-by: Christophe Leroy --- arch/x86/include/asm/pvclock.h | 1 + include/vdso/helpers.h | 1 + lib/vdso/getrandom.c | 15

[PATCH v2 03/17] vdso: Add __arch_get_k_vdso_rng_data()

2024-08-22 Thread Christophe Leroy
clarations as declarations are already in asm/vvar.h Signed-off-by: Christophe Leroy --- v2: Move x86 DEFINE_VVAR(_vdso_data) and DEFINE_VVAR(_vdso_rng_data) in vma.c --- arch/x86/entry/vdso/vma.c| 3 +++ arch/x86/include/asm/vdso/vsyscall.h | 10 +++--- drivers/cha

[PATCH v2 01/17] asm-generic/unaligned.h: Extract common header for vDSO

2024-08-22 Thread Christophe Leroy
vDSO"): Move __get_unaligned_t and __put_unaligned_t into a new unaligned.h living in the vdso/ include directory. Signed-off-by: Christophe Leroy --- include/asm-generic/unaligned.h | 11 +-- include/vdso/unaligned.h| 15 +++ 2 files changed, 16 inserti

[PATCH v2 00/17] Wire up getrandom() vDSO implementation on powerpc

2024-08-22 Thread Christophe Leroy
. But this has no impact and can be clarified later and fixed in a follow-up patch. Changes in v2: - Define VM_DROPPABLE for powerpc/32 - Fixes generic vDSO getrandom headers to enable CONFIG_COMPAT build. - Fixed size of generation counter - Fixed selftests to work on non x86 architectures Chris

Re: [PATCH] selftest/powerpc/benchmark: remove requirement libc-dev

2024-08-08 Thread Christophe Leroy
Le 09/08/2024 à 06:25, Madhavan Srinivasan a écrit : On 8/6/24 12:24 PM, Christophe Leroy wrote: Le 05/08/2024 à 10:30, Madhavan Srinivasan a écrit : Currently exec-target.c file is linked as static and this post a requirement to install libc dev package to build. Without it, build

Re: [PATCH] selftest/powerpc/benchmark: remove requirement libc-dev

2024-08-06 Thread Christophe Leroy
Le 05/08/2024 à 10:30, Madhavan Srinivasan a écrit : Currently exec-target.c file is linked as static and this post a requirement to install libc dev package to build. Without it, build-breaks when compiling selftest/powerpc/benchmark. CC exec_target /usr/bin/ld: cannot find -lc: No

Re: [PATCH] selftest: gpio: remove obsolete gpio-mockup test

2024-03-05 Thread Christophe Leroy
; failure test in the basic set. > > Fixes: 7b61212f2a07 ("gpiolib: Get rid of ARCH_NR_GPIOS") > Reported-by: Pengfei Xu > Reported-by: Yi Lai > Closes: https://lore.kernel.org/linux-gpio/zc6ohbjdwbdt4...@xpf.sh.intel.com/ > Signed-off-by: Kent Gibson Acked-by: Chris