memory mapped files risks(?)

1 view
Skip to first unread message

José Cornado

unread,
Jan 1, 2012, 11:07:05 PM1/1/12
to darwin...@lists.apple.com
Are there any problems with using memory-mapped files to cross boundary (kernel<->user)? Is it discouraged like the use of vn_rdwr?

thanks a lot in advance!!!

--
José Cornado

--

home: http://www.efekctive.com
blog:   http://blogging.efekctive.com
----------------------

Everything has been said before, but since nobody listens we have to keep going back and beginning all over again.

Andre Gide

Quinn "The Eskimo!"

unread,
Jan 3, 2012, 7:08:37 AM1/3/12
to darwin-kernel@lists.apple.com Kernel

On 2 Jan 2012, at 04:07, José Cornado wrote:

> Are there any problems with using memory-mapped files to cross boundary (kernel<->user)?

There's nothing fundamentally broken about sharing a memory mapped file between the kernel and user space. However, as with all shared mappings, you have to be very careful because:

o doing this correctly is difficult, primarily because of the potential race conditions

o there are many potential security issues

o your kernel code must guarantee to not trigger a page fault on the page fault path

This last point is key: keep in mind that all disk and network I/O might potentially be on the page fault path.

* * *

Perhaps you'd like to post some details of your high-level goal. You've asked a bunch of questions that are very much on the edge of what we support for third party KEXTs. If you can give us more context, we should be able to offer better suggestions.

Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


_______________________________________________
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:
http://lists.apple.com/mailman/options/darwin-kernel/darwin-kernel-garchive-95844%40googlegroups.com

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

José Cornado

unread,
Jan 3, 2012, 8:11:50 AM1/3/12
to Quinn The Eskimo!, darwin-kernel@lists.apple.com Kernel
Thanks! I decided to keep the kernel out of the picture for now.

Upon more reading and poking I got to the same memory mine field.

Thanks again!!

Reply all
Reply to author
Forward
0 new messages