From: Jinchao Wang <wangjinchao600@gmail.com>
To: Petr Pavlu <petr.pavlu@suse.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] module: show why force load fails
Date: Tue, 26 Aug 2025 17:51:01 +0800 [thread overview]
Message-ID: <3b96de64-166c-4e96-99e4-714310e13d52@gmail.com> (raw)
In-Reply-To: <52288605-a16c-4a93-9e80-66d32de88847@suse.com>
On 8/26/25 17:33, Petr Pavlu wrote:
> On 8/25/25 11:15 AM, Jinchao Wang wrote:
>> Include reason in error message when force loading is disabled.
>>
>> Signed-off-by: Jinchao Wang <wangjinchao600@gmail.com>
>> ---
>> kernel/module/main.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/kernel/module/main.c b/kernel/module/main.c
>> index c66b26184936..a426bd8a18b5 100644
>> --- a/kernel/module/main.c
>> +++ b/kernel/module/main.c
>> @@ -1083,6 +1083,7 @@ int try_to_force_load(struct module *mod, const char *reason)
>> add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_NOW_UNRELIABLE);
>> return 0;
>> #else
>> + pr_err("%s force load is not supported\n", reason);
>> return -ENOEXEC;
>> #endif
>> }
>
> The module name is already available at all points where
> try_to_force_load() is called, so the new error message should include
> it.
>
> Additionally, we should be careful about the message. In the case of the
> init_module syscall, the missing modversions and vermagic could mean
> that the data was deliberately stripped by kmod because the module was
> inserted with --force, or it could mean that the module lacks this data
> in the first place. In other words, it is not always the case that that
> we're reaching this logic because of a force load.
>
> My suggestion would be to use the following:
>
> pr_err("%s: %s, force load is not supported\n", mod->name, reason);
>
Good suggestion. Thanks.
--
Best regards,
Jinchao
next prev parent reply other threads:[~2025-08-26 9:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 9:15 [PATCH v2 0/4] module: logging and code improvements Jinchao Wang
2025-08-25 9:15 ` [PATCH v2 1/4] module: signing: Use pr_err for signature rejection Jinchao Wang
2025-08-25 9:15 ` [PATCH v2 2/4] module: show why force load fails Jinchao Wang
2025-08-26 9:33 ` Petr Pavlu
2025-08-26 9:51 ` Jinchao Wang [this message]
2025-08-25 9:15 ` [PATCH v2 3/4] module: centralize no-versions force load check Jinchao Wang
2025-08-26 9:40 ` Petr Pavlu
2025-08-25 9:15 ` [PATCH v2 4/4] module: separate vermagic and livepatch checks Jinchao 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=3b96de64-166c-4e96-99e4-714310e13d52@gmail.com \
--to=wangjinchao600@gmail.com \
--cc=da.gomez@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=samitolvanen@google.com \
/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
all inboxes | Powered by JetHome®