lkml.org 
[lkml]   [2020]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] dma-direct: zero out DMA_ATTR_NO_KERNEL_MAPPING buf
On Mon, Sep 07, 2020 at 09:02:34AM +0200, Marek Szyprowski wrote:
> > That's not a reason ... that comment was put in for coherent mappings.
> > What is the reason we should incur all this expense for clearing pages
> > which aren't unmapped in the kernel, because we can update the comment?
> > The usual rationale for kernel mapped pages is security, because they
> > may leak information but unmapped pages shouldn't have this problem.
>
> Any dma_alloc_attrs() buffer might be mmaped to userspace, so the
> security reason is still valid. Possible lack if kernel mapping was only
> a hint that driver doesn't need it, so it might be skipped on some
> architectures, where creating it requires significant resources (i.e.
> vmalloc area).

Yes. It seems actually mapping it to userspace in media/drm drivers
seems to be one of the big use cases. There other one is memory not
used by the host at all and just as an extra buffer for hardware so
that the PCIe device can cut down on DRAM cost. For that could
potentially skip the zeroing, but then again you'd need to trust the
device, which with thunderbolt might not always be a good idea.

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