LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-13-2004, 06:03 AM   #1
shogun1234
Member
 
Registered: May 2004
Posts: 226

Rep: Reputation: 15
Unkown symbol Error


Who knows how to solve "unknown symbol" error when `insmod probe.ko`?
I enconter this problem when writing a simple module with a function named "kallsyms_lookup_name" inside.
The error when `insmod probe.ko` is as bleow:
===========insmod ERROR==========BEG
probe: Unknown symbol kallsyms_lookup_name
probe: Unknown symbol register_kprobe
insmod: error inserting `porbe.ko`: -1 Unknown symbol in module
===========insmod ERROR==========END
my module source code is separated to kernel source; where kernel source is locateed at $HOME/kernel/linux-`uname -r` and module source at $HOME/program/kernel/module/sample.

the compile command is : make -C $HOME/kernel/linux-`uname -r` SUBDIRS=$PWD modules
there's no error message except one warning "*** Warning: "kallsyms_lookup_name" [/root/program/kernel/module/sample/probe.ko] undefined!"
and I can find symbol in System.map as well as /proc/kallsyms.
some one told me to enable the option "CONFIG_KALLSYMS", set to 'y'.
and I found out that the option was enabled[set to y] in my .config, located in the $HOME/kernel/linux-`uname -r`(which is my kernel source).
I don't know what to do now. I know this may be a newbie question, but I have no idea how to solve it for few weeks, even though I read the makefile.txt and modules.txt located in the $KERNEL_SOURCE/Documentation/kbuild.
I appreciate any suggestion, sincerely.

==========Makefile==========BEG
obj-m += probe.o
==========Makefile==========END
===========System.map==========BEG
c0135190 t add_kallsyms
c0136100 T module_kallsyms_lookup_name
c0136610 T kallsyms_lookup_name
c01366f0 T kallsyms_lookup
c0136c40 t kallsyms_open
c0136cb0 t kallsyms_release
c0429b00 D kallsyms_op
c0429b20 d kallsyms_operations
c0486344 D kallsyms_addresses
c04947c0 D kallsyms_num_syms
c04947c4 D kallsyms_names
c04dd030 T kallsyms_init
c04f4cc0 t __initcall_kallsyms_init
===========System.map==========END
============/proc/kallsyms==========BEG
c0135190 t add_kallsyms
c0136100 t module_kallsyms_lookup_name
c0136610 t kallsyms_lookup_name
c01366f0 t kallsyms_lookup
c0136c40 t kallsyms_open
c0136cb0 t kallsyms_release
c04dd030 t kallsyms_init
============/proc/kallsyms==========END

============probe.c===============BEG
#include <linux/kallsyms.h>
#include <linux/init.h>

#include <linux/module.h>
#include <linux/kernel.h>


/* kprobes */
#include <linux/kprobes.h>

int
handler_pre(struct kprobe *p, struct pt_regs *regs)
{
printk("pre_hanlder: p->addr=0x%p, eflags=0x%lx\n",
p->addr, regs->eflags);
return 0;
}

void
handler_post(struct kprobe *p, struct pt_regs *regs, unsigned long eflags)
{
printk("post_handler: p->addr=0x%p, eflags=0x%lx \n",
p->addr, regs->eflags);
}

int
handler_fault(struct kprobe *p, struct pt_regs *regs, int trapnr)
{
printk("fault_handler->addr=0x%p, eflags=0x%lx\n",
p->addr, regs->eflags);
return 0;
}

int
init_module(void)
{
struct kprobe kp;

printk(KERN_ALERT"init module!\n");
kp.pre_handler=handler_pre;
kp.post_handler=handler_post;
kp.fault_handler=handler_fault;
kp.addr=(kprobe_opcode_t *)kallsyms_lookup_name("do_fork");
if(kp.addr==NULL){
printk("kallsyms_lookup_name could not find address for the specified sumbol name!\n");
return 1;
}
register_kprobe(&kp);
return 0;
}

void
cleanup_module()
{
printk(KERN_ALERT"cleanup module!\n");
}


============probe.c===============END
 
Old 08-17-2005, 04:45 AM   #2
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Re: Unkown symbol Error

Quote:
Originally posted by shogun1234
Who knows how to solve "unknown symbol" error when `insmod probe.ko`?
I enconter this problem when writing a simple module with a function named "kallsyms_lookup_name" inside.
The error when `insmod probe.ko` is as bleow:...
Dunno whether that is still of interest nor am I by any means specialist here, but:
  • there is an existing program KProbe in KDE. Collision?
  • you have a "insmod: error inserting `porbe.ko`" in the message from the system. Typo in the make file?
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
snort failed: snort: symbol lookup error: undefined symbol: usmAES192PrivProtocol Emmanuel_uk Linux - Security 1 07-10-2005 10:29 AM
error: unresolved external symbol purefan Programming 3 03-26-2005 07:27 AM
wacom.ko has unkown symbol? bobbens Debian 0 01-16-2005 06:14 AM
Firefox Symbol Lookup Error Aeiri Linux - Software 2 11-16-2004 04:30 PM
Unkown Host Error- internet malikk Linux - Newbie 3 05-24-2004 10:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:14 AM.

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