sending messages from kernel space/ kexts to user space

59 views
Skip to first unread message

me

unread,
Feb 18, 2012, 9:50:56 PM2/18/12
to darwin...@lists.apple.com
I have been examining the kauthORama code on the apple web site. I am interested in monitoring file_open requests. Can anyone direct me to suitable documentation or examples whch explain the way or mechanisms to send messages or strings to user land applications? Would this involve the creation of ports? Can this done in a kext? Can you /should you send messages from a kext?

Thanks,

Trip
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (Darwin...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/darwin-kernel/darwin-kernel-garchive-95844%40googlegroups.com

This email sent to darwin-kernel-...@googlegroups.com

Eric Gorr

unread,
Feb 19, 2012, 12:32:08 AM2/19/12
to me, darwin...@lists.apple.com

On Feb 18, 2012, at 9:50 PM, me wrote:

> I have been examining the kauthORama code on the apple web site. I am interested in monitoring file_open requests. Can anyone direct me to suitable documentation or examples whch explain the way or mechanisms to send messages or strings to user land applications? Would this involve the creation of ports? Can this done in a kext? Can you /should you send messages from a kext?


I might recommend picking up a copy of:

OS X and iOS Kernel Programming [Paperback]
Ole Henry Halvorsen (Author), Douglas Clarke (Author)
• ISBN-10: 1430235365
• ISBN-13: 978-1430235361

also, do a search for Apple's documentation 'Kernel Extension Programming Topics.' It is quite good, but can be a bit dense in some places.

https://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KEXTConcept/KEXTConceptIntro/introduction.html


And, yes, it is certainly possible to send data between user land and a kext.

me

unread,
Feb 19, 2012, 8:56:15 PM2/19/12
to Eric Gorr, darwin...@lists.apple.com
Thanks, Eric! I purchased Amit Singh's book. The review on Halvorsen's book said that it mainly covered device drivers. Is this correct?

Trip

Phil Jordan

unread,
Feb 23, 2012, 5:35:29 AM2/23/12
to Trip, darwin...@lists.apple.com
On Mon, Feb 20, 2012 at 2:56 AM, me <kernelk...@gmail.com> wrote:
> Thanks, Eric! I purchased Amit Singh's book.  The review on Halvorsen's book said that it mainly covered device drivers. Is this correct?

Singh's book is a bit dated at this point, and most of it isn't about
practical kernel programming as such - it's more of a description of
the whole system, going well beyond just the kernel, and with just one
chapter on making your own kexts. Having said that, I still look
things up in it with some regularity, as some things haven't changed
(much) since OSX 10.4. It's around 1200 pages, so even if most of it
isn't of much interest to you, there will undoubtedly be some useful
stuff in there.

Halvorsen's book is rather more practical and focused on kext
programming. Things like memory management, user/kernelspace
communication, synchronisation and threading, debugging, etc. are
generally applicable to all kinds of kernel extension. As you say
there are quite a few chapters for various different types of device
drivers, but IIRC there's also a chapter specifically about
non-device-driver network kexts. Contrary to what the title of the
book suggests, there's no practical info about iOS in there, by the
way, I can only assume that's a marketing gimmick.

Amazon's "look inside" feature is probably your best bet for deciding
what to go for.

(disclosure: I was one of the tech reviewers for the Halvorsen book -
I don't get any incentives, financial or otherwise for recommending
it; note also that I only read an early draft of the book, but as far
as I know the structure stayed the same)

Hope that helps,
phil

Reply all
Reply to author
Forward
0 new messages