lkml.org 
[lkml]   [2009]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectget_user_pages question
Date
Hello all!

I have searched the list for similar issues and have not found an answer so I
am posting.

I am using 'get_user_pages' and friends to get a hold of user memory in kernel
space. User space passes buffer to kernel, kernel does get_user_pages, holds
them for some time while user space is doing something else, writes to the
pages and then releases them (SetPageDirty and page_cache_release as per LDD
3rd edition). So far so good.

I am testing this kernel module with several buffers from user space allocated
in several different ways. heap, data segment, static variable in function and
stack. All scenarious work EXCEPT the stack one. When passing the stack buffer
the kernel sees one thing while user space sees another.

My not so intelligent questions (they may well be off the mark):
- How can this be? (two views of the same page)
- Does not 'get_user_pages' pin the pages?
- Could this be due to stack protection of some sort?
- Do I need to do anything extra with the vm_area I receive for the stack
pages EXCEPT 'get_user_pages' ?

I know this is not an orthodox method to write a driver and I better use mmap
for these things but I have other constrains in this driver design that I do
not want to bore you with. I am also awara that passing a buffer on stack and
letting user space continue running is a very dangerous thing to do for user
space (or kernel space) integrity. I wish I could do it another way...

The platform is x86 32 bit standad with standard kernels and headers
distributed with ubuntu 9.04 and 9.10 which are 2.6.28 and 2.6.31.

Please reply to my email as well as I am not a subscriber.

Cheers,
Mark


\
 
 \ /
  Last update: 2009-11-09 07:53    [W:0.264 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site