Linux Test Project
 help / color / mirror / Atom feed
From: Li Wang <li.wang@linux.dev>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 0/4] tst_kconfig: automatic module load/unload for CONFIG_*=m
Date: Sat, 10 Oct 2026 11:36:18 +0800	[thread overview]
Message-ID: <20261010033622.68927-1-li.wang@linux.dev> (raw)

Tests that depend on a config set to =m currently load the module
themselves, and may fail with misleading errors when it is missing,
e.g. bind() returning EADDRNOTAVAIL for AF_VSOCK without vsock_loopback.

This series makes tst_kconfig record the module for every
config_module_maps[] entry seen as =m, load them once the kernel
config check passes, and unload them at cleanup time.

Changes in v3:
- Queue only configs that stay 'm' after kconfig_module_check(),
  so a module downgraded to 'n' does not abort an otherwise
  runnable test.
- Unload with "modprobe -r" instead of "rmmod" to also remove
  dependencies pulled in by modprobe.
- Drop the redundant geteuid() check in the unload path.
- Raise MAX_LOADED_MODULES from 16 to 32.
- cve-2025-21756: drop privileges to nobody after module loading
  and regain root in cleanup(), so the reproducer runs from a
  non-root context while the framework can still unload modules.

Changes in v2:

- Add tst_module_is_loaded() helper.
- Only load/unload modules that are not already loaded.
- Skip automatic loading when KCONFIG_SKIP_CHECK=1, keeping the
  semantics consistent with skipping the config check.
- Document the KCONFIG_SKIP_CHECK=1 behaviour for keyctl29/keyctl30
  and the vsock/vsock_loopback mapping.

Li Wang (4):
  lib: add module is loaded check
  tst_kconfig: load and unload kernel modules for CONFIG_*=m
  tst_kconfig: add module mappings for vsock/vsock_loopback
  testcases: drop manual tst_modprobe() now handled by tst_kconfig

 include/tst_kconfig.h                       | 28 ++++++++
 include/tst_module.h                        |  1 +
 lib/tst_kconfig.c                           | 80 +++++++++++++++++++++
 lib/tst_module.c                            | 39 ++++++++++
 lib/tst_test.c                              | 11 ++-
 testcases/cve/cve-2025-21756.c              | 36 ++++++++++
 testcases/cve/cve-2026-46331.c              |  7 --
 testcases/cve/sctphantom.c                  |  3 -
 testcases/kernel/syscalls/keyctl/keyctl29.c |  3 -
 testcases/kernel/syscalls/keyctl/keyctl30.c |  3 -
 10 files changed, 193 insertions(+), 18 deletions(-)

-- 
2.56.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-10-10  3:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10  3:36 Li Wang [this message]
2026-10-10  3:36 ` [LTP] [PATCH v3 1/4] lib: add module is loaded check Li Wang
2026-10-10  9:38   ` [LTP] " linuxtestproject.agent
2026-10-12 15:48   ` [LTP] [PATCH v3 1/4] " Andrea Cervesato via ltp
2026-10-10  3:36 ` [LTP] [PATCH v3 2/4] tst_kconfig: load and unload kernel modules for CONFIG_*=m Li Wang
2026-10-12 16:09   ` Andrea Cervesato via ltp
2026-10-10  3:36 ` [LTP] [PATCH v3 3/4] tst_kconfig: add module mappings for vsock/vsock_loopback Li Wang
2026-10-12 15:51   ` Andrea Cervesato via ltp
2026-10-10  3:36 ` [LTP] [PATCH v3 4/4] testcases: drop manual tst_modprobe() now handled by tst_kconfig Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261010033622.68927-1-li.wang@linux.dev \
    --to=li.wang@linux.dev \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox