From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <hppiscas@163.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: core: include scsi_lib KUnit tests in modular builds
Date: Fri, 04 Dec 2026 02:16:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-248960@kernel.org> (raw)
In-Reply-To: <179634982482.74470.2785930501744791630@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scsi: embedding scsi_lib_test.c couples scsi_mod.ko to
kunit.ko and taints
--
commit 62bce85f8688e7b2497edd8565cef82538ee735c
Author: Pengpeng Hou <hppiscas@163.com>
scsi: core: include scsi_lib KUnit tests in modular builds
This commit changes the guard around including scsi_lib_test.c in
drivers/scsi/scsi_lib.c from #ifdef to IS_REACHABLE() so the KUnit tests
are included when both SCSI and SCSI_LIB_KUNIT_TEST are built as modules.
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index ab39514cc0c6b..9489188038319 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -3611,6 +3611,6 @@ void scsi_set_sense(struct scsi_cmnd *scmd, int desc, u8 key, u16 code)
> }
> EXPORT_SYMBOL_GPL(scsi_set_sense);
>
> -#ifdef CONFIG_SCSI_LIB_KUNIT_TEST
> +#if IS_REACHABLE(CONFIG_SCSI_LIB_KUNIT_TEST)
> #include "scsi_lib_test.c"
> #endif
[Severity: Medium]
Does embedding scsi_lib_test.c into scsi_mod.ko couple core SCSI to
kunit.ko?
With CONFIG_SCSI=m and CONFIG_KUNIT_ALL_TESTS=m, CONFIG_SCSI_LIB_KUNIT_TEST
defaults to m, compiling scsi_lib_test.c into scsi_mod.ko. Its
KUNIT_EXPECT_EQ() calls reference __kunit_do_failed_assertion from kunit.ko,
preventing scsi_mod.ko from loading if an initramfs omits kunit.ko.
Loading scsi_mod.ko also triggers kunit_module_notify() to run
scsi_lib_test_suite during normal boot, tainting the kernel with TAINT_TEST
and keeping the suite's debugfs entries until scsi_mod.ko is unloaded. The
tests also cannot be loaded or re-run independently of scsi_mod.ko.
Marking scsi_check_passthrough() with VISIBLE_IF_KUNIT and
EXPORT_SYMBOL_IF_KUNIT() and building scsi_lib_test.o as a separate module
via obj-$(CONFIG_SCSI_LIB_KUNIT_TEST) in drivers/scsi/Makefile would avoid
both issues and also support CONFIG_SCSI=y.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179634982482.74470.2785930501744791630@163.com?part=1
prev parent reply other threads:[~2026-12-04 2:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 2:03 [PATCH] scsi: core: include scsi_lib KUnit tests in modular builds Pengpeng Hou
2026-12-04 2:16 ` sashiko-bot [this message]
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=sashiko-outbox-248960@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=hppiscas@163.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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