diff options
author | Kees Cook <keescook@chromium.org> | 2017-04-21 15:35:27 -0700 |
---|---|---|
committer | Jessica Yu <jeyu@redhat.com> | 2017-05-23 14:08:31 -0700 |
commit | 3e2e857f9c3a19d55ee0ba7b428b8be5008960bf (patch) | |
tree | a6d4eccd60502ff4b2913dfb55f59f342fd26e28 /scripts/mod | |
parent | 490194269665d6d4915a4a5774f002885c5a2d8f (diff) | |
download | lwn-3e2e857f9c3a19d55ee0ba7b428b8be5008960bf.tar.gz lwn-3e2e857f9c3a19d55ee0ba7b428b8be5008960bf.zip |
module: Add module name to modinfo
Accessing the mod structure (e.g. for mod->name) prior to having completed
check_modstruct_version() can result in writing garbage to the error logs
if the layout of the mod structure loaded from disk doesn't match the
running kernel's mod structure layout. This kind of mismatch will become
much more likely if a kernel is built with different randomization seed
for the struct layout randomization plugin.
Instead, add and use a new modinfo string for logging the module name.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jessica Yu <jeyu@redhat.com>
Diffstat (limited to 'scripts/mod')
-rw-r--r-- | scripts/mod/modpost.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 30d752a4a6a6..48397feb08fb 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2126,6 +2126,7 @@ static void add_header(struct buffer *b, struct module *mod) buf_printf(b, "#include <linux/compiler.h>\n"); buf_printf(b, "\n"); buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); + buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n"); buf_printf(b, "\n"); buf_printf(b, "__visible struct module __this_module\n"); buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); |