From: Lucas De Marchi <lucas.demarchi@intel.com>
To: linux-modules <linux-modules@vger.kernel.org>
Cc: Michal Suchanek <msuchanek@suse.de>, Takashi Iwai <tiwai@suse.de>,
Petr Vorel <pvorel@suse.cz>,
Lucas De Marchi <lucas.de.marchi@gmail.com>
Subject: [PATCH] libkmod: Set builtin to no when module is created from path.
Date: Wed, 18 Aug 2021 14:24:40 -0700 [thread overview]
Message-ID: <20210818212440.2224127-2-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20210818212440.2224127-1-lucas.demarchi@intel.com>
From: Michal Suchanek <msuchanek@suse.de>
A recent bug report showed that modinfo doesn't give the signature
information for certain modules, and it turned out to happen only on
the modules that are built-in on the running kernel; then modinfo
skips the signature check, as if the target module file never exists.
The behavior is, however, inconsistent when modinfo is performed for
external modules (no matter which kernel version is) and the module
file path is explicitly given by a command-line argument, which
guarantees the presence of the module file itself.
Fixes: e7e2cb61fa9f ("modinfo: Show information about built-in modules")
Link: https://lore.kernel.org/linux-modules/CAKi4VAJVvY3=JdSZm-GD1hJqyCPYaYz-jBJ_REeY5BakVb6_ww@mail.gmail.com/
BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1189537
Suggested-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
libkmod/libkmod-module.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 6e0ff1a..6f7747c 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -431,17 +431,18 @@ KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx,
return -EEXIST;
}
- *mod = kmod_module_ref(m);
- return 0;
- }
+ kmod_module_ref(m);
+ } else {
+ err = kmod_module_new(ctx, name, name, namelen, NULL, 0, &m);
+ if (err < 0) {
+ free(abspath);
+ return err;
+ }
- err = kmod_module_new(ctx, name, name, namelen, NULL, 0, &m);
- if (err < 0) {
- free(abspath);
- return err;
+ m->path = abspath;
}
- m->path = abspath;
+ m->builtin = KMOD_MODULE_BUILTIN_NO;
*mod = m;
return 0;
--
2.31.1
next prev parent reply other threads:[~2021-08-18 21:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 11:22 [PATCH] modinfo: don't parse built-in for explicitly given module files Takashi Iwai
2021-08-18 11:41 ` Michal Suchánek
2021-08-18 12:05 ` Petr Vorel
2021-08-18 19:13 ` Lucas De Marchi
2021-08-18 20:52 ` [PATCH] libkmod: Set builtin to no when module is created from path Michal Suchanek
2021-08-18 21:23 ` Lucas De Marchi
2021-08-18 21:24 ` [PATCH v2] " Lucas De Marchi
2021-08-18 21:24 ` Lucas De Marchi [this message]
2021-08-19 15:28 ` Petr Vorel
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=20210818212440.2224127-2-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=linux-modules@vger.kernel.org \
--cc=lucas.de.marchi@gmail.com \
--cc=msuchanek@suse.de \
--cc=pvorel@suse.cz \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.