From: linuxtestproject.agent@gmail.com
To: Li Wang <li.wang@linux.dev>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] lib: add module is loaded check
Date: Thu, 8 Oct 2026 10:14:02 +0000 [thread overview]
Message-ID: <20261008101402.9651-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20261008052141.129763-2-li.wang@linux.dev>
Hi Li,
On Thu, 8 Oct 2026, Li Wang wrote:
> lib: add module is loaded check
--- [PATCH 1/4] ---
> diff --git a/include/tst_module.h b/include/tst_module.h
> +bool tst_module_is_loaded(const char *mod_name);
Low: Add kernel-doc for this new public API, including mod_name and the
return value. Document normalization, built-in modules, and the current
false return when /proc/modules cannot be read.
--- [PATCH 2/4] ---
> diff --git a/include/tst_kconfig.h b/include/tst_kconfig.h
> + * Called from do_test_cleanup() so that the modules are released when
> + * the test finishes, regardless of the test result.
Low: The actual caller is do_cleanup(), in the library parent process,
not do_test_cleanup(), which invokes the test's cleanup callback.
Correct the lifecycle description.
> diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
> +#define MAX_LOADED_MODULES 16
> + if (loaded_module_count < MAX_LOADED_MODULES)
> + loaded_modules[loaded_module_count++] = mod;
Medium: This commit already has 19 mappings, so a valid requirement list
with all 19 available as modules passes the config check but queues only
16, silently omitting three required loads. Size the storage from the
mapping table or allocate enough space instead of discarding entries.
> kconfig_module_check(&vars[i]);
> + kconfig_module_record(vars[i].id);
Medium: kconfig_module_check() can change choice to 'n' for an uninstalled
module, but this still queues it. For CONFIG_MMU | CONFIG_CAN_RAW with
MMU=y and an uninstalled CAN_RAW=m, the expression succeeds, then loading
can-raw aborts the otherwise runnable test. Queue only configs that
remain enabled after checking, without making optional branches mandatory.
> + for (i = 0; i < loaded_module_count; i++) {
> + tst_res(TDEBUG, "Loading module '%s'", loaded_modules[i]);
> + tst_modprobe(loaded_modules[i], NULL);
> + }
> +
> + modules_loaded = true;
High: If one modprobe succeeds and a later one aborts, modules_loaded is
still false, so the cleanup helper returns without unloading the earlier
module. Track each successful load immediately and let abort cleanup
unload that successful prefix, not unattempted entries.
> + const char *const argv[] = { "rmmod", loaded_modules[i - 1], NULL };
> + tst_cmd(argv, "/dev/null", "/dev/null", TST_CMD_PASS_RETVAL);
Medium: modprobe also inserts dependencies, but this removes only the
explicitly recorded names. With CONFIG_CAN=m and CONFIG_CAN_RAW=m,
loading can-raw also loads can; removing can-raw leaves the newly loaded,
unused can module behind. Track newly loaded dependencies and remove
only test-owned modules in dependency order.
--- [PATCH 3/4] ---
> The test also needs root to load the modules and to run as the
> vsock_loopback transport is not available from an unprivileged user
> namespace.
> diff --git a/testcases/cve/cve-2025-21756.c b/testcases/cve/cve-2025-21756.c
> + .needs_root = 1,
Low: Root is needed for module insertion, but loopback VSOCK on
nonprivileged ports in the initial namespaces does not require root;
an ordinary nonroot process is not an unprivileged user namespace.
Correct the commit message and document the loading-only requirement in
the test description. Drop privileges for the reproducer after the
framework has loaded the modules.
Verdict - Needs revision
Pre-existing issue: sctphantom's description requests manual module
preloading, although its setup already loaded sctp before this series.
---
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-10-08 10:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 5:21 [LTP] [Patch v2 0/4] tst_kconfig: automatic module load/unload for CONFIG_*=m Li Wang
2026-10-08 5:21 ` [LTP] [Patch v2 1/4] lib: add module is loaded check Li Wang
2026-10-08 10:14 ` linuxtestproject.agent [this message]
2026-10-10 1:43 ` [LTP] " Li Wang
2026-10-08 5:21 ` [LTP] [Patch v2 2/4] tst_kconfig: load and unload kernel modules for CONFIG_*=m Li Wang
2026-10-08 5:21 ` [LTP] [Patch v2 3/4] tst_kconfig: add module mappings for vsock/vsock_loopback Li Wang
2026-10-08 5:21 ` [LTP] [Patch v2 4/4] testcases: drop manual tst_modprobe() now handled by tst_kconfig Li Wang
-- strict thread matches above, loose matches on Subject: below --
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
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=20261008101402.9651-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=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