Re: Linux kernel file name

Hans Lermen (lermen@elserv.ffm.fgan.de)
Wed, 11 Dec 1996 01:11:10 +0100 (MET)


On Tue, 10 Dec 1996, Ulrich Windl wrote:
> On 10 Dec 96 at 10:53, Hans Lermen wrote:
> >
> > Well, symbol table information for a Linux kernel image can be get in
> > different ways:
> >
> > 1. There is an exported list of symbols, that are needed to allow linking
> > in the modules: /proc/ksyms.
> > This is not the complete symbol table.
>
> This makes that feature rather useless IMHO.

Naaa, don't forget the purpose of /proc/ksyms. Its the official 'ABI' for
interfaceing the modules with the kernel.
There are good reasons not to export all symbols.

If you use it for a different purpose, you shouldn't complain, he? ;-)

> > 2. On each compilation of the kernel, there is a symbol table generated
> > (System.map). It is common usage to have the System.map of the currently
> > loaded kernel in '/' or /usr/src/linux.
> > However, to have it 'in sync' with the loaded kernel is the responsibility
> > of the system administrator, the kernel itself doesn't care about this.
>
> Wouldn't it be good if there were a way to check if the System.map
> really matches the active kernel.

Yes, but there _is_ a way, just check for consistency between the
addresses and symbolnames in /proc/ksyms and the ones found in System.map.
If all of them fit, then you have a better test than a checksum.
The special insmod that comes with dosemu _does_ it this way.

> What if we add the "kernel version
> stamp" as text to the System.map and then use the address from the
> System.mao where that value should be.

Kind of this _is_ already available in System.map:

00000000001e05c8 D Version_131099

Together with the address its a fine magic. The '131099' is
LINUX_VERSION_CODE, that also is in <linux/version.h>.
What remains is just to export 'Version_*' in /proc/ksyms.

However, I guess Linus won't like that. AFAIK Linus currently accepts
binary only modules to be distributed as long as only /proc/ksyms is
used for interfaceing. Integrating a _legal_ hook to bypass this would
change this policy. We have to respect that, he is the copyright holder.

> > You may maintain a set of System.maps in /boot and do a symbolic link to
> > /System.map in your /etc/rc. The info of what kernel has been loaded can
> > be get out the 'BOOT_IMAGE=' param in '/proc/cmdline'.
> > ( what I described in a previous mail )
>
> That is not mandatory, and thus won't work everywhere ("in a standard
> installation", whatever that means).

Its the loader who passes it on the kernel commandline, LILO does, LOADLIN
does, may be others too.

And honestly, if you have the need to let the kernel know about special
handling, you are free to "append" any private variable to the
commandline. This then would go into the enviroment of /sbin/init, so
/etc/rc can check it.
This also will work for other architectures too as long as they support
the kernel commandline (and I guess they do).

Conclusion: You already have all tools you need.

Hans
<lermen@fgan.de>