[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3b96de64-166c-4e96-99e4-714310e13d52@gmail.com>
Date: Tue, 26 Aug 2025 17:51:01 +0800
From: Jinchao Wang <wangjinchao600@...il.com>
To: Petr Pavlu <petr.pavlu@...e.com>
Cc: Luis Chamberlain <mcgrof@...nel.org>, Daniel Gomez <da.gomez@...nel.org>,
Sami Tolvanen <samitolvanen@...gle.com>, linux-modules@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/4] module: show why force load fails
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@...il.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
Powered by blists - more mailing lists