* any way to see the running kernel's "vermagic" string?
@ 2012-10-16 14:52 Robert P. J. Day
2012-10-16 14:59 ` Chinmay V S
2012-10-16 18:35 ` Frank Ch. Eigler
0 siblings, 2 replies; 7+ messages in thread
From: Robert P. J. Day @ 2012-10-16 14:52 UTC (permalink / raw)
To: kernelnewbies
perhaps i've just overlooked it but is there an easy way to see the
current kernel's calculated "vermagic" string, as defined in the
header file include/linux/vermagic.h thusly?
... snip ...
#define VERMAGIC_STRING \
UTS_RELEASE " " \
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
MODULE_ARCH_VERMAGIC
i'm just interested in examining the vermagic string you can see for
any loadable module, as in:
$ modinfo vfat
filename: /lib/modules/3.6.0-oct8+/kernel/fs/fat/vfat.ko
author: Gordon Chaffee
description: VFAT filesystem support
license: GPL
srcversion: 68B6C644F1532E86ADCB2CB
depends: fat
intree: Y
vermagic: 3.6.0-oct8+ SMP mod_unload modversions
and following the load logic in kernel/module.c to see what happens at
each step of a module load, and that (obviously) involves some
comparisons. thanks.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* any way to see the running kernel's "vermagic" string?
2012-10-16 14:52 any way to see the running kernel's "vermagic" string? Robert P. J. Day
@ 2012-10-16 14:59 ` Chinmay V S
2012-10-16 15:05 ` Peter Senna Tschudin
2012-10-16 15:06 ` Robert P. J. Day
2012-10-16 18:35 ` Frank Ch. Eigler
1 sibling, 2 replies; 7+ messages in thread
From: Chinmay V S @ 2012-10-16 14:59 UTC (permalink / raw)
To: kernelnewbies
Isn't "uname -r" on the console good enough?...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121016/9a732eb5/attachment.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* any way to see the running kernel's "vermagic" string?
2012-10-16 14:59 ` Chinmay V S
@ 2012-10-16 15:05 ` Peter Senna Tschudin
2012-10-16 15:07 ` Robert P. J. Day
2012-10-16 15:06 ` Robert P. J. Day
1 sibling, 1 reply; 7+ messages in thread
From: Peter Senna Tschudin @ 2012-10-16 15:05 UTC (permalink / raw)
To: kernelnewbies
http://plastilinux.blogspot.fr/2009/11/how-to-know-version-of-kernel-without.html
On Tue, Oct 16, 2012 at 4:59 PM, Chinmay V S <cvs268@gmail.com> wrote:
> Isn't "uname -r" on the console good enough?...
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* any way to see the running kernel's "vermagic" string?
2012-10-16 14:59 ` Chinmay V S
2012-10-16 15:05 ` Peter Senna Tschudin
@ 2012-10-16 15:06 ` Robert P. J. Day
2012-10-16 15:32 ` Peter Senna Tschudin
1 sibling, 1 reply; 7+ messages in thread
From: Robert P. J. Day @ 2012-10-16 15:06 UTC (permalink / raw)
To: kernelnewbies
On Tue, 16 Oct 2012, Chinmay V S wrote:
> Isn't "uname -r" on the console good enough?...
no, the vermagic string is considerably more informative. as i
mentioned, look at the definition in vermagic.h:
#define VERMAGIC_STRING \
UTS_RELEASE " " \
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
MODULE_ARCH_VERMAGIC
that should (partially?) match the "vermagic" string you see with
modinfo, as in:
$ modinfo vfat
... snip ...
vermagic: 3.6.0-oct8+ SMP mod_unload modversions <--- there!
$
if you check the logic of module loading in kernel/module.c, you'll
see checks being made to see if the two strings are compatible, as in:
... snip ...
static const char vermagic[] = VERMAGIC_STRING;
... snip ...
static int check_modinfo(struct module *mod, struct load_info *info)
{
const char *modmagic = get_modinfo(info, "vermagic");
int err;
/* This is allowed: modprobe --force will invalidate it. */
if (!modmagic) {
err = try_to_force_load(mod, "bad vermagic");
if (err)
return err;
} else if (!same_magic(modmagic, vermagic, info->index.vers)) {
printk(KERN_ERR "%s: version magic '%s' should be '%s'\n",
mod->name, modmagic, vermagic);
return -ENOEXEC;
}
... snip ...
it's not that big a deal, but it would be informative to be able to
see the kernel's full vermagic string.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* any way to see the running kernel's "vermagic" string?
2012-10-16 15:05 ` Peter Senna Tschudin
@ 2012-10-16 15:07 ` Robert P. J. Day
0 siblings, 0 replies; 7+ messages in thread
From: Robert P. J. Day @ 2012-10-16 15:07 UTC (permalink / raw)
To: kernelnewbies
On Tue, 16 Oct 2012, Peter Senna Tschudin wrote:
> http://plastilinux.blogspot.fr/2009/11/how-to-know-version-of-kernel-without.html
ok, hoping for something simpler but, yes, that's what i was after,
thanks muchly.
rday
^ permalink raw reply [flat|nested] 7+ messages in thread
* any way to see the running kernel's "vermagic" string?
2012-10-16 15:06 ` Robert P. J. Day
@ 2012-10-16 15:32 ` Peter Senna Tschudin
0 siblings, 0 replies; 7+ messages in thread
From: Peter Senna Tschudin @ 2012-10-16 15:32 UTC (permalink / raw)
To: kernelnewbies
See what I've found:
http://www.kernel.org/pub/linux/kernel/people//akpm/patches/2.6/2.6.6-rc3/2.6.6-rc3-mm2/broken-out/proc-sys-kernel-vermagic.patch
On Tue, Oct 16, 2012 at 5:06 PM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> On Tue, 16 Oct 2012, Chinmay V S wrote:
>
>> Isn't "uname -r" on the console good enough?...
>
> no, the vermagic string is considerably more informative. as i
> mentioned, look at the definition in vermagic.h:
>
> #define VERMAGIC_STRING \
> UTS_RELEASE " " \
> MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
> MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
> MODULE_ARCH_VERMAGIC
>
> that should (partially?) match the "vermagic" string you see with
> modinfo, as in:
>
> $ modinfo vfat
> ... snip ...
> vermagic: 3.6.0-oct8+ SMP mod_unload modversions <--- there!
> $
>
> if you check the logic of module loading in kernel/module.c, you'll
> see checks being made to see if the two strings are compatible, as in:
>
> ... snip ...
> static const char vermagic[] = VERMAGIC_STRING;
> ... snip ...
> static int check_modinfo(struct module *mod, struct load_info *info)
> {
> const char *modmagic = get_modinfo(info, "vermagic");
> int err;
>
> /* This is allowed: modprobe --force will invalidate it. */
> if (!modmagic) {
> err = try_to_force_load(mod, "bad vermagic");
> if (err)
> return err;
> } else if (!same_magic(modmagic, vermagic, info->index.vers)) {
> printk(KERN_ERR "%s: version magic '%s' should be '%s'\n",
> mod->name, modmagic, vermagic);
> return -ENOEXEC;
> }
> ... snip ...
>
> it's not that big a deal, but it would be informative to be able to
> see the kernel's full vermagic string.
>
> rday
>
>
> --
>
> ========================================================================
> Robert P. J. Day Ottawa, Ontario, CANADA
> http://crashcourse.ca
>
> Twitter: http://twitter.com/rpjday
> LinkedIn: http://ca.linkedin.com/in/rpjday
> ========================================================================
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* any way to see the running kernel's "vermagic" string?
2012-10-16 14:52 any way to see the running kernel's "vermagic" string? Robert P. J. Day
2012-10-16 14:59 ` Chinmay V S
@ 2012-10-16 18:35 ` Frank Ch. Eigler
1 sibling, 0 replies; 7+ messages in thread
From: Frank Ch. Eigler @ 2012-10-16 18:35 UTC (permalink / raw)
To: kernelnewbies
"Robert P. J. Day" <rpjday@crashcourse.ca> writes:
> perhaps i've just overlooked it but is there an easy way to see the
> current kernel's calculated "vermagic" string, as defined in the
> header file include/linux/vermagic.h thusly? [...]
Another way is systemtap:
# stap -g -e 'probe begin { log ( %{ VERMAGIC_STRING /* string */ %} ) exit() }'
3.1.0-7.fc16.x86_64 SMP mod_unload
- FChE
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-10-16 18:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16 14:52 any way to see the running kernel's "vermagic" string? Robert P. J. Day
2012-10-16 14:59 ` Chinmay V S
2012-10-16 15:05 ` Peter Senna Tschudin
2012-10-16 15:07 ` Robert P. J. Day
2012-10-16 15:06 ` Robert P. J. Day
2012-10-16 15:32 ` Peter Senna Tschudin
2012-10-16 18:35 ` Frank Ch. Eigler
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.