Hi,


struct t{
          int (*x)(int);
}fstruct;

main()
{
.
.
fstruct.x = f;
./*write fstruct to a device file*/
.
}

int f(int i)
{
printf("got %d\n",i);
return i;
}


i pass this structure to kernel module by writting to device file.
the write function of module is like

..
..
char *kbuf;
struct t *fstruct;
kbuf = kmalloc(count*sizeof(char), GFP_KERNEL);
copy_from_user((void*)kbuf,(void*)buf,count);
if( (filp->f_flags & O_ACCMODE)    == O_WRONLY)
fstruct = (struct t*)kbuf;
printk("calling from kernel:%d\n",(fstruct->x)(8));
...

Now, is there any problem in executing a user space function in a kernel
module
by just passing a function pointer to the module????

In Linux, is it possible to execute a function in kernel which is a part of
user application
and hence a part of user address space??

Thanks,
daljeet



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to