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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Jan 2019 02:32:19 +0000
From:   Peng Fan <peng.fan@....com>
To:     "hch@...radead.org" <hch@...radead.org>
CC:     "mst@...hat.com" <mst@...hat.com>,
        "jasowang@...hat.com" <jasowang@...hat.com>,
        "sstabellini@...nel.org" <sstabellini@...nel.org>,
        "virtualization@...ts.linux-foundation.org" 
        <virtualization@...ts.linux-foundation.org>,
        "xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-remoteproc@...r.kernel.org" <linux-remoteproc@...r.kernel.org>
Subject: RE: [RFC] virtio_ring: check dma_mem for xen_domain

Hi

> -----Original Message-----
> From: hch@...radead.org [mailto:hch@...radead.org]
> Sent: 2019年1月21日 16:29
> To: Peng Fan <peng.fan@....com>
> Cc: mst@...hat.com; jasowang@...hat.com; sstabellini@...nel.org;
> hch@...radead.org; virtualization@...ts.linux-foundation.org;
> xen-devel@...ts.xenproject.org; linux-kernel@...r.kernel.org;
> linux-remoteproc@...r.kernel.org
> Subject: Re: [RFC] virtio_ring: check dma_mem for xen_domain
> 
> On Mon, Jan 21, 2019 at 04:51:57AM +0000, Peng Fan wrote:
> > on i.MX8QM, M4_1 is communicating with DomU using rpmsg with a fixed
> > address as the dma mem buffer which is predefined.
> >
> > Without this patch, the flow is:
> > vring_map_one_sg -> vring_use_dma_api
> >                  -> dma_map_page
> > 		       -> __swiotlb_map_page
> > 		                ->swiotlb_map_page
> > 				->__dma_map_area(phys_to_virt(dma_to_phys(dev,
> dev_addr)), size,
> > dir); However we are using per device dma area for rpmsg, phys_to_virt
> > could not return a correct virtual address for virtual address in
> > vmalloc area. Then kernel panic.
> 
> And that is the right thing to do.  You must not call dma_map_* on memory
> that was allocated from dma_alloc_*.

Understand. But the current code is that vring_use_dma_api will always return
true, if the current OS is a xen VM.

Actually it needs to return false for my case, then we could use sg_phys(sg)
to get the correct physical address.

> 
> We actually have another thread which appears to be for this same issue.

You mean https://patchwork.kernel.org/patch/10742923/ ?

You suggest use cma there, but vring_use_dma_api will still return true if the OS
is running on xen. Then vring_map_one_sg will still runs into __dma_map_area.

In my case, just need vring_use_dma_api to return false and use sg_phys(sg) to
get the correct physical address, whether per dma reserved area or per device cma.

Thanks,
Peng.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ