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: <ZkJGLV5FfEPmdoG-@arm.com>
Date: Mon, 13 May 2024 17:56:13 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Steven Price <steven.price@....com>
Cc: kvm@...r.kernel.org, kvmarm@...ts.linux.dev,
	Marc Zyngier <maz@...nel.org>, Will Deacon <will@...nel.org>,
	James Morse <james.morse@....com>,
	Oliver Upton <oliver.upton@...ux.dev>,
	Suzuki K Poulose <suzuki.poulose@....com>,
	Zenghui Yu <yuzenghui@...wei.com>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Joey Gouly <joey.gouly@....com>,
	Alexandru Elisei <alexandru.elisei@....com>,
	Christoffer Dall <christoffer.dall@....com>,
	Fuad Tabba <tabba@...gle.com>, linux-coco@...ts.linux.dev,
	Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>
Subject: Re: [PATCH v2 08/14] arm64: Enforce bounce buffers for realm DMA

On Fri, Apr 12, 2024 at 09:42:07AM +0100, Steven Price wrote:
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 786fd6ce5f17..01a2e3ce6921 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -370,7 +370,9 @@ void __init bootmem_init(void)
>   */
>  void __init mem_init(void)
>  {
> -	bool swiotlb = max_pfn > PFN_DOWN(arm64_dma_phys_limit);
> +	bool swiotlb = (max_pfn > PFN_DOWN(arm64_dma_phys_limit));

This series tends to add unnecessary brackets.

> +
> +	swiotlb |= is_realm_world();

I first thought we wouldn't need this, just passing 'true' further down
but I guess you want to avoid reducing the bounce buffer size when it's
only needed for kmalloc() bouncing.

>  
>  	if (IS_ENABLED(CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC) && !swiotlb) {
>  		/*
> @@ -383,7 +385,12 @@ void __init mem_init(void)
>  		swiotlb = true;
>  	}
>  
> -	swiotlb_init(swiotlb, SWIOTLB_VERBOSE);
> +	if (is_realm_world()) {
> +		swiotlb_init(swiotlb, SWIOTLB_VERBOSE | SWIOTLB_FORCE);
> +		swiotlb_update_mem_attributes();
> +	} else {
> +		swiotlb_init(swiotlb, SWIOTLB_VERBOSE);
> +	}

Just do this higher up and avoid calling is_realm_world() twice:

	unsigned int flags = SWIOTLB_VERBOSE;

	...

	if (is_realm_world()) {
		swiotlb = true;
		flags |= SWIOTLB_FORCE;
	}

	...

	swiotlb_init(swiotlb, flags);

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ