msgsnd in module
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Vijayalakshmi Hadimani
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.