coredump01: New core_pattern specifiers test
PATCH v2 1/1 coredump01: New core_pattern specifiers test
From: Andrea Cervesato <[email protected]>
LTP has no coverage for the core_pattern specifiers expansion, neither for the pipe flavor of core_pattern, where the kernel spawns a user space helper and writes the core dump into its standard input.
The new test verifies that %e, %p and %s are expanded both in the core file name and in the arguments of a piped helper, checking also that the helper really receives an ELF core dump.
Root is required to rewrite the system wide core_pattern, which is restored by the test library on all exit paths.
---
Add a simple coredump01 test that simulate a coredump and verify that it actually works. This is a small coverage that is missing inside LTP testing suite.
---
Changes in v2:
- fix CI agent spotted errors
- Link to v1: https://lore.kernel.org/[email protected]
--- runtest/kernel_misc | 1 + testcases/kernel/Makefile | 1 + testcases/kernel/coredump/.gitignore | 2 + testcases/kernel/coredump/Makefile | 7 + testcases/kernel/coredump/coredump01.c | 221 ++++++++++++++++++++++++++ testcases/kernel/coredump/coredump01_helper.c | 66 ++++++++ 6 files changed, 298 insertions(+)
runtest/kernel_misc +1 -0
@@ -17,3 +17,4 @@ zram02 zram02.sh zram03 zram03 umip_basic_test umip_basic_test aslr01 aslr01 +coredump01 coredump01
testcases/kernel/Makefile +1 -0
@@ -19,6 +19,7 @@ SUBDIRS += lib SUBDIRS += connectors \ containers \ controllers \ + coredump \ crypto \ device-drivers \ firmware \
testcases/kernel/coredump/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +/coredump01 +/coredump01_helper
testcases/kernel/coredump/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2026 Linux Test Project + +top_srcdir ?= ../../.. + +include $(top_srcdir)/include/mk/testcases.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/coredump/coredump01.c new file +221 -0
221 lines not on this page · raw message
testcases/kernel/coredump/coredump01_helper.c new file +66 -0
66 lines not on this page · raw message
---
base-commit: e62b1a4731f9c458d65c2659d2f8bb58b93e6d6d
change-id: 20260820-coredump-22fc731bde08
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Andrea,
Quoted 10 lines · Andrea Cervesato
coredump01: New
core_patternspecifiers teststatic struct tst_test test = { .test = run, .tcnt = 2, .setup = setup, .needs_root = 1, .needs_tmpdir = 1, .forks_child = 1, .save_restore = (const struct tst_path_val[]) {
Could this add a CONFIG_COREDUMP=y entry to .needs_kconfigs? Without it, the ELF binary format has no core-dump callback, so vfs_coredump() returns without setting the WCOREDUMP status bit. crash_child() then reports TFAIL rather than TCONF on a valid kernel configuration.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp