Re: get_user_pages question

From: Andi Kleen
Date: Mon Nov 09 2009 - 04:31:32 EST


Mark Veltzer <mark.veltzer@xxxxxxxxx> writes:
>
> 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.

In theory it should work, stack is no different from any other pages.
First thought was that you used some platform with incoherent caches,
but that doesn't seem to be the case if it's standard x86.

> My not so intelligent questions (they may well be off the mark):
> - How can this be? (two views of the same page)

It should not be on a coherent platform.

> - Does not 'get_user_pages' pin the pages?

Yes it does.

> - Could this be due to stack protection of some sort?

No.

> - Do I need to do anything extra with the vm_area I receive for the stack
> pages EXCEPT 'get_user_pages' ?

No. Stack is like any other user memory.

Most likely it's some bug in your code.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/