Re: sys_open undefined! when i try to load module

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

 



On 8/29/06, suman adak <gnusuman@xxxxxxxxx> wrote:
Hi Gourav..

>
> /sbin/ksyms tells you which symbols are exported in running kernel.


i don't find in my FC5...rather i can find /proc/kallsyms....
i do man /proc/kallsyms and got this line:
/proc/kallsyms (since Linux 2.5.71) :  This holds the kernel exported symbol
definitions used by the modules(X)  tools  to  dynamically  link  and bind
loadable modules.  In Linux 2.5.47 and earlier, a similar file with slightly
different syntax was named ksyms.

and i did
[suman@ajit /]$ cat /proc/kallsyms | grep "sys_open"

c0152074 T do_sys_open
c015211e T sys_openat
 c0152139 T sys_open
[suman@ajit /]$

Which says that sys_open is exported. Correct...or could you please tell me
what is this output?

And one more , if i look at source code i could find these line which says
that sys_open has been exported by EXPORT_SYMBOL_GPL(sys_open).
http://lxr.linux.no/source/fs/open.c#L933
look at line 962.
I know symbol which is exported by EXPORT_SYMBOL_GPL() is availavle to only
module which is declared as a  MODULE_LICENSE("GPL")....
So in source code , if it is exported and if i can see through
/proc/kallsyms then why i can't access this symbol? More ever i am literally
confused .

Here is the snippet from man page of "kallsyms"
      A normal kernel only exports symbols that are  used  by  modules.   For
      debugging  you  may  want a list of all the non-stack symbols, not just
      the exported ones.  kallsyms extracts all sections and symbols  from  a
      kernel,  constructs a list of the sections, symbols and their addresses
      and writes a relocatable object containing just the __kallsyms section.
      After  the  __kallsyms section is linked into the kernel and the kernel
      has been booted, any debugger  can  use  the  data  in  the  __kallsyms
      section to get better symbol resolution.

So kallsyms contains all the non-stack symbols, this means gloab
variables and function name, these might or might not be exported, so
you can not rely on kallsyms output. As I told earlier in my append,
"ksyms" is the right command to get the symbols actually exported in
kernel. I dont know what is the corresponding commnad in FC, but I
hope there should be something.

Can anybody please explain me :

1. What is System. map file?
its a file in which contains all the symbols (variables, function
names) defined in kernel image. It has nothing to do with exported
symbols. It contains all the symbols in kernel with their virtual
addresses. This file is created using "nm" utility on kernel image.
One of the use of this file is to make the OOPs message more readable.
2. What is /proc/kallsyms entry? what's the use of this entry?
Mentioned above
3. How can i know all exported sysmbol in kernel and which i can use?
by using ksyms commnad, dont know how to do in FC


> by default in standard kernel, no system call functions are exported,


is it? then how can  you  write your device driver without using any system
call?
Do you mean that if i want to write my driver , i have to compile my kernel?

For writting the device driver, you dont need to call the system call.
System call is the kernel function, exposed to user space through some
tricks. Basically you can say sytem calls are the kernel functions
which can be called from user space application. Device Driver code is
much below in heirarchy, which directly deals with hardware. If we see
OS as layer software, device driver falls somewhere in the lower layer
of operating system, intracting with hardware and system calls fall in
to top layer of OS.

Hope I am not confusing more :-)

regards,
Gaurav



Sorry for the too much question . I am learning kernel programming....Might
be i am making wrong question. Please correct me ......

> if you want to use them, you need to export them explicitly in kernel
> code and recompile and boot you m/c with that newly recomplied kernel
> image.
>
> Gaurav





--
Gaurav
Email: gauravd.chd@xxxxxxxxx
--------------------------------------------
Read my articles at: http://lkdp.blogspot.com
--------------------------------------------
Easy to get air tickets at affordable price,
US to India Air Tickets: www.Ritz-Travel.com
Call at 001-503-848-2299 or mail at info@xxxxxxxxxxxxxxx
--------------------------------------------

--
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