Re: msgsnd in module

From: Robert Hancock
Date: Wed Feb 23 2005 - 19:01:35 EST


Vijayalakshmi Hadimani wrote:
Hi,
I am inserting a module(device driver) using insmod. I want to send a message from this module to an user process.
For this I used msgsnd with buffer in the call as a local variable. I am getting an error "EFAULT" for this call. However this did not happen when I made the driver code as a
part of kernel and not as a module. Any idea about what could
be the problem and how to solve it?

Well, first off, sending SysV messages from the kernel is a pretty bizarre thing to do. Secondly, you can't just call the system call from inside the kernel and pass in kernel memory, because the system call expects to deal with user-space memory. You'd have to duplicate some or all of the code of msgsnd and change it to just read the memory directly instead of using copy_from_user, etc.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/