lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Oct 2019 14:34:17 +0200
From:   Thomas Hellström (VMware) 
        <thomas_os@...pmail.org>
To:     Christoph Hellwig <hch@...radead.org>,
        Christian König <christian.koenig@....com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: dma coherent memory user-space maps

Hi, Christoph,

Following our previous discussion I wonder if something along the lines 
of the following could work / be acceptible

typedef unsigned long dma_pfn_t /* Opaque pfn type. Arch dependent. This 
could if needed be a struct with a pointer and an offset */

/* Similar to vmf_insert_mixed() */
vm_fault_t dma_vmf_insert_mixed(struct device *dev,
                 struct vm_area_struct *vma,
                 unsigned long addr,
                 dma_pfn_t dpfn,
                 unsigned long attrs);

/* Similar to vmf_insert_pfn_pmd() */
vm_fault_t dma_vmf_insert_pfn_pmd(struct device *dev,
                   struct vm_area_struct *vma,
                   unsigned long addr,
                   dma_pfn_t dpfn,
                   unsigned long attrs);

/* Like vmap, but takes struct dma_pfns. */
extern void *dma_vmap(struct device *dev,
               dma_pfn_t dpfns[],
               unsigned int count, unsigned long flags,
               unsigned long attrs);

/* Obtain struct dma_pfn pointers from a dma coherent allocation */
int dma_get_dpfns(struct device *dev, void *cpu_addr, dma_addr_t dma_addr,
           pgoff_t offset, pgoff_t num, dma_pfn_t dpfns[]);

I figure, for most if not all architectures we could use an ordinary pfn 
as dma_pfn_t, but the dma layer would still have control over how those 
pfns are obtained and how they are used in the kernel's mapping APIs.

If so, I could start looking at this, time permitting,  for the cases 
where the pfn can be obtained from the kernel address or from 
arch_dma_coherent_to_pfn(), and also the needed work to have a tailored 
vmap_pfn().

Thanks,
/Thomas


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ