[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52288605-a16c-4a93-9e80-66d32de88847@suse.com>
Date: Tue, 26 Aug 2025 11:33:59 +0200
From: Petr Pavlu <petr.pavlu@...e.com>
To: Jinchao Wang <wangjinchao600@...il.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/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);
--
Thanks,
Petr
Powered by blists - more mailing lists