Re: tainted module and rmmod

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

 



Eugene Teo (eugene.teo@eugeneteo.net) wrote:
> > A little question for you: 
> > I have made a mistake: I have written  a module, and forgotten to put a
> > MODULE_LICENCE( "GPL" ); 
> 
> Not putting the MODULE_LICENSE macro in your lkm is
> not a mistake. It merely identifies the license used.
> 

Thanks for this information.

> > So, my kernel is tainted. It is clean normal.
> > But now I am not able to unload this module :-(
> >  * rmmod -a : same response.
> >  * lsmod doesn't seem to see this module. But when I insmod it again :
> >    Ressource busy, which is normal :-)
> 
> Are you sure you loaded the lkm in the first place?
> Check the return value of the initialisation function.
> 
> Also, what did you do in the module that causes it to
> be unable to be unloaded? 
> 
> >  * I have all ready search on linux/Documentation/*, google,
> >    http://www.tux.org/lkml/.
> > 
> > But I have not found what I search.
> > 
> > If you have any idea, I am raedy to learn from you.
> > Perhaps my question is very idiot, sorry if it was :-( 

I am sure it is loaded, because of I can see entry "titux" in /proc.

As another people asks, I put the code. It is really simple. It make an
oops(when I do a: cat /proc/titux), but my problem isn't there for the time.
Yet, I have done the test with an hello world mdoule without
MODULE_LICENCE and I have had the same result.

/* proc_test.c */
#include <linux/module.h>
#include <linux/proc_fs.h>

#define MODVERSIONS

MODULE_LICENSE( "GPL" );
MODULE_AUTHOR( "titux" );

static int titux_read_proc( char *buf , char **start, off_t offset,
        int count, int *eof , void *data )
{
        int len = 0 ;

        buf = kmalloc( 128 , GFP_USER ) ;
        len += sprintf( buf + len, "current pid: %i\n", current->pid );
        *eof = 1 ;
        return len ;
}

void init_module()
{
        printk( "proc_test loaded... ok");
        create_proc_read_entry( "titux", 0, NULL, titux_read_proc , NULL ) ;
}

void cleanup_module()
{
        printk( "proc_test unloaded... ok" );
        remove_proc_entry( "titux", NULL );
}

/* Makefile */
KERNELDIR = /usr/src/linux
CC = gcc 

include $(KERNELDIR)/.config

CFLAGS = -D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -O -Wall

all: proc_test.o

proc_test.o:

clean:
        rm -f *.o *~core

-- 
Cordialement/Regards
+-------------------------------------------------------+
| Christophe Lucas -- IOMEDA SA (clucas@iomeda.fr)      |
| Developpeur/Administrateur GNU/Linux                  |
+-------------------------------------------------------+
| http://titux.tuxfamily.org -- Registered User #271267 |
+-------------------------------------------------------+
--
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