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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b46da29d-73ff-4166-b0dd-bf252e9d6457@redhat.com>
Date: Fri, 28 Feb 2025 12:09:10 +1000
From: Gavin Shan <gshan@...hat.com>
To: Suzuki K Poulose <suzuki.poulose@....com>, linux-kernel@...r.kernel.org
Cc: will@...nel.org, catalin.marinas@....com, maz@...nel.org,
 steven.price@....com, aneesh.kumar@...nel.org, robin.murphy@....com,
 linux-arm-kernel@...ts.infradead.org,
 Jean-Philippe Brucker <jean-philippe@...aro.org>,
 Christoph Hellwig <hch@....de>, Marek Szyprowski <m.szyprowski@...sung.com>,
 Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [PATCH v3 2/3] dma: Introduce generic dma_addr_*crypted helpers

On 2/28/25 12:41 AM, Suzuki K Poulose wrote:
> AMD SME added __sme_set/__sme_clr primitives to modify the DMA address for
> encrypted/decrypted traffic. However this doesn't fit in with other models,
> e.g., Arm CCA where the meanings are the opposite. i.e., "decrypted" traffic
> has a bit set and "encrypted" traffic has the top bit cleared.
> 
> In preparation for adding the support for Arm CCA DMA conversions, convert the
> existing primitives to more generic ones that can be provided by the backends.
> i.e., add helpers to
>   1. dma_addr_encrypted - Convert a DMA address to "encrypted" [ == __sme_set() ]
>   2. dma_addr_unencrypted - Convert a DMA address to "decrypted" [ None exists today ]
>   3. dma_addr_canonical - Clear any "encryption"/"decryption" bits from DMA
>      address [ SME uses __sme_clr() ] and convert to a canonical DMA address.
> 
> Since the original __sme_xxx helpers come from linux/mem_encrypt.h, use that
> as the home for the new definitions and provide dummy ones when none is provided
> by the architectures.
> 
> With the above, phys_to_dma_unencrypted() uses the newly added dma_addr_unencrypted()
> helper and to make it a bit more easier to read and avoid double conversion,
> provide __phys_to_dma().
> 
> Suggested-by: Robin Murphy <robin.murphy@....com>
> Cc: Will Deacon <will@...nel.org>
> Cc: Jean-Philippe Brucker <jean-philippe@...aro.org>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Robin Murphy <robin.murphy@....com>
> Cc: Steven Price <steven.price@....com>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Marek Szyprowski <m.szyprowski@...sung.com>
> Cc: Tom Lendacky <thomas.lendacky@....com>
> Cc: Aneesh Kumar K.V <aneesh.kumar@...nel.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
> ---
> Changes since v2:
>   - Rename helpers- s/dma_*crypted/dma_addr_*crypted (Robin)
> ---
>   include/linux/dma-direct.h  | 12 ++++++++----
>   include/linux/mem_encrypt.h | 23 +++++++++++++++++++++++
>   2 files changed, 31 insertions(+), 4 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@...hat.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ