Hi Linus,
Please pull the following kselftest fixes update for Linux 6.13-rc1.
kselftest update for Linux 6.13-rc1
-- timers test - removes duplicates defines
-- timers test - fixes to improve error reporting
-- rtc test - adds check rtc alarm status to alarm test
-- resctrl test - adds array overrun checks during iMC config parsing code
-- resctrl test - adds array overflow checks when reading strings
-- resctrl test - fixes and reorganizing code
Looks like I forgot to mention signal test changes in my tag
message. :(
diff is attached.
Tests passed on my kselftest next branch:
- Individual test runs of signal, timers, rtc, and resctrl
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 8e929cb546ee42c9a61d24fae60605e9e3192354:
Linux 6.12-rc3 (2024-10-13 14:33:32 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-next-6.13-rc1
for you to fetch changes up to a44c26d7fa74a5f4d2795a5c55a2d6ec1ebf1e38:
selftests/resctrl: Replace magic constants used as array size (2024-11-04 17:02:03 -0700)
----------------------------------------------------------------
linux_kselftest-next-6.13-rc1
kselftest update for Linux 6.13-rc1
-- timers test - removes duplicates defines
-- timers test - fixes to improve error reporting
-- rtc test - adds check rtc alarm status to alarm test
-- resctrl test - adds array overrun checks during iMC config parsing code
-- resctrl test - adds array overflow checks when reading strings
-- resctrl test - fixes and reorganizing code
----------------------------------------------------------------
Chen Ni (1):
selftests: timers: Remove unneeded semicolon
Dev Jain (2):
selftests: Rename sigaltstack to generic signal
selftests: Add a test mangling with uc_sigmask
Gianfranco Trad (1):
selftests: timers: improve timer_create failure message
Joseph Jang (1):
selftest: rtc: Add to check rtc alarm status for alarm related test
Nícolas F. R. A. Prado (1):
docs: dev-tools: Add documentation for the device focused kselftests
Reinette Chatre (15):
selftests/resctrl: Make functions only used in same file static
selftests/resctrl: Print accurate buffer size as part of MBM results
selftests/resctrl: Fix memory overflow due to unhandled wraparound
selftests/resctrl: Protect against array overrun during iMC config parsing
selftests/resctrl: Protect against array overflow when reading strings
selftests/resctrl: Make wraparound handling obvious
selftests/resctrl: Remove "once" parameter required to be false
selftests/resctrl: Only support measured read operation
selftests/resctrl: Remove unused measurement code
selftests/resctrl: Make benchmark parameter passing robust
selftests/resctrl: Ensure measurements skip initialization of default benchmark
selftests/resctrl: Use cache size to determine "fill_buf" buffer size
selftests/resctrl: Do not compare performance counters and resctrl at low bandwidth
selftests/resctrl: Keep results from first test run
selftests/resctrl: Replace magic constants used as array size
Shuah Khan (2):
selftests: timers: Remove local NSEC_PER_SEC and USEC_PER_SEC defines
selftests:timers: remove local CLOCKID defines
Documentation/dev-tools/kselftest.rst | 9 +
Documentation/dev-tools/testing-devices.rst | 47 +++
tools/testing/selftests/Makefile | 2 +-
tools/testing/selftests/resctrl/cmt_test.c | 37 +-
tools/testing/selftests/resctrl/fill_buf.c | 45 +--
tools/testing/selftests/resctrl/mba_test.c | 54 ++-
tools/testing/selftests/resctrl/mbm_test.c | 37 +-
tools/testing/selftests/resctrl/resctrl.h | 79 +++-
tools/testing/selftests/resctrl/resctrl_tests.c | 95 ++++-
tools/testing/selftests/resctrl/resctrl_val.c | 447 ++++++---------------
tools/testing/selftests/resctrl/resctrlfs.c | 19 +-
tools/testing/selftests/rtc/Makefile | 2 +-
tools/testing/selftests/rtc/rtctest.c | 64 +++
.../selftests/{sigaltstack => signal}/.gitignore | 1 +
.../selftests/{sigaltstack => signal}/Makefile | 3 +-
.../current_stack_pointer.h | 0
tools/testing/selftests/signal/mangle_uc_sigmask.c | 184 +++++++++
.../selftests/{sigaltstack => signal}/sas.c | 0
tools/testing/selftests/timers/Makefile | 2 +-
tools/testing/selftests/timers/adjtick.c | 6 +-
.../testing/selftests/timers/alarmtimer-suspend.c | 22 +-
.../testing/selftests/timers/inconsistency-check.c | 21 +-
tools/testing/selftests/timers/leap-a-day.c | 2 +-
tools/testing/selftests/timers/mqueue-lat.c | 2 +-
tools/testing/selftests/timers/nanosleep.c | 21 +-
tools/testing/selftests/timers/nsleep-lat.c | 22 +-
tools/testing/selftests/timers/posix_timers.c | 15 +-
tools/testing/selftests/timers/raw_skew.c | 4 +-
tools/testing/selftests/timers/set-2038.c | 3 +-
tools/testing/selftests/timers/set-timer-lat.c | 21 +-
tools/testing/selftests/timers/valid-adjtimex.c | 4 +-
31 files changed, 701 insertions(+), 569 deletions(-)
create mode 100644 Documentation/dev-tools/testing-devices.rst
rename tools/testing/selftests/{sigaltstack => signal}/.gitignore (70%)
rename tools/testing/selftests/{sigaltstack => signal}/Makefile (56%)
rename tools/testing/selftests/{sigaltstack => signal}/current_stack_pointer.h (100%)
create mode 100644 tools/testing/selftests/signal/mangle_uc_sigmask.c
rename tools/testing/selftests/{sigaltstack => signal}/sas.c (100%)
----------------------------------------------------------------
Page Detective is a new kernel debugging tool that provides detailed
information about the usage and mapping of physical memory pages.
It is often known that a particular page is corrupted, but it is hard to
extract more information about such a page from live system. Examples
are:
- Checksum failure during live migration
- Filesystem journal failure
- dump_page warnings on the console log
- Unexcpected segfaults
Page Detective helps to extract more information from the kernel, so it
can be used by developers to root cause the associated problem.
It operates through the Linux debugfs interface, with two files: "virt"
and "phys".
The "virt" file takes a virtual address and PID and outputs information
about the corresponding page.
The "phys" file takes a physical address and outputs information about
that page.
The output is presented via kernel log messages (can be accessed with
dmesg), and includes information such as the page's reference count,
mapping, flags, and memory cgroup. It also shows whether the page is
mapped in the kernel page table, and if so, how many times.
Pasha Tatashin (6):
mm: Make get_vma_name() function public
pagewalk: Add a page table walker for init_mm page table
mm: Add a dump_page variant that accept log level argument
misc/page_detective: Introduce Page Detective
misc/page_detective: enable loadable module
selftests/page_detective: Introduce self tests for Page Detective
Documentation/misc-devices/index.rst | 1 +
Documentation/misc-devices/page_detective.rst | 78 ++
MAINTAINERS | 8 +
drivers/misc/Kconfig | 11 +
drivers/misc/Makefile | 1 +
drivers/misc/page_detective.c | 808 ++++++++++++++++++
fs/inode.c | 18 +-
fs/kernfs/dir.c | 1 +
fs/proc/task_mmu.c | 61 --
include/linux/fs.h | 5 +-
include/linux/mmdebug.h | 1 +
include/linux/pagewalk.h | 2 +
kernel/pid.c | 1 +
mm/debug.c | 53 +-
mm/memcontrol.c | 1 +
mm/oom_kill.c | 1 +
mm/pagewalk.c | 32 +
mm/vma.c | 60 ++
tools/testing/selftests/Makefile | 1 +
.../selftests/page_detective/.gitignore | 1 +
.../testing/selftests/page_detective/Makefile | 7 +
tools/testing/selftests/page_detective/config | 4 +
.../page_detective/page_detective_test.c | 727 ++++++++++++++++
23 files changed, 1787 insertions(+), 96 deletions(-)
create mode 100644 Documentation/misc-devices/page_detective.rst
create mode 100644 drivers/misc/page_detective.c
create mode 100644 tools/testing/selftests/page_detective/.gitignore
create mode 100644 tools/testing/selftests/page_detective/Makefile
create mode 100644 tools/testing/selftests/page_detective/config
create mode 100644 tools/testing/selftests/page_detective/page_detective_test.c
--
2.47.0.338.g60cca15819-goog
Hi all,
Another rather vague question from me - does anyone know any reasons
why we couldn't support KUNIT_EXPECT in atomic contexts?
For Address Space Isolation we have some tests that want to disable
preemption. I guess this is not a totally insane thing to want to do -
am I missing anything there?
You can see some examples here:
https://github.com/googleprodkernel/linux-kvm/blob/asi-lpc-24/arch/x86/mm/a…
(Actually, looks like in that code we just started doing KUNIT_EXPECT
in preempt-disabled regions anyway, and I never suffered any
consequences until recently. Probably we just never had those
assertions fail under DEBUG_ATOMIC_SLEEP).
From a very quick look, it seems like the only reason you can't
KUNIT_EXPECT from atomic right now is the GFP_KERNEL allocations.
So... what if we just made them GFP_ATOMIC? In general I think that's
a pretty ropey approach, but maybe fine in the context of unit tests?
Or, we could have variants of the assertions, or a test attribute, to
just use GFP_ATOMIC in the cases where it's needed.
Is there anything else missing that would need to be done?
Alternatively, we could expose the whole context concern to the user
in such a way that KUNIT_ASSERT can be used too, something like:
struct kunit_defer defer = KUNIT_INIT_DEFER(test);
preempt_disable();
KUNIT_EXPECT_DEFERRED_TRUE(&defer, ...);
KUNIT_ASSERT_DEFERRED_EQ(&defer, ...);
preempt_enable();
// Prints failures from above, aborts if the ASSERT failed:
kunit_defer_finish(&defer);
I hope that wouldn't be necessary though, it seems like a lot of API surface.
Currently the mount_setattr_test fails on machines with a 64K PAGE_SIZE,
with errors such as:
# RUN mount_setattr_idmapped.invalid_fd_negative ...
mkfs.ext4: No space left on device while writing out and closing file system
# mount_setattr_test.c:1055:invalid_fd_negative:Expected system("mkfs.ext4 -q /mnt/C/ext4.img") (256) == 0 (0)
# invalid_fd_negative: Test terminated by assertion
# FAIL mount_setattr_idmapped.invalid_fd_negative
not ok 12 mount_setattr_idmapped.invalid_fd_negative
The code creates a 100,000 byte tmpfs:
ASSERT_EQ(mount("testing", "/mnt", "tmpfs", MS_NOATIME | MS_NODEV,
"size=100000,mode=700"), 0);
And then a little later creates a 2MB ext4 filesystem in that tmpfs:
ASSERT_EQ(ftruncate(img_fd, 1024 * 2048), 0);
ASSERT_EQ(system("mkfs.ext4 -q /mnt/C/ext4.img"), 0);
At first glance it seems like that should never work, after all 2MB is
larger than 100,000 bytes. However the filesystem image doesn't actually
occupy 2MB on "disk" (actually RAM, due to tmpfs). On 4K kernels the
ext4.img uses ~84KB of actual space (according to du), which just fits.
However on 64K PAGE_SIZE kernels the ext4.img takes at least 256KB,
which is too large to fit in the tmpfs, hence the errors.
It seems fraught to rely on the ext4.img taking less space on disk than
the allocated size, so instead create the tmpfs with a size of 2MB. With
that all 21 tests pass on 64K PAGE_SIZE kernels.
Fixes: 01eadc8dd96d ("tests: add mount_setattr() selftests")
Signed-off-by: Michael Ellerman <mpe(a)ellerman.id.au>
---
tools/testing/selftests/mount_setattr/mount_setattr_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
index 68801e1a9ec2..70f65eb320a7 100644
--- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
+++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
@@ -1026,7 +1026,7 @@ FIXTURE_SETUP(mount_setattr_idmapped)
"size=100000,mode=700"), 0);
ASSERT_EQ(mount("testing", "/mnt", "tmpfs", MS_NOATIME | MS_NODEV,
- "size=100000,mode=700"), 0);
+ "size=2m,mode=700"), 0);
ASSERT_EQ(mkdir("/mnt/A", 0777), 0);
--
2.47.0
Hi Linus,
Please pull the following kunit update for Linux 6.13-rc1.
kunit update for Linux 6.13-rc1
-- fixes user-after-free (UAF) bug in kunit_init_suite()
-- adds option to kunit tool to print just the summary of test results
-- adds option to kunit tool to print just the failed test results
-- fixes kunit_zalloc_skb() to use user passed in gfp value instead of
hardcoding GFP_KERNEL
-- fixes kunit_zalloc_skb() kernel doc to include allocation flags variable
diff is attached.
Tests passed on my kunit repo:
- Build make allmodconfig
./tools/testing/kunit/kunit.py run
./tools/testing/kunit/kunit.py run --alltests
./tools/testing/kunit/kunit.py run --arch x86_64
./tools/testing/kunit/kunit.py run --alltests --arch x86_64
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 2d5404caa8c7bb5c4e0435f94b28834ae5456623:
Linux 6.12-rc7 (2024-11-10 14:19:35 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-kunit-6.13-rc1
for you to fetch changes up to 67b6d342fb6d5abfbeb71e0f23141b9b96cf7bb1:
kunit: tool: print failed tests only (2024-11-14 09:38:19 -0700)
----------------------------------------------------------------
linux_kselftest-kunit-6.13-rc1
kunit update for Linux 6.13-rc1
-- fixes user-after-free (UAF) bug in kunit_init_suite()
-- adds option to kunit tool to print just the summary of test results
-- adds option to kunit tool to print just the failed test results
-- fixes kunit_zalloc_skb() to use user passed in gfp value instead of
hardcoding GFP_KERNEL
-- fixes kunit_zalloc_skb() kernel doc to include allocation flags variable
----------------------------------------------------------------
Dan Carpenter (2):
kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL
kunit: skb: add gfp to kernel doc for kunit_zalloc_skb()
David Gow (1):
kunit: tool: Only print the summary
Jinjie Ruan (1):
kunit: string-stream: Fix a UAF bug in kunit_init_suite()
Rae Moar (1):
kunit: tool: print failed tests only
include/kunit/skbuff.h | 5 +-
lib/kunit/string-stream.c | 1 +
tools/testing/kunit/kunit.py | 28 ++++++-
tools/testing/kunit/kunit_parser.py | 134 +++++++++++++++++++++------------
tools/testing/kunit/kunit_printer.py | 14 +++-
tools/testing/kunit/kunit_tool_test.py | 55 +++++++-------
6 files changed, 151 insertions(+), 86 deletions(-)
----------------------------------------------------------------