kmod ideas

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

 



Hi all,

	I was looking at the implementation of the LKM and more precisely of the
kmod subsystem.

The function request_module load a module with the help of a user process. 
I agree that it's more secure, more efficient :)
But it's quite annoying. Here is an example : ext3 module request the block 
device driver modules. At the boot of a machine, the hotplug (a userspace 
programm) will detect an ext3 partition.
It will load the ext3 module, which will load the block device driver module.

Here is a little scheme :

module_load(ext3)        module_load(block_device_driver)
        |                  |                          |     USER SPACE
        |                  |                          |
        |                  |                          |
-----------------------------------------------------------------------
        |                  |                          |
        |                  |                          |    KERNEL SPACE	
        |                  |                          |
	request_module(block_device_driver)          load_module(block_device_driver)
	& load_module(ext3)

It's clearly not beautiful :) a lot of switch between user space and kernel
space.
In fact, this subsystem relies on the non stupidity of the administrator 
or some user space soft : it's more efficient to load block_device_driver 
module first and ext3 module secondly.

I've tried to think at a better implementation but I did not find one. :)

But I think I've found a little "bug".

In fact, the function request_module does not test if the requested_module 
is already listed : the user mode helper process is launched in all the 
cases.
I think it would be more efficient to test it.

I was a little sceptic by my understanding of the system so I made some 
tests to be sure.

Tests
------

I've replace the /sbin/modprobe binary with a little script which prints 
a dummy message in a file.
And I've written a module with the following init function :

int __init loading(void)
{
	request_module(smbfs);
	
	return 0;
}

1st test
--------

At first, I load the module with insmod.
My modprobe script is effectively launched (creation of a file).

2nd test
--------

I load smbfs (with the real modprobe binary) and I re load the module.
My modprobe script is launched again.

There are 2 solutions : 
	_ searching the name in module_list
	_ or adding a hash list of modules (to improve the looking of 
	  a module)

Which one is the best ?

And is my understandfing good too ?:)

Thanks

-- 
tyler
tyler@xxxxxxxx


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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