Re: Mismatched driver vs. kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/05/07, Rajat Jain <rajat.noida.india@xxxxxxxxx> wrote:
Hi,

>
> Not just that, the kernel you build the module for has to be the
> *exact* kernel you are running and try to load the module into. That
> is, it has to be the exact same version and it has to be build with
> the exact same config.
>

So you are saying that the module should be built with the SAME config
as that of running kernel.

Yes.

I understand that this is RECOMMENDED for

Yes, recommended to say the least. Imagine that you build your kernel
with SMP support, the module UP, if you could load that module into
the kernel bad things would surely happen (and that's just one of many
things that could be mismatched and lead to disaster).

obvious reasons, but is it ENFORCED???

It's somewhat enforced, but not 100% enforced, it is possible to trick
the kernel into loading a module not build specifically from it, but
enough sanity checks are made to make it quite unlikely that you can
accidentally load a module that's not compatible.
If you read the load_module() function from kernel/module.c you'll see
that it checks things like the ELF version, Architecture, version
magic numbers,

Also, if your kernel was build with module versioning enabled, then
the Module.symvers file will, in adition to a list of all exported
symbols, contain a CRC of the full prototype of all symbols, that will
then also be checked on module load.

How? Config information isn't
embedded in the kernel module, right?

A bit actually is, the modmagic/vermagic string - not everything, but
a few of the most important bits. See include/linux/vermagic.h

Also see Documentation/kbuild/modules.txt


--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux