LinuxQuestions.org
Help answer threads with 0 replies.
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 02-21-2004, 11:04 PM   #1
Kurt M. Weber
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 335

Rep: Reputation: 35
rmmod segfaulting and causing lsmod to hang withh 2.6.3 kernel


OK, I'm getting into kernel devel, and to learn the API I've got a useless module I'm writing. Right now, all it does is printk something on load and something else on unload. I can insmod it fine, but when I rmmod it, it simply segfaults. After I do rmmod, anytime I run lsmod, it simply hangs and I cannot kill it! I cannot kill it! The damned beast simply WILL NOT DIE! DIE, BEAST, DIE! DIE! BWA-HA-HA-HA-HA!

But yeah, rmmod and lsmod are acting retarded. Any ideas?
 
Old 02-21-2004, 11:06 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
I'm not sure if this is it but in the latest 2.6.x kernel series, you compile in support to remove modules, etc. Do you have such support?
 
Old 02-21-2004, 11:10 PM   #3
Kurt M. Weber
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 335

Original Poster
Rep: Reputation: 35
Yes, I did that.

Earlier I was trying to remove the same module, and it explicitly told me that I hadn't compiled support for module unloading in. So I recompiled with unloading support, and now things just go all to hell rather than a nice, polite error message
 
Old 02-22-2004, 11:55 AM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
What's your source code? Have you correctly initialize each struct?
 
Old 02-24-2004, 11:42 PM   #5
Kurt M. Weber
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 335

Original Poster
Rep: Reputation: 35
So far, this is it (eventually, it's going to be a driver for a device similar to /dev/zero, except it spits out 'z's instead of '0's):
Code:
#include <linux/module.h>
#include <linux/config.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");
static int __init init_zdrv(void) {
    printk(KERN_DEBUG "Z driver loaded\n");
    return 0;
}
static void __exit exit_zdrv(void) {
   printk(KERN_DEBUG "Z driver unloaded\n");
}
module_init(init_zdrv);
module_exit(exit_zdrv);

Last edited by Kurt M. Weber; 02-24-2004 at 11:43 PM.
 
Old 02-25-2004, 12:51 PM   #6
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
I test this code with my 2.4.24 kernel and everything went fine. Note that I have to add "#include <linux/kernel.h>" for printk purposes and I have also removed "#incude <linux/config.h> which was not necessary for me.
I also look about "Migrating device drivers to Linux kernel 2.6" and your code seems to be good. So the question is: do you have already had such behaviour with other modules with your 2.6 kernel? (I suppose the answer is no, but we never know)
the last advice I can give you to debug it is to use UML (User Mode Linux of course )
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
wlan0 causing SuSE to hang Kintwa Linux - Networking 1 08-02-2005 10:38 PM
iptables causing system to hang @ boot blackdragonblood Linux - General 2 06-23-2005 05:57 PM
How can I determine what is causing my system to hang? lewisdw Linux - Hardware 7 06-16-2004 06:13 PM
Why can't I use lsmod rmmod etc JohnSharp Linux - Newbie 4 04-08-2004 11:11 AM
Kernel recomiling causing system hang XxAndyxX Linux - Software 3 03-05-2003 02:42 AM

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

All times are GMT -5. The time now is 09:04 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration