LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-12-2005, 12:03 AM   #1
arunachalam
Member
 
Registered: Sep 2005
Posts: 53

Rep: Reputation: 15
modules in kernel


Sir,

"Modules contain unresolved symbols that are linked into the kernel when the module is loaded"
-- what are unresolved symbols here?

"kernel modules can only do some of the things that
built-in code can do - they do not have access to
internal kernel symbols"
-- what are internal kernel symbols?


Regards,
Arunachalam.
 
Old 12-12-2005, 08:55 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,642
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
First, the concept...

A "kernel module" is a loadable part of the Linux kernel. You can ask for the module to be loaded, and it incorporates itself into the kernel. Later, the module can also be un-loaded. Very handy.

Now, the question... what, do you think, would be involved in actually doing something like this? Well, let's see...
  • Kernel-space memory has to be carved-out to hold the module. (No sweat...)
  • The kernel-module image has to be moved into that space, and relocated to run at the chosen address. (Okay, that's easy enough...)
  • When this kernel module needs to call a routine located elsewhere in the kernel, it has to be able to find it... to plug in the correct address. (Hmmm....)
To accomplish this third step:
  1. The kernel-module must provide a list of the routines that it needs to call, and the locations within itself where those calls occur. Easy enough, since all compilers and linkers support this idea.
  2. The kernel-module loader must have access to a list of all of the "public symbols" now in the kernel: the name of each routine and the corresponding address. That's in /proc/ksyms.
  3. The kernel-module loader must match-up the two lists, so that it can insert the proper address into the binary code it's about to load. (This is called resolving the symbols.)
  4. Once the module is successfully loaded, or unloaded, the 'ksyms' list must also be updated accordingly.
There are, therefore, two caveats:
  1. If any symbol needed by the kernel module cannot be found in 'ksyms,' then name-resolution is impossible. The symbols are unresolved, and that means that the kernel-loader can't build a usable module, so the module cannot be loaded at all.
  2. The only symbols that a kernel-module can have access to are those which are listed in 'ksyms.' The kernel-module loader doesn't know how to find any ones that aren't listed there.
Okay so far? Good.

Now, what's the other way that we can get a module of code to be "part of the kernel?" Yes, exactly. We could have compiled it directly into the kernel-image, and then installed that image and rebooted the system. The linker, which builds the image file, does have access to a much larger list of symbols... not just the ones that will be listed in "ksyms." On the other hand, the addresses that are listed in "ksyms" are ones which the designers of the software anticipated would be called by kernel-modules, or that would be of interest to debuggers. Those symbols are unlikely to change from one release of the software to the next.

Last edited by sundialsvcs; 12-12-2005 at 09:07 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel: No module symbols loaded - kernel modules not enabled. Qucho Debian 9 05-26-2004 02:50 AM
Kernel Modules and modules.conf init Linux - General 0 02-20-2004 06:51 PM
new kernel (2.4.22 up from 2.4.20-6) - missing modules - use old modules? Simon Bridge Linux - Software 1 02-04-2004 05:52 AM
How to keep modules/drivers across kernel recompiles and kernel versions? Pisces107 Linux - General 5 01-21-2004 08:29 PM
Kernel modules: why are some kernel modules zipped? hampel Slackware 3 06-30-2003 06:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration