From: Rusty Russell <rusty@rustcorp.com.au>
To: Richard Henderson <rth@twiddle.net>
Cc: Kai Germaschewski <kai-germaschewski@uiowa.edu>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] [PATCH] new modversions implementation
Date: Wed, 29 Jan 2003 11:15:58 +1100 [thread overview]
Message-ID: <20030129001948.4C3192C070@lists.samba.org> (raw)
In-Reply-To: Your message of "Tue, 28 Jan 2003 08:31:17 -0800." <20030128083117.A15637@twiddle.net>
In message <20030128083117.A15637@twiddle.net> you write:
> On Tue, Jan 28, 2003 at 09:38:31PM +1100, Rusty Russell wrote:
> > But once again you are relying on link order to keep the crcs
> > section in the same order as the ksymtab section (although the ld
> > documentation says that's correct, I know RTH doesn't like it).
>
> What gave you that idea? Link order is a fine thing to rely on.
OK, I stand corrected. Sorry Kai, I guess this means that struct
kernel_symbol can drop the pointer, too. I'll dig out the old patch
and resend it.
I also dropped the "ignore vermagic if modversions set": you were
right that that's a bad idea, too.
So, here is my much reduced patch on top of yours. Please read
carefully since I'm obviously not having a great week 8)
Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Tweaks to Module Versions
Author: Rusty Russell
Depends: Module/modversions.patch.gz
Status: Experimental
D: Fix the case where no CRCs are supplied (OK, but taints kernel), and
D: only print one tainted message (otherwise --force gives hundreds of them).
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .1440-linux-2.5.59/init/Kconfig .1440-linux-2.5.59.updated/init/Kconfig
--- .1440-linux-2.5.59/init/Kconfig 2003-01-29 11:13:07.000000000 +1100
+++ .1440-linux-2.5.59.updated/init/Kconfig 2003-01-29 11:14:00.000000000 +1100
@@ -147,7 +147,6 @@ config OBSOLETE_MODPARM
config MODVERSIONING
bool "Module versioning support (EXPERIMENTAL)"
depends on MODULES && EXPERIMENTAL
- help
---help---
Usually, you have to use modules compiled with your kernel.
Saying Y here makes it sometimes possible to use modules
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .1440-linux-2.5.59/kernel/module.c .1440-linux-2.5.59.updated/kernel/module.c
--- .1440-linux-2.5.59/kernel/module.c 2003-01-29 11:13:07.000000000 +1100
+++ .1440-linux-2.5.59.updated/kernel/module.c 2003-01-29 11:13:43.000000000 +1100
@@ -737,12 +737,9 @@ static int check_version(Elf_Shdr *sechd
unsigned int i, num_versions;
struct modversion_info *versions;
- if (!ksg->crcs) {
- printk("%s: no CRC for \"%s\" [%s] found: kernel tainted.\n",
- mod->name, symname,
- ksg->owner ? ksg->owner->name : "kernel");
- goto taint;
- }
+ /* Exporting module didn't supply crcs? OK, we're already tainted. */
+ if (!ksg->crcs)
+ return 1;
crc = ksg->crcs[symidx];
@@ -763,10 +760,11 @@ static int check_version(Elf_Shdr *sechd
return 0;
}
/* Not in module's version table. OK, but that taints the kernel. */
- printk("%s: no version for \"%s\" found: kernel tainted.\n",
- mod->name, symname);
- taint:
- tainted |= TAINT_FORCED_MODULE;
+ if (!(tainted & TAINT_FORCED_MODULE)) {
+ printk("%s: no version for \"%s\" found: kernel tainted.\n",
+ mod->name, symname);
+ tainted |= TAINT_FORCED_MODULE;
+ }
return 1;
}
#else
@@ -1273,11 +1271,23 @@ static struct module *load_module(void *
mod->symbols.num_syms = (sechdrs[exportindex].sh_size
/ sizeof(*mod->symbols.syms));
mod->symbols.syms = (void *)sechdrs[exportindex].sh_addr;
- mod->symbols.crcs = (void *)sechdrs[crcindex].sh_addr;
+ if (crcindex)
+ mod->symbols.crcs = (void *)sechdrs[crcindex].sh_addr;
+
mod->gpl_symbols.num_syms = (sechdrs[gplindex].sh_size
/ sizeof(*mod->symbols.syms));
mod->gpl_symbols.syms = (void *)sechdrs[gplindex].sh_addr;
- mod->gpl_symbols.crcs = (void *)sechdrs[gplcrcindex].sh_addr;
+ if (gplcrcindex)
+ mod->gpl_symbols.crcs = (void *)sechdrs[gplcrcindex].sh_addr;
+
+#ifdef CONFIG_MODVERSIONING
+ if ((mod->symbols.num_syms && !crcindex)
+ || (mod->gpl_symbols.num_syms && !gplcrcindex))
+ printk(KERN_WARNING "%s: No versions for exported symbols."
+ " Tainting kernel.\n", mod->name);
+ tainted |= TAINT_FORCED_MODULE;
+ }
+#endif /* CONFIG_MODVERSIONING */
/* Set up exception table */
if (exindex) {
next prev parent reply other threads:[~2003-01-29 0:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-25 18:44 [RFC] [PATCH] new modversions implementation Kai Germaschewski
2003-01-25 21:56 ` Sam Ravnborg
2003-01-25 22:56 ` Sam Ravnborg
2003-01-26 2:31 ` Kai Germaschewski
2003-01-26 2:30 ` Kai Germaschewski
2003-01-28 7:07 ` Rusty Russell
2003-01-28 16:40 ` Kai Germaschewski
2003-01-28 7:06 ` Rusty Russell
2003-01-28 19:20 ` Sam Ravnborg
2003-01-28 10:38 ` Rusty Russell
2003-01-28 16:31 ` Richard Henderson
2003-01-28 16:35 ` Kai Germaschewski
2003-01-29 0:15 ` Rusty Russell [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-02-02 8:37 [RFC][PATCH] " Paul Marinceu
2003-02-02 8:51 ` David Woodhouse
2003-02-03 0:46 ` Rusty Russell
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=20030129001948.4C3192C070@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=kai-germaschewski@uiowa.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=rth@twiddle.net \
/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