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

LKM kills, where to stop ?



Hi,

While playing around with lkms. i found that the kernel dies after loading a module twice. this seems to be a confict with module names... 
my question is: where do i stop this from happening ? 
in each module ? in modload (userspace) or kernel ? 
is there a rule about what (checks) goes in kernel and what goes in userland ?

 i say kernel land, but thats just a feeling(tm)

sorry about gramma/spelling 
/kij
OpenBSD 3.1-stable (GENERIC) #0: Thu Jun 27 19:16:00 CEST 2002

 
the code below illustrates my problem... (baseed on /usr/share/lkm/syscall)

/* newsyscall.c */
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/mount.h>
#include <sys/exec.h>
#include <sys/lkm.h>
#include <sys/file.h>
#include <sys/errno.h>


int mycall(p, uap, retval)
struct proc *p;
void        *uap;
int         retval[];
{
        /* no arguments, we just print a string */
        printf("syscall done... \n");

        return(0);
}
static struct sysent newent = {
        0,0, mycall
};

/* another name here allow us to overwrite mycall again */   
MOD_SYSCALL("newsyscall", -1, &newent)


static int
loader(lkmtp, cmd)
struct lkm_table *lkmtp;
int              cmd;
{
        if(cmd == LKM_E_LOAD) {
                printf("new syscall added...\n");
        }
        return(0);
}

xxxinit(lkmtp, cmd, ver)
struct lkm_table        *lkmtp;
int                     cmd;
int                     ver;
{
        DISPATCH(lkmtp, cmd, ver, loader, lkm_nofunc, lkm_nofunc)
}