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]
Message-ID: <741c6f7d-e36b-4ddf-a92b-9bbed2ce75c2@arm.com>
Date: Tue, 28 Jan 2025 18:53:27 +0000
From: Robin Murphy <robin.murphy@....com>
To: Dima Stepanov <dstepanov.src@...il.com>
Cc: Christoph Hellwig <hch@....de>,
 Marek Szyprowski <m.szyprowski@...sung.com>, iommu@...ts.linux.dev,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/dma: dma_common_find_pages returns pages for
 requested address

On 27/01/2025 5:47 pm, Dima Stepanov wrote:
> On Mon, Jan 27, 2025 at 12:50 PM Robin Murphy <robin.murphy@....com> wrote:
>>
>> No, that's a bug in the caller of dma_mmap_attrs(). As the kerneldoc
>> says, cpu_addr/dma_addr/size must still represent the whole buffer as
>> returned by the allocator - any offset for the mapping itself relative
>> to the start of the buffer is expressed in vma->pgoff.
>>
>> Thanks,
>> Robin.
> 
> I see, thanks for clarification Robin. I was confused, because depending
> on the backend it will work or not work. But i believe that in this case it is
> undefined behavior. That is unfortunate to me, since the idea behind was:
> - The memory allocated once because of device/firmware
> - Different users could request a part of this memory from the kernel and
> mmap it
> 
> And i didn't want to expose this offset information to the user. Wanted to
> rely on the kernel to mmap the proper part of the buffer.

In principle I don't see why you shouldn't be able to create multiple 
files representing different parts of one large buffer - seems like the 
ops for said files would just need to be a bit cleverer, and remain 
aware of the whole buffer as well as the range of their own part within 
it. Then they can adjust vma->vm_pgoff accordingly before calling 
dma_mmap_*() (and possibly perform their own stricter bounds checking as 
well.)

Thanks,
Robin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ