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: <yq5ams39txvk.fsf@kernel.org>
Date: Tue, 23 Dec 2025 13:48:07 +0530
From: Aneesh Kumar K.V <aneesh.kumar@...nel.org>
To: Suzuki K Poulose <suzuki.poulose@....com>, linux-kernel@...r.kernel.org,
	iommu@...ts.linux.dev, linux-coco@...ts.linux.dev
Cc: Catalin Marinas <catalin.marinas@....com>, will@...nel.org,
	maz@...nel.org, tglx@...utronix.de, robin.murphy@....com,
	akpm@...ux-foundation.org, jgg@...pe.ca, steven.price@....com
Subject: Re: [PATCH v2 4/4] dma: direct: set decrypted flag for remapped dma
 allocations

Suzuki K Poulose <suzuki.poulose@....com> writes:

> On 21/12/2025 16:09, Aneesh Kumar K.V (Arm) wrote:
>> Devices that are DMA non-coherent and need a remap were skipping
>> dma_set_decrypted(), leaving buffers encrypted even when the device
>> requires unencrypted access. Move the call after the remap
>> branch so both paths mark the allocation decrypted (or fail cleanly)
>> before use.
>> 
>> Fixes: f3c962226dbe ("dma-direct: clean up the remapping checks in dma_direct_alloc")
>> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@...nel.org>
>> ---
>>   kernel/dma/direct.c | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>> 
>> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
>> index 3448d877c7c6..a62dc25524cc 100644
>> --- a/kernel/dma/direct.c
>> +++ b/kernel/dma/direct.c
>> @@ -271,9 +271,6 @@ void *dma_direct_alloc(struct device *dev, size_t size,
>>   	if (remap) {
>>   		pgprot_t prot = dma_pgprot(dev, PAGE_KERNEL, attrs);
>>   
>> -		if (force_dma_unencrypted(dev))
>> -			prot = pgprot_decrypted(prot);
>
> This would be problematic, isn't it ? We don't support decrypted on a
> vmap area for arm64. If we move this down, we might actually use the
> vmapped area. Not sure if other archs are fine with "decrypting" a
> "vmap" address.
>
> If we map the "vmap" address with pgprot_decrypted, we could go ahead
> and further map the linear map (i.e., page_address(page)) decrypted
> and get everything working.

We still have the problem w.r.t free

dma_direct_free():

	if (is_vmalloc_addr(cpu_addr)) {
		vunmap(cpu_addr);
	} else {
		if (dma_set_encrypted(dev, cpu_addr, size))
			return;
	}

-aneesh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ