any way to see the running kernel's "vermagic" string?
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 ========================================================================
http://plastilinux.blogspot.fr/2009/11/how-to-know-version-of-kernel-without... 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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Peter
On Tue, 16 Oct 2012, Peter Senna Tschudin wrote:
http://plastilinux.blogspot.fr/2009/11/how-to-know-version-of-kernel-without...
ok, hoping for something simpler but, yes, that's what i was after, thanks muchly. rday
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 ========================================================================
See what I've found: http://www.kernel.org/pub/linux/kernel/people//akpm/patches/2.6/2.6.6-rc3/2.... 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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Peter
"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
participants (4)
-
Chinmay V S -
fche@redhat.com -
Peter Senna Tschudin -
Robert P. J. Day