All of lore.kernel.org
 help / color / mirror / Atom feed
* Handling of user address in vb2_dc_get_userptr()
@ 2013-10-17 21:23 Jan Kara
  2013-10-21  7:22 ` Marek Szyprowski
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2013-10-17 21:23 UTC (permalink / raw)
  To: linux-media; +Cc: Pawel Osciak, Marek Szyprowski, Kyungmin Park

  Hello,

  I'm auditing get_user_pages() users and when looking into
vb2_dc_get_userptr() I was wondering about the following: The address this
function works with is an arbitrary user-provided address. However the
function vb2_dc_get_user_pages() uses pfn_to_page() on the pfn obtained
from VM_IO | VM_PFNMAP vma. That isn't really safe for arbitrary vma of
this type (such vmas don't have to have struct page associated at all). I
expect this works because userspace always passes a pointer to either a
regular vma or VM_FIXMAP vma where struct page is associated with pfn. Am
I right? Or for on which vmas this code is supposed to work? Thanks in
advance for clarification.

								Honza

-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Handling of user address in vb2_dc_get_userptr()
  2013-10-17 21:23 Handling of user address in vb2_dc_get_userptr() Jan Kara
@ 2013-10-21  7:22 ` Marek Szyprowski
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Szyprowski @ 2013-10-21  7:22 UTC (permalink / raw)
  To: Jan Kara, linux-media; +Cc: Pawel Osciak

Hello,

On 2013-10-17 23:23, Jan Kara wrote:
>    I'm auditing get_user_pages() users and when looking into
> vb2_dc_get_userptr() I was wondering about the following: The address this
> function works with is an arbitrary user-provided address. However the
> function vb2_dc_get_user_pages() uses pfn_to_page() on the pfn obtained
> from VM_IO | VM_PFNMAP vma. That isn't really safe for arbitrary vma of
> this type (such vmas don't have to have struct page associated at all). I
> expect this works because userspace always passes a pointer to either a
> regular vma or VM_FIXMAP vma where struct page is associated with pfn. Am
> I right? Or for on which vmas this code is supposed to work? Thanks in
> advance for clarification.

This is known issue. It has been at least partially addresses by the 
following patch:
https://patchwork.linuxtv.org/patch/18978/

I hope that one day it can be addressed fully by changing the 
dma-mapping API in a way it will let drivers to map particular pfn into 
dma address space.

Best regards
-- 
Marek Szyprowski
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-21  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-17 21:23 Handling of user address in vb2_dc_get_userptr() Jan Kara
2013-10-21  7:22 ` Marek Szyprowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.