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, 18 Dec 2018 11:43:08 -0700
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Stephen Warren <swarren@...dotorg.org>,
        Christoph Hellwig <hch@....de>
Cc:     Tariq Toukan <tariqt@...lanox.com>, xavier.huwei@...wei.com,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        Doug Ledford <dledford@...hat.com>
Subject: Re: [RFC PATCH] net/mlx4: Get rid of page operation after
 dma_alloc_coherent

On Tue, Dec 18, 2018 at 10:45:21AM -0700, Stephen Warren wrote:

> There are two allocation paths; one using dma_alloc_coherent and one using
> alloc_pages. (The hns driver only has the dma_alloc_coherent path.) These
> both store allocations into an sg list which is stored in a table, and that
> table is searched by a single function mlx4_table_find() irrespective of
> which allocation path was used, so if one of the allocation paths is updated
> to store the CPU virtual address differently, then both paths need to be
> updated so they match, so that the single table search path can continue to
> have a single implementation.

So the problem here is that on some arches

 sg_set_buf(sg, dma_coherent_buf, size)
 p = sg_virt(sg);
 assert(p == dma_coherent_buf);

Doesn't work or crashes? Is this how sgl should work?

But if you accept this and don't do the sg_set_buf then the
scatterlist is substantially broken, many of the APIs related to it
will not work as expected at all.

So, I don't think drivers should create such a broken scatterlist or
arches should not have this problem (ie the mathematical
transformation to struct page * and back to virtual address should
work in the coherent space even if there are no backing struct pages
allocated)?

What do you think CH?

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ