kselftest next update for Linux 6.14-rc1
Subsystems (10)
Shuah Khan
maintainerHi Linus,
Please pull the following kseltest update for Linux 6.14-rc1.
- fixes, reporting improvements, and cleanup changes to several tests
- adds support for DT_GNU_HASH to selftests/vDSO
Note:
Stephen reported conflict between the following two commits and the fix is in the linux-next:
912d6f669725 ("selftests/net: packetdrill: report benign debug flakes as xfail")
from the net-next tree and commit:
279e9403c5bd ("selftests: Warn about skipped tests in result summary")
from the kselftest tree.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 5bc55a333a2f7316b58edc7573e8e893f7acb532:
Linux 6.13-rc7 (2025-01-12 14:37:56 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-next-6.14-rc1
for you to fetch changes up to 336d02bc4c6bec5c3d933e5d470a94970f830957:
selftests/rseq: Fix handling of glibc without rseq support (2025-01-15 10:54:48 -0700)
----------------------------------------------------------------
linux_kselftest-next-6.14-rc1
- fixes, reporting improvements, and cleanup changes to several tests
- adds support for DT_GNU_HASH to selftests/vDSO
----------------------------------------------------------------
Brendan Jackman (1):
selftests/run_kselftest.sh: Fix help string for --per-test-log
Carlos Llamas (1):
selftest: media_tests: fix trivial UAF typo
Dmitry V. Levin (1):
selftests: harness: fix printing of mismatch values in __EXPECT()
Fangrui Song (1):
selftests/vDSO: support DT_GNU_HASH
Geert Uytterhoeven (1):
selftests: timers: clocksource-switch: Adapt progress to kselftest framework
Laura Nao (1):
selftests: Warn about skipped tests in result summary
Li Zhijian (2):
selftests/filesystems: Add missing gitignore file selftests/zram: gitignore output file
Maciej Wieczor-Retman (2):
selftests/resctrl: Adjust effective L3 cache size with SNC enabled selftests/resctrl: Discover SNC kernel support and adjust messages
Masami Hiramatsu (Google) (2):
selftests/ftrace: Fix to use remount when testing mount GID option selftests/ftrace: Make uprobe test more robust against binary name
Mathieu Desnoyers (1):
selftests/rseq: Fix handling of glibc without rseq support
Shivam Chaudhary (3):
selftests: acct: Add ksft_exit_skip if not running as root
selftests: tmpfs: Add Test-skip if not run as root
selftests: tmpfs: Add kselftest support to tmpfs
Stefano Pigozzi (1):
selftests: kselftest: Add ksft_test_result_xpass
Vincent Donnefort (1):
selftests/ring-buffer: Add test for out-of-bound pgoff mapping
zhang jiao (2):
selftests/ipc: Remove unused variables
selftests: kselftest: Fix the wrong format specifier
tools/testing/selftests/acct/acct_syscall.c | 2 +- .../selftests/filesystems/statmount/.gitignore | 1 + .../ftrace/test.d/00basic/mount_options.tc | 8 +- .../ftrace/test.d/dynevent/add_remove_uprobe.tc | 4 +- tools/testing/selftests/ipc/msgque.c | 2 +- tools/testing/selftests/kselftest.h | 28 ++++- tools/testing/selftests/kselftest/ksft.py | 3 + tools/testing/selftests/kselftest/ktap_helpers.sh | 4 + tools/testing/selftests/kselftest_harness.h | 24 ++-- .../selftests/media_tests/regression_test.txt | 8 +- tools/testing/selftests/resctrl/Makefile | 1 + tools/testing/selftests/resctrl/cmt_test.c | 4 +- tools/testing/selftests/resctrl/mba_test.c | 2 + tools/testing/selftests/resctrl/mbm_test.c | 4 +- tools/testing/selftests/resctrl/resctrl.h | 6 + tools/testing/selftests/resctrl/resctrl_tests.c | 9 +- tools/testing/selftests/resctrl/resctrlfs.c | 137 +++++++++++++++++++++ tools/testing/selftests/ring-buffer/map_test.c | 8 +- tools/testing/selftests/rseq/rseq.c | 32 +++-- tools/testing/selftests/rseq/rseq.h | 9 +- tools/testing/selftests/run_kselftest.sh | 2 +- .../testing/selftests/timers/clocksource-switch.c | 6 +- tools/testing/selftests/tmpfs/bug-link-o-tmpfile.c | 41 +++--- tools/testing/selftests/vDSO/parse_vdso.c | 110 ++++++++++++----- tools/testing/selftests/zram/.gitignore | 2 + 25 files changed, 371 insertions(+), 86 deletions(-) create mode 100644 tools/testing/selftests/zram/.gitignore
----------------------------------------------------------------
tools/testing/selftests/acct/acct_syscall.c +1 -1
@@ -24,7 +24,7 @@ int main(void)// Check if test is run a root if (geteuid ()) { -ksft_test_result_skip ("This test needs root to run!\n" ); +ksft_exit_skip ("This test needs root to run!\n" );return 1 ; }
tools/testing/selftests/filesystems/statmount/.gitignore +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only +statmount_test_ns /*_test
tools/testing/selftests/ftrace/test.d/00basic/mount_options.tc +4 -4
@@ -15,11 +15,11 @@ find_alternate_gid() { tac /etc/group | grep -v ":$original_gid:" | head -1 | cut -d: -f3 } -mount_tracefs_with_options() { +remount_tracefs_with_options() { local mount_point="$1" local options="$2" - mount -t tracefs -o "$options" nodev "$mount_point" + mount -t tracefs -o "remount,$options" nodev "$mount_point" setup }
@@ -81,7 +81,7 @@ test_gid_mount_option() { # Unmount existing tracefs instance and mount with new GID unmount_tracefs "$mount_point" - mount_tracefs_with_options "$mount_point" "$new_options" + remount_tracefs_with_options "$mount_point" "$new_options" check_gid "$mount_point" "$other_group"
@@ -92,7 +92,7 @@ test_gid_mount_option() { # Unmount and remount with the original GID unmount_tracefs "$mount_point" - mount_tracefs_with_options "$mount_point" "$mount_options" + remount_tracefs_with_options "$mount_point" "$mount_options" check_gid "$mount_point" "$original_group" }
tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc +3 -1
@@ -6,8 +6,10 @@ echo 0 > events/enable echo > dynamic_events +REALBIN=`readlink -f /bin/sh` + echo 'cat /proc/$$/maps' | /bin/sh | \ - grep "r-xp .*/bin/.*sh$" | \ + grep "r-xp .*${REALBIN}$" | \ awk '{printf "p:myevent %s:0x%s\n", $6,$3 }' >> uprobe_events grep -q myevent uprobe_events
tools/testing/selftests/ipc/msgque.c +1 -1
@@ -194,7 +194,7 @@ int fill_msgque(struct msgque_data *msgque)int main (int argc,char **argv) { -int msg, pid, err; +int err;struct msgque_data msgque;if (getuid () !=0 )
tools/testing/selftests/kselftest.h +26 -2
@@ -18,7 +18,8 @@* ksft_print_msg(fmt, ...); * ksft_perror(msg); * -* and finally report the pass/fail/skip/xfail state of the test with one of: +* and finally report the pass/fail/skip/xfail/xpass state of the test +* with one of: * * ksft_test_result(condition, fmt, ...); * ksft_test_result_report(result, fmt, ...);
@@ -26,6 +27,7 @@* ksft_test_result_fail(fmt, ...); * ksft_test_result_skip(fmt, ...); * ksft_test_result_xfail(fmt, ...); +* ksft_test_result_xpass(fmt, ...); * ksft_test_result_error(fmt, ...); * ksft_test_result_code(exit_code, test_name, fmt, ...); *
@@ -147,6 +149,11 @@ static inline void ksft_set_plan(unsigned int plan)static inline void ksft_print_cnts (void ) { +if (ksft_cnt.ksft_xskip >0 ) +printf ( +"# %u skipped test(s) detected. Consider enabling relevant config options to improve coverage.\n" , + ksft_cnt.ksft_xskip + );if (ksft_plan !=ksft_test_num ())printf ("# Planned tests != run tests (%u != %u)\n" , ksft_plan,ksft_test_num ());
@@ -227,6 +234,20 @@ static inline __printf(1, 2) void ksft_test_result_xfail(const char *msg, ...)va_end (args); } +static inline __printf(1, 2) void ksft_test_result_xpass(const char *msg, ...) +{ + int saved_errno = errno; +va_list args; + + ksft_cnt.ksft_xpass++; + +va_start (args, msg); +printf ("ok %u # XPASS " ,ksft_test_num ()); + errno = saved_errno; +vprintf (msg, args); +va_end (args); +} + static inline __printf(1, 2) void ksft_test_result_skip(const char *msg, ...) { int saved_errno = errno;
@@ -318,6 +339,9 @@ void ksft_test_result_code(int exit_code, const char *test_name,case KSFT_XFAIL : \ ksft_test_result_xfail(fmt, ##__VA_ARGS__); \break ; \ +case KSFT_XPASS : \ + ksft_test_result_xpass(fmt, ##__VA_ARGS__); \ +break ; \case KSFT_SKIP : \ ksft_test_result_skip(fmt, ##__VA_ARGS__); \break ; \
@@ -403,7 +427,7 @@ static inline __noreturn __printf(1, 2) void ksft_exit_skip(const char *msg, ...*/ if (ksft_plan ||ksft_test_num ()) { ksft_cnt.ksft_xskip++; -printf ("ok %d # SKIP " ,1 +ksft_test_num ()); +printf ("ok %u # SKIP " ,1 +ksft_test_num ()); }else {printf ("1..0 # SKIP " ); }
tools/testing/selftests/kselftest/ksft.py +3 -0
@@ -27,6 +27,9 @@ def set_plan(num_tests): def print_cnts(): + if ksft_cnt['skip'] > 0: + print(f"# {ksft_cnt['skip']} skipped test(s) detected. Consider enabling relevant config options to improve coverage.") + print( f"# Totals: pass:{ksft_cnt['pass']} fail:{ksft_cnt['fail']} xfail:0 xpass:0 skip:{ksft_cnt['skip']} error:0" )
tools/testing/selftests/kselftest/ktap_helpers.sh +4 -0
@@ -107,5 +107,9 @@ ktap_finished() { } ktap_print_totals() { + if [ "$KTAP_CNT_SKIP" -gt 0 ]; then + echo "# $KTAP_CNT_SKIP skipped test(s) detected. " \ + "Consider enabling relevant config options to improve coverage." + fi echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0" }
tools/testing/selftests/kselftest_harness.h +12 -12
@@ -760,33 +760,33 @@/* Report with actual signedness to avoid weird output. */ \switch (is_signed_type (__exp) *2 +is_signed_type (__seen)) { \case 0 : { \ -unsigned long long __exp_print = (uintptr_t )__exp; \ -unsigned long long __seen_print = (uintptr_t )__seen; \ -__TH_LOG ("Expected %s (%llu) %s %s (%llu)" , \ +uintmax_t __exp_print = (uintmax_t )__exp; \ +uintmax_t __seen_print = (uintmax_t )__seen; \ +__TH_LOG ("Expected %s (%ju) %s %s (%ju)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 1 : { \ -unsigned long long __exp_print = (uintptr_t )__exp; \ -long long __seen_print = (intptr_t )__seen; \ -__TH_LOG ("Expected %s (%llu) %s %s (%lld)" , \ +uintmax_t __exp_print = (uintmax_t )__exp; \ +intmax_t __seen_print = (intmax_t )__seen; \ +__TH_LOG ("Expected %s (%ju) %s %s (%jd)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 2 : { \ -long long __exp_print = (intptr_t )__exp; \ -unsigned long long __seen_print = (uintptr_t )__seen; \ -__TH_LOG ("Expected %s (%lld) %s %s (%llu)" , \ +intmax_t __exp_print = (intmax_t )__exp; \ +uintmax_t __seen_print = (uintmax_t )__seen; \ +__TH_LOG ("Expected %s (%jd) %s %s (%ju)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 3 : { \ -long long __exp_print = (intptr_t )__exp; \ -long long __seen_print = (intptr_t )__seen; \ -__TH_LOG ("Expected %s (%lld) %s %s (%lld)" , \ +intmax_t __exp_print = (intmax_t )__exp; \ +intmax_t __seen_print = (intmax_t )__seen; \ +__TH_LOG ("Expected %s (%jd) %s %s (%jd)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \
tools/testing/selftests/media_tests/regression_test.txt +4 -4
@@ -1,5 +1,5 @@ Testing for regressions in Media Controller API register, ioctl, syscall, -and unregister paths. There have a few problems that result in user-after +and unregister paths. There have a few problems that result in use-after free on media_device, media_devnode, and cdev pointers when the driver is unbound while ioctl is in progress.
@@ -15,11 +15,11 @@ Build media_device_test cd tools/testing/selftests/media_tests make -Regressions test for cdev user-after free error on /dev/mediaX when driver +Regressions test for cdev use-after-free error on /dev/mediaX when driver is unbound: Start media_device_test to regression test media devnode dynamic alloc -and cdev user-after-free fixes. This opens media dev files and sits in +and cdev use-after-free fixes. This opens media dev files and sits in a loop running media ioctl MEDIA_IOC_DEVICE_INFO command once every 10 seconds. The idea is when device file goes away, media devnode and cdev should stick around until this test exits.
@@ -40,4 +40,4 @@ keep ioctls going while bind/unbind runs. Copy bind_unbind_sample.txt and make changes to specify the driver name and number to run bind and unbind. Start the bind_unbind.sh -Run dmesg looking for any user-after free errors or mutex lock errors. +Run dmesg looking for any use-after-free errors or mutex lock errors.
tools/testing/selftests/resctrl/Makefile +1 -0
@@ -8,5 +8,6 @@ TEST_GEN_PROGS := resctrl_tests LOCAL_HDRS += $(wildcard *.h) include ../lib.mk +CFLAGS += -I$(top_srcdir)/tools/include $(OUTPUT)/resctrl_tests: $(wildcard *.c)
tools/testing/selftests/resctrl/cmt_test.c +2 -2
@@ -169,8 +169,8 @@ static int cmt_run_test(const struct resctrl_test *test, const struct user_paramreturn ret; ret =check_results (¶m, span, n); -if (ret && (get_vendor () ==ARCH_INTEL )) -ksft_print_msg ("Intel CMT may be inaccurate when Sub-NUMA Clustering is enabled. Check BIOS configuration.\n" ); +if (ret && (get_vendor () ==ARCH_INTEL ) && !snc_kernel_support ()) +ksft_print_msg ("Kernel doesn't support Sub-NUMA Clustering but it is enabled on the system.\n" );return ret; }
tools/testing/selftests/resctrl/mba_test.c +2 -0
@@ -201,6 +201,8 @@ static int mba_run_test(const struct resctrl_test *test, const struct user_paramreturn ret; ret =check_results (); +if (ret && (get_vendor () ==ARCH_INTEL ) && !snc_kernel_support ()) +ksft_print_msg ("Kernel doesn't support Sub-NUMA Clustering but it is enabled on the system.\n" );return ret; }
tools/testing/selftests/resctrl/mbm_test.c +2 -2
@@ -160,8 +160,8 @@ static int mbm_run_test(const struct resctrl_test *test, const struct user_paramreturn ret; ret =check_results (param.fill_buf ? param.fill_buf->buf_size :0 ); -if (ret && (get_vendor () ==ARCH_INTEL )) -ksft_print_msg ("Intel MBM may be inaccurate when Sub-NUMA Clustering is enabled. Check BIOS configuration.\n" ); +if (ret && (get_vendor () ==ARCH_INTEL ) && !snc_kernel_support ()) +ksft_print_msg ("Kernel doesn't support Sub-NUMA Clustering but it is enabled on the system.\n" );return ret; }
tools/testing/selftests/resctrl/resctrl.h +6 -0
@@ -11,6 +11,7 @@#include <signal.h> #include <dirent.h> #include <stdbool.h> +#include <ctype.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/mount.h>
@@ -21,6 +22,7 @@#include <sys/eventfd.h> #include <asm/unistd.h> #include <linux/perf_event.h> +#include <linux/compiler.h> #include "../kselftest.h" #define MB (1024 * 1024)
@@ -156,8 +158,11 @@ struct perf_event_read {*/ extern volatile int *value_sink; +extern int snc_unreliable; +extern char llc_occup_path[1024 ]; +int snc_nodes_per_l3_cache (void );int get_vendor (void );bool check_resctrlfs_support (void );int filter_dmesg (void );
@@ -198,6 +203,7 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr);int signal_handler_register (const struct resctrl_test *test);void signal_handler_unregister (void );unsigned int count_bits (unsigned long n); +int snc_kernel_support (void );void perf_event_attr_initialize (struct perf_event_attr *pea,__u64 config);void perf_event_initialize_read_format (struct perf_event_read *pe_read);
tools/testing/selftests/resctrl/resctrl_tests.c +8 -1
@@ -118,7 +118,7 @@ static bool test_vendor_specific_check(const struct resctrl_test *test)static void run_single_test (const struct resctrl_test *test,const struct user_params *uparams) { -int ret; +int ret, snc_mode;if (test->disabled)return ;
@@ -128,8 +128,15 @@ static void run_single_test(const struct resctrl_test *test, const struct user_preturn ; } + snc_mode =snc_nodes_per_l3_cache (); +ksft_print_msg ("Starting %s test ...\n" , test->name); +if (snc_mode ==1 && snc_unreliable &&get_vendor () ==ARCH_INTEL ) { +ksft_test_result_skip ("SNC detection unreliable due to offline CPUs. Test results may not be accurate if SNC enabled.\n" ); +return ; + } +if (test_prepare (test)) {ksft_exit_fail_msg ("Abnormal failure when preparing for the test\n" );return ;
tools/testing/selftests/resctrl/resctrlfs.c +137 -0
158 lines not on this page · raw message
tools/testing/selftests/ring-buffer/map_test.c +7 -1
@@ -233,12 +233,18 @@ TEST_F(map, data_mmap)ASSERT_NE (data,MAP_FAILED );munmap (data, data_len); -/* Overflow the available subbufs by 1 */ +/* Offset within ring-buffer bounds, mapping size overflow */ meta_len += desc->meta->subbuf_size *2 ; data =mmap (NULL , data_len,PROT_READ ,MAP_SHARED , desc->cpu_fd, meta_len);ASSERT_EQ (data,MAP_FAILED ); +/* Offset outside ring-buffer bounds */ + data_len = desc->meta->subbuf_size * desc->meta->nr_subbufs; + data =mmap (NULL , data_len,PROT_READ ,MAP_SHARED , + desc->cpu_fd, data_len + (desc->meta->subbuf_size *2 )); +ASSERT_EQ (data,MAP_FAILED ); +/* Verify meta-page padding */ if (desc->meta->meta_page_size >getpagesize ()) { data_len = desc->meta->meta_page_size;
tools/testing/selftests/rseq/rseq.c +25 -7
@@ -61,7 +61,6 @@ unsigned int rseq_size = -1U;unsigned int rseq_flags;static int rseq_ownership; -static int rseq_reg_success;/* At least one rseq registration has succeded. */ /* Allocate a large area for the TLS. */ #define RSEQ_THREAD_AREA_ALLOC_SIZE 1024
@@ -152,14 +151,27 @@ int rseq_register_current_thread(void) } rc =sys_rseq (&__rseq_abi,get_rseq_min_alloc_size (),0 ,RSEQ_SIG );if (rc) { -if (RSEQ_READ_ONCE (rseq_reg_success)) { +/* +* After at least one thread has registered successfully +* (rseq_size > 0), the registration of other threads should +* never fail. +*/ +if (RSEQ_READ_ONCE (rseq_size) >0 ) {/* Incoherent success/failure within process. */ abort (); }return -1 ; }assert (rseq_current_cpu_raw () >=0 ); -RSEQ_WRITE_ONCE (rseq_reg_success,1 ); + +/* +* The first thread to register sets the rseq_size to mimic the libc +* behavior. +*/ +if (RSEQ_READ_ONCE (rseq_size) ==0 ) { +RSEQ_WRITE_ONCE (rseq_size,get_rseq_kernel_feature_size ()); + } +return 0 ; }
@@ -235,12 +247,18 @@ void rseq_init(void)return ; } rseq_ownership =1 ; -if (!rseq_available ()) { - rseq_size =0 ; -return ; - } + +/* Calculate the offset of the rseq area from the thread pointer. */ rseq_offset = (void *)&__rseq_abi -rseq_thread_pointer (); + +/* rseq flags are deprecated, always set to 0. */ rseq_flags =0 ; + +/* +* Set the size to 0 until at least one thread registers to mimic the +* libc behavior. +*/ + rseq_size =0 ; } static __attribute__((destructor))
tools/testing/selftests/rseq/rseq.h +8 -1
@@ -60,7 +60,14 @@extern ptrdiff_t rseq_offset;/* -* Size of the registered rseq area. 0 if the registration was +* The rseq ABI is composed of extensible feature fields. The extensions +* are done by appending additional fields at the end of the structure. +* The rseq_size defines the size of the active feature set which can be +* used by the application for the current rseq registration. Features +* starting at offset >= rseq_size are inactive and should not be used. +* +* The rseq_size is the intersection between the available allocation +* size for the rseq area and the feature size supported by the kernel. * unsuccessful. */ extern unsigned int rseq_size;
tools/testing/selftests/run_kselftest.sh +1 -1
@@ -21,7 +21,7 @@ usage() cat <<EOF Usage: $0 [OPTIONS] -s | --summary Print summary with detailed log in output.log (conflict with -p) - -p | --per_test_log Print test log in /tmp with each test name (conflict with -s) + -p | --per-test-log Print test log in /tmp with each test name (conflict with -s) -t | --test COLLECTION:TEST Run TEST from COLLECTION -c | --collection COLLECTION Run all tests from COLLECTION -l | --list List the available collection:test entries
tools/testing/selftests/timers/clocksource-switch.c +3 -3
@@ -156,8 +156,8 @@ int main(int argc, char **argv)/* Check everything is sane before we start switching asynchronously */ if (do_sanity_check) {for (i =0 ; i < count; i++) { -printf ("Validating clocksource %s\n" , - clocksource_list[i]); +ksft_print_msg ("Validating clocksource %s\n" , + clocksource_list[i]);if (change_clocksource (clocksource_list[i])) { status =-1 ; goto out;
@@ -169,7 +169,7 @@ int main(int argc, char **argv) } } -printf ("Running Asynchronous Switching Tests...\n" ); +ksft_print_msg ("Running Asynchronous Switching Tests...\n" ); pid =fork ();if (!pid)return run_tests (runtime);
tools/testing/selftests/tmpfs/bug-link-o-tmpfile.c +26 -15
71 lines not on this page · raw message
tools/testing/selftests/vDSO/parse_vdso.c +82 -28
158 lines not on this page · raw message
tools/testing/selftests/zram/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +err.log
The pull request you sent on Tue, 21 Jan 2025 13:56:32 -0700:
The pull request you sent on Tue, 21 Jan 2025 13:56:32 -0700:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftesttags/linux_kselftest-next-6.14-rc1
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/8fb1e2eed14dc347e1d04b8bf0bf52c606de6da1
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html