Recently, I reviewed a patch on the mm/kselftest mailing list about a
test which had obvious type mismatch fix in it. It was strange why that
wasn't caught during development and when patch was accepted. This led
me to discover that those extra compiler options to catch these warnings
aren't being used. When I added them, I found tens of warnings in just
mm suite.
In this series, I'm adding these flags and fixing those warnings. In the
last try several months ago [1], I'd patches for individual tests. I've
made patches better by grouping the same type of fixes together. Hence
there is no changelog for individual patches.
The changes have been build tested on x86_64, arm64, powerpc64 and
partially
on riscv64. The test run with and without this series has been done on
x86_64.
---
Changes since v1:
- Drop test harness patch which isn't needed anymore
- Revamp how patches are written per same kind of failure
Changes since v2:
- split_huge_page_test.c: better deadcode removal
- Drop -Wunused-parameter flag as kernel also doesn't enable it and it
causes too much hassle
- Drop previous patches 6 and 7 as they are just marking unused parameters
with unused flag
- Rename __unused to __always_unused and also add __maybe_unused
Muhammad Usama Anjum (8):
selftests/mm: Add -Wunreachable-code and fix warnings
selftests/mm: protection_keys: Fix dead code
selftests: kselftest.h: Add unused macro
selftests/mm: Add -Wunused family of flags
selftests/mm: Remove unused parameters
selftests/mm: Fix unused parameter warnings for different
architectures
selftests/mm: mark variable unused with macro
selftests/mm: pkey-helpers: Remove duplicate __maybe_unused
tools/testing/selftests/kselftest.h | 8 ++++++
tools/testing/selftests/mm/Makefile | 2 +-
tools/testing/selftests/mm/compaction_test.c | 2 +-
tools/testing/selftests/mm/cow.c | 2 +-
tools/testing/selftests/mm/droppable.c | 2 +-
tools/testing/selftests/mm/gup_longterm.c | 2 +-
tools/testing/selftests/mm/hmm-tests.c | 5 ++--
tools/testing/selftests/mm/hugepage-vmemmap.c | 2 +-
tools/testing/selftests/mm/hugetlb-madvise.c | 2 +-
.../selftests/mm/hugetlb-soft-offline.c | 2 +-
tools/testing/selftests/mm/ksm_tests.c | 17 ++++++-------
tools/testing/selftests/mm/madv_populate.c | 2 +-
tools/testing/selftests/mm/map_populate.c | 2 +-
tools/testing/selftests/mm/memfd_secret.c | 2 +-
.../testing/selftests/mm/mlock-random-test.c | 2 +-
tools/testing/selftests/mm/mlock2-tests.c | 2 +-
tools/testing/selftests/mm/mseal_test.c | 8 ++++--
tools/testing/selftests/mm/on-fault-limit.c | 2 +-
tools/testing/selftests/mm/pkey-helpers.h | 3 ---
.../selftests/mm/pkey_sighandler_tests.c | 25 +++++++++++++++----
tools/testing/selftests/mm/protection_keys.c | 6 ++---
tools/testing/selftests/mm/soft-dirty.c | 6 ++---
.../selftests/mm/split_huge_page_test.c | 2 +-
tools/testing/selftests/mm/uffd-common.c | 4 +--
tools/testing/selftests/mm/uffd-common.h | 2 +-
tools/testing/selftests/mm/uffd-stress.c | 2 +-
tools/testing/selftests/mm/uffd-unit-tests.c | 8 +++---
tools/testing/selftests/mm/uffd-wp-mremap.c | 2 +-
.../selftests/mm/virtual_address_range.c | 2 +-
29 files changed, 73 insertions(+), 55 deletions(-)
--
2.47.2
Fix a typo in the signal alternate stack test where the error
message incorrectly used tss_flags instead of the correct field
name ss_flags.
This change ensures the test output accurately reflects the
structure member being checked.
Signed-off-by: Alok Tiwari <alok.a.tiwari(a)oracle.com>
---
tools/testing/selftests/signal/sas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/signal/sas.c b/tools/testing/selftests/signal/sas.c
index 07227fab1cc98..476ffa807a61e 100644
--- a/tools/testing/selftests/signal/sas.c
+++ b/tools/testing/selftests/signal/sas.c
@@ -64,7 +64,7 @@ void my_usr1(int sig, siginfo_t *si, void *u)
exit(EXIT_FAILURE);
}
if (stk.ss_flags != SS_DISABLE)
- ksft_test_result_fail("tss_flags=%x, should be SS_DISABLE\n",
+ ksft_test_result_fail("ss_flags=%x, should be SS_DISABLE\n",
stk.ss_flags);
else
ksft_test_result_pass(
--
2.50.1
Hi,
This patch improves portability of the rtnetlink selftests in two ways:
1. It wraps a call to ifconfig in a presence check to avoid test failures
on systems where ifconfig is not installed — such as default Debian Bookworm
and newer distributions where iproute2 is the norm.
2. It skips the do_test_address_proto test if the installed version of iproute2
does not support the proto in ip address commands. Without this check,
the test fails unconditionally on older iproute2 versions, even though the kernel
functionality under test is not the culprit.
Both changes ensure that the test suite degrades gracefully by reporting SKIP
instead of FAIL on incompatible systems.
Tested on Debian Bookworm with iproute2 6.1.0 and without ifconfig.
Thanks for your time and consideration.
Best regards,
Alessandro Ratti
Hi,
Please provide a quote for your products:
Include:
1.Pricing (per unit)
2.Delivery cost & timeline
3.Quote expiry date
Deadline: September
Thanks!
Kamal Prasad
Albinayah Trading
Replace ambiguous language in comments and test descriptions to improve
code readability and make test intentions clearer.
Changes made:
- Make TODO comment more specific about 64-bit vs 32-bit argument
handling test requirements
- Clarify comment about task termination during syscall execution
- Replace vague "bad recv()" with specific "invalid recv() with NULL parameter"
- Replace informal "bad flags" with "invalid flags" for consistency
These improvements help maintainers and contributors better understand
the expected test behavior.
Signed-off-by: Ayash Bera <ayashbera(a)gmail.com>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 61acbd45ffaa..bded07f86a54 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -933,7 +933,7 @@ TEST(KILL_unknown)
ASSERT_EQ(SIGSYS, WTERMSIG(status));
}
-/* TODO(wad) add 64-bit versus 32-bit arg tests. */
+/* TODO(wad) add tests for 64-bit versus 32-bit argument handling differences. */
TEST(arg_out_of_range)
{
struct sock_filter filter[] = {
@@ -3514,7 +3514,7 @@ TEST(user_notification_kill_in_middle)
ASSERT_GE(listener, 0);
/*
- * Check that nothing bad happens when we kill the task in the middle
+ * Check that killing the task in the middle of a syscall does not cause crashes or hangs when we kill the task in the middle
* of a syscall.
*/
pid = fork();
@@ -3798,7 +3798,7 @@ TEST(user_notification_fault_recv)
if (pid == 0)
exit(syscall(__NR_getppid) != USER_NOTIF_MAGIC);
- /* Do a bad recv() */
+ /* Test invalid recv() with NULL parameter */
EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, NULL), -1);
EXPECT_EQ(errno, EFAULT);
@@ -4169,13 +4169,13 @@ TEST(user_notification_addfd)
addfd.id = req.id;
addfd.flags = 0x0;
- /* Verify bad newfd_flags cannot be set */
+ /* Verify invalid newfd_flags cannot be set */
addfd.newfd_flags = ~O_CLOEXEC;
EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, &addfd), -1);
EXPECT_EQ(errno, EINVAL);
addfd.newfd_flags = O_CLOEXEC;
- /* Verify bad flags cannot be set */
+ /* Verify invalid flags cannot be set */
addfd.flags = 0xff;
EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, &addfd), -1);
EXPECT_EQ(errno, EINVAL);
--
2.50.1
Hello,
The cgroup v2 freezer controller is useful for freezing background
applications so they don't contend with foreground tasks. However, this
may disrupt any internal monitoring that the application is performing,
as it may not be aware that it was frozen.
To illustrate, an application might implement a watchdog thread to
monitor a high-priority task by periodically checking its state to
ensure progress. The challenge is that the task only advances when the
application is running, but watchdog timers are set relative to system
time, not app time. If the app is frozen and misses the expected
deadline, the watchdog, unaware of this pause, may kill a healthy
process.
This series tracks the time that each cgroup spends "freezing" and
exposes it via cgroup.stat.local. Include several basic selftests to
demonstrate the expected behavior of this interface, including that:
1. Freeze time will increase while a cgroup is freezing, regardless of
whether it is frozen or not.
2. Each cgroup's freeze time is independent from the other cgroups in
its hierarchy.
Thanks,
Tiffany
Signed-off-by: Tiffany Yang <ynaffit(a)google.com>
---
v3: https://lore.kernel.org/all/20250805032940.3587891-4-ynaffit@google.com/
v2: https://lore.kernel.org/lkml/20250714050008.2167786-2-ynaffit@google.com/
v1: https://lore.kernel.org/lkml/20250603224304.3198729-3-ynaffit@google.com/
Cc: John Stultz <jstultz(a)google.com>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Stephen Boyd <sboyd(a)kernel.org>
Cc: Anna-Maria Behnsen <anna-maria(a)linutronix.de>
Cc: Frederic Weisbecker <frederic(a)kernel.org>
Cc: Tejun Heo <tj(a)kernel.org>
Cc: Johannes Weiner <hannes(a)cmpxchg.org>
Cc: Michal Koutný <mkoutny(a)suse.com>
Cc: "Rafael J. Wysocki" <rafael(a)kernel.org>
Cc: Pavel Machek <pavel(a)kernel.org>
Cc: Roman Gushchin <roman.gushchin(a)linux.dev>
Cc: Chen Ridong <chenridong(a)huawei.com>
Signed-off-by: Tiffany Yang <ynaffit(a)google.com>
Tiffany Yang (2):
cgroup: cgroup.stat.local time accounting
cgroup: selftests: Add tests for freezer time
Documentation/admin-guide/cgroup-v2.rst | 18 +
include/linux/cgroup-defs.h | 17 +
kernel/cgroup/cgroup.c | 28 +
kernel/cgroup/freezer.c | 16 +-
tools/testing/selftests/cgroup/test_freezer.c | 663 ++++++++++++++++++
5 files changed, 738 insertions(+), 4 deletions(-)
--
2.51.0.rc2.233.g662b1ed5c5-goog