[lkml]   [2000]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectexecuting a user space function in kernel module

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

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);
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
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??


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:39    [W:0.034 / U:2.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site