Welcome! Log In Create A New Profile

Advanced

IPC From Kernel

Posted by joshpowers 
IPC From Kernel
January 27, 2011 06:21PM
Howdy,

I am a complete Linux noob, just to get that out of the way up front. With that said I have built an LSM and compiled it into my kernel allowing myself to stack a Kernel Module into a couple of LSM hooks (just for testing/experimenting).

Now in my Kernel Module that is hooking into the LSM I am intercepting attempts to read the file system, reading the file in question, hashing it and I would like to now pass that hash over to a userland app and have it make a decision about the file access (allow/deny sort of thing).

I had planned on using Domain Sockets from the kernel to communicate with a userland process and then to reply back with my answer. However I am stumped. When I attempt to use any of the socket sys calls (socket(), send(), bind(), ect) I realize that those functions are not in linux/un.h and linux/net.h ect. They are in sys/un.h and sys/net.h ect. However as far as I can tell sys/*.h is all usermode stuff so I cannot import them.

I then fiddled about with trying to use sys_socket(), sys_send(), ect which in an excited moment does compile, however I realize that these functions are not exported for my use, I get warnings from the compiler about the problem.

Hopefully that is enough background, so now my question. Am I barking up the wrong tree entirely? Is there a different approach to getting the info to userland and back? If I should be using Domain Sockets, what am I missing to get them working in the kernel?

I have been searching about the topic for an entire day now so I apologize is it is something obvious.

Thank you in advance for any help.
Re: IPC From Kernel
March 22, 2011 04:33PM
Well it has been an interesting ride. I learned a lot since I asked this question and figured I should clean up the hanging question.

I ended up using generic netlink sockets to do my IPC from my kernel. In the kernel there are special functions for that use and in userland you use the socket interface.
Re: IPC From Kernel
August 19, 2017 03:23AM
I had planned on using Domain Sockets from the kernel to communicate with a userland process and then to reply back with my answer. However I am stumped. When I attempt to use any of the socket Free September Calendar 2017 Useful information Free October Calendar 2017 Free November Calendar 2017
free December Calendar 2017
sys calls (socket(), send(), bind(), ect) I realize that those functions are not in linux/un.h and linux/net.h ect. They are in sys/un.h and sys/net.h ect. However as far as I can tell sys/*.h is all usermode stuff so I cannot import them.
mahjongg connect free
August 23, 2017 02:24AM
Nice post, Thanks for sharing me this mahjongg connect free online game is an amazing game it the the board game developed in 1967 in china we love to play this game online.
printable calendar template
September 24, 2017 05:50AM
When you use any calendar then our printable calendar help you. So visit our website.


november 2017 calendar with holiday
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 19 plus 9?
Message: