Kselftest fixes update for Linux 6.12-rc3
Subsystems (4)
Shuah Khan
maintainerHi Linus,
Please pull this kselftest fixes update for Linux 6.12-rc3.
This kselftest update for Linux 6.12-rc3 consists of several fixes for build, run-time errors, and reporting errors:
-- ftrace: regression test for a kernel crash when running function graph
tracing and then enabling function profiler.
-- rseq: fix for mm_cid test failure.
-- vDSO:
- fixes to reporting skip and other error conditions.
- changes to unconditionally build chacha and getrandom tests on all architectures to make it easier for them to run in CIs.
- build error when sched.h to bring in CLONE_NEWTIME define.
diff is attached.
Note: Had to fix a commit message last minute on rseq patch right before generating the pull request. The last 2 patches have been in my tree longer than just a few hours. :)
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit c66be905cda24fb782b91053b196bd2e966f95b7:
selftests: breakpoints: use remaining time to check if suspend succeed (2024-10-02 14:37:30 -0600)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-fixes-6.12-rc3
for you to fetch changes up to 4ee5ca9a29384fcf3f18232fdf8474166dea8dca:
ftrace/selftest: Test combination of function_graph tracer and function profiler (2024-10-11 15:05:16 -0600)
----------------------------------------------------------------
linux_kselftest-fixes-6.12-rc3
This kselftest update for Linux 6.12-rc3 consists of several fixes for build, run-time errors, and reporting errors:
-- ftrace: regression test for a kernel crash when running function graph
tracing and then enabling function profiler.
-- rseq: fix for mm_cid test failure.
-- vDSO:
- fixes to reporting skip and other error conditions.
- changes unconditionally build chacha and getrandom tests on all architectures to make it easier for them to run in CIs.
- build error when sched.h to bring in CLONE_NEWTIME define.
----------------------------------------------------------------
Jason A. Donenfeld (3):
selftests: vDSO: unconditionally build chacha test
selftests: vDSO: unconditionally build getrandom test
selftests: vDSO: improve getrandom and chacha error messages
Mathieu Desnoyers (1):
selftests/rseq: Fix mm_cid test failure
Steven Rostedt (1):
ftrace/selftest: Test combination of function_graph tracer and function profiler
Yu Liao (1):
selftests: vDSO: Explicitly include sched.h
tools/arch/arm64/vdso | 1 - tools/arch/loongarch/vdso | 1 - tools/arch/powerpc/vdso | 1 - tools/arch/s390/vdso | 1 - tools/arch/x86/vdso | 1 - .../ftrace/test.d/ftrace/fgraph-profiler.tc | 31 ++++++ tools/testing/selftests/rseq/rseq.c | 110 ++++++++++++++------- tools/testing/selftests/rseq/rseq.h | 10 +- tools/testing/selftests/vDSO/Makefile | 6 +- tools/testing/selftests/vDSO/vdso_test_chacha.c | 36 ++++--- tools/testing/selftests/vDSO/vdso_test_getrandom.c | 76 +++++++------- tools/testing/selftests/vDSO/vgetrandom-chacha.S | 18 ++++ 12 files changed, 183 insertions(+), 109 deletions(-) delete mode 120000 tools/arch/arm64/vdso delete mode 120000 tools/arch/loongarch/vdso delete mode 120000 tools/arch/powerpc/vdso delete mode 120000 tools/arch/s390/vdso delete mode 120000 tools/arch/x86/vdso create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc create mode 100644 tools/testing/selftests/vDSO/vgetrandom-chacha.S
----------------------------------------------------------------
tools/arch/arm64/vdso deleted +0 -1
@@ -1 +0,0 @@ -../../../arch/arm64/kernel/vdso
tools/arch/loongarch/vdso deleted +0 -1
@@ -1 +0,0 @@ -../../../arch/loongarch/vdso
tools/arch/powerpc/vdso deleted +0 -1
@@ -1 +0,0 @@ -../../../arch/powerpc/kernel/vdso
tools/arch/s390/vdso deleted +0 -1
@@ -1 +0,0 @@ -../../../arch/s390/kernel/vdso64
tools/arch/x86/vdso deleted +0 -1
@@ -1 +0,0 @@ -../../../arch/x86/entry/vdso/
tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc new file +31 -0
@@ -0,0 +1,31 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: ftrace - function profiler with function graph tracing +# requires: function_profile_enabled set_ftrace_filter function_graph:tracer + +# The function graph tracer can now be run along side of the function +# profiler. But there was a bug that caused the combination of the two +# to crash. It also required the function graph tracer to be started +# first. +# +# This test triggers that bug +# +# We need both function_graph and profiling to run this test + +fail() { # mesg + echo $1 + exit_fail +} + +echo "Enabling function graph tracer:" +echo function_graph > current_tracer +echo "enable profiler" + +# Older kernels do not allow function_profile to be enabled with +# function graph tracer. If the below fails, mark it as unsupported +echo 1 > function_profile_enabled || exit_unsupported + +# Let it run for a bit to make sure nothing explodes +sleep 1 + +exit 0
tools/testing/selftests/rseq/rseq.c +75 -35
163 lines not on this page · raw message
tools/testing/selftests/rseq/rseq.h +2 -8
@@ -68,12 +68,6 @@ extern unsigned int rseq_size;/* Flags used during rseq registration. */ extern unsigned int rseq_flags; -/* -* rseq feature size supported by the kernel. 0 if the registration was -* unsuccessful. -*/ -extern unsigned int rseq_feature_size; -enum rseq_mo {RSEQ_MO_RELAXED =0 ,RSEQ_MO_CONSUME =1 ,/* Unused */
@@ -193,7 +187,7 @@ static inline uint32_t rseq_current_cpu(void)static inline bool rseq_node_id_available (void ) { - return (int) rseq_feature_size >= rseq_offsetofend(struct rseq_abi, node_id); + return (int) rseq_size >= rseq_offsetofend(struct rseq_abi, node_id); }/*
@@ -207,7 +201,7 @@ static inline uint32_t rseq_current_node_id(void)static inline bool rseq_mm_cid_available (void ) { - return (int) rseq_feature_size >= rseq_offsetofend(struct rseq_abi, mm_cid); + return (int) rseq_size >= rseq_offsetofend(struct rseq_abi, mm_cid); }static inline uint32_t rseq_current_mm_cid (void )
tools/testing/selftests/vDSO/Makefile +2 -4
@@ -9,10 +9,8 @@ ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64)) TEST_GEN_PROGS += vdso_standalone_test_x86 endif TEST_GEN_PROGS += vdso_test_correctness -ifeq ($(ARCH)$(CONFIG_X86_32),$(filter $(ARCH)$(CONFIG_X86_32),x86 x86_64 loongarch arm64 powerpc s390)) TEST_GEN_PROGS += vdso_test_getrandom TEST_GEN_PROGS += vdso_test_chacha -endif CFLAGS := -std=gnu99 -O2
@@ -37,9 +35,9 @@ $(OUTPUT)/vdso_test_getrandom: CFLAGS += -isystem $(top_srcdir)/tools/include \ $(KHDR_INCLUDES) \ -isystem $(top_srcdir)/include/uapi -$(OUTPUT)/vdso_test_chacha: $(top_srcdir)/tools/arch/$(SRCARCH)/vdso/vgetrandom-chacha.S +$(OUTPUT)/vdso_test_chacha: vgetrandom-chacha.S $(OUTPUT)/vdso_test_chacha: CFLAGS += -idirafter $(top_srcdir)/tools/include \ -idirafter $(top_srcdir)/tools/include/generated \ -idirafter $(top_srcdir)/arch/$(SRCARCH)/include \ -idirafter $(top_srcdir)/include \ - -D__ASSEMBLY__ -Wa,--noexecstack + -Wa,--noexecstack
tools/testing/selftests/vDSO/vdso_test_chacha.c +21 -15
@@ -3,6 +3,7 @@* Copyright (C) 2022-2024 Jason A. Donenfeld <[email protected]>. All Rights Reserved. */ +#include <linux/compiler.h> #include <tools/le_byteshift.h> #include <sys/random.h> #include <sys/auxv.h>
@@ -73,10 +74,10 @@ static void reference_chacha20_blocks(uint8_t *dst_bytes, const uint32_t *key, u counter[1 ] = s[13 ]; } -typedef uint8_t u8 ; -typedef uint32_t u32 ; -typedef uint64_t u64 ; -#include <vdso/getrandom.h> +void __weak __arch_chacha20_blocks_nostack (uint8_t *dst_bytes,const uint32_t *key,uint32_t *counter,size_t nblocks) +{ +ksft_exit_skip ("Not implemented on architecture\n" ); +}int main (int argc,char *argv[]) {
@@ -90,10 +91,8 @@ int main(int argc, char *argv[])ksft_set_plan (1 );for (unsigned int trial =0 ; trial <TRIALS ; ++trial) { -if (getrandom (key,sizeof (key),0 ) !=sizeof (key)) { -printf ("getrandom() failed!\n" ); -return KSFT_SKIP ; - } +if (getrandom (key,sizeof (key),0 ) !=sizeof (key)) +ksft_exit_skip ("getrandom() failed unexpectedly\n" );memset (counter1,0 ,sizeof (counter1));reference_chacha20_blocks (output1, key, counter1,BLOCKS );for (unsigned int split =0 ; split <BLOCKS ; ++split) {
@@ -102,8 +101,10 @@ int main(int argc, char *argv[])if (split)__arch_chacha20_blocks_nostack (output2, key, counter2, split);__arch_chacha20_blocks_nostack (output2 + split *BLOCK_SIZE , key, counter2,BLOCKS - split); -if (memcmp (output1, output2,sizeof (output1)) ||memcmp (counter1, counter2,sizeof (counter1))) -return KSFT_FAIL ; +if (memcmp (output1, output2,sizeof (output1))) +ksft_exit_fail_msg ("Main loop outputs do not match on trial %u, split %u\n" , trial, split); +if (memcmp (counter1, counter2,sizeof (counter1))) +ksft_exit_fail_msg ("Main loop counters do not match on trial %u, split %u\n" , trial, split); } }memset (counter1,0 ,sizeof (counter1));
@@ -113,14 +114,19 @@ int main(int argc, char *argv[])reference_chacha20_blocks (output1, key, counter1,BLOCKS );__arch_chacha20_blocks_nostack (output2, key, counter2,BLOCKS ); -if (memcmp (output1, output2,sizeof (output1)) ||memcmp (counter1, counter2,sizeof (counter1))) -return KSFT_FAIL ; +if (memcmp (output1, output2,sizeof (output1))) +ksft_exit_fail_msg ("Block limit outputs do not match after first round\n" ); +if (memcmp (counter1, counter2,sizeof (counter1))) +ksft_exit_fail_msg ("Block limit counters do not match after first round\n" );reference_chacha20_blocks (output1, key, counter1,BLOCKS );__arch_chacha20_blocks_nostack (output2, key, counter2,BLOCKS ); -if (memcmp (output1, output2,sizeof (output1)) ||memcmp (counter1, counter2,sizeof (counter1))) -return KSFT_FAIL ; +if (memcmp (output1, output2,sizeof (output1))) +ksft_exit_fail_msg ("Block limit outputs do not match after second round\n" ); +if (memcmp (counter1, counter2,sizeof (counter1))) +ksft_exit_fail_msg ("Block limit counters do not match after second round\n" );ksft_test_result_pass ("chacha: PASS\n" ); -return KSFT_PASS ; +ksft_exit_pass (); +return 0 ; }
tools/testing/selftests/vDSO/vdso_test_getrandom.c +34 -42
172 lines not on this page · raw message
tools/testing/selftests/vDSO/vgetrandom-chacha.S new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2024 Jason A. Donenfeld <[email protected]>. All Rights Reserved. + */ + +#define __ASSEMBLY__ + +#if defined(__aarch64__) +#include "../../../../arch/arm64/kernel/vdso/vgetrandom-chacha.S" +#elif defined(__loongarch__) +#include "../../../../arch/loongarch/vdso/vgetrandom-chacha.S" +#elif defined(__powerpc__) || defined(__powerpc64__) +#include "../../../../arch/powerpc/kernel/vdso/vgetrandom-chacha.S" +#elif defined(__s390x__) +#include "../../../../arch/s390/kernel/vdso64/vgetrandom-chacha.S" +#elif defined(__x86_64__) +#include "../../../../arch/x86/entry/vdso/vgetrandom-chacha.S" +#endif
The pull request you sent on Fri, 11 Oct 2024 16:09:09 -0600:
The pull request you sent on Fri, 11 Oct 2024 16:09:09 -0600:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftesttags/linux_kselftest-fixes-6.12-rc3
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/09f6b0c8904bfaa1e0601bc102e1b6aa6de8c98f
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html