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: <0f16dd5a-bce7-0e36-3827-f713e90fb843@infradead.org>
Date:   Fri, 18 Aug 2023 16:04:08 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Devaraj Rangasamy <Devaraj.Rangasamy@....com>,
        Jonathan Corbet <corbet@....net>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        "H . Peter Anvin" <hpa@...or.com>,
        Jens Wiklander <jens.wiklander@...aro.org>,
        Sumit Garg <sumit.garg@...aro.org>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Daniel Sneddon <daniel.sneddon@...ux.intel.com>,
        Rijo Thomas <Rijo-john.Thomas@....com>,
        SivaSangeetha SK <SivaSangeetha.SK@....com>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        Juergen Gross <jgross@...e.com>,
        Ard Biesheuvel <ardb@...nel.org>,
        Ross Lagerwall <ross.lagerwall@...rix.com>,
        Yuntao Wang <ytcoode@...il.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Tom Lendacky <thomas.lendacky@....com>,
        Mario Limonciello <mario.limonciello@....com>,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        op-tee@...ts.trustedfirmware.org
Cc:     Mythri PK <Mythri.Pandeshwarakrishna@....com>,
        Nimesh Easow <Nimesh.Easow@....com>
Subject: Re: [PATCH] tee: amdtee: add support for use of cma region

Hi--

On 8/18/23 07:42, Devaraj Rangasamy wrote:
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 722b6eca2e93..5e38423f3d53 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -363,6 +363,13 @@
>  			  selects a performance level in this range and appropriate
>  			  to the current workload.
>  
> +	amdtee_cma=nn	[HW,TEE]
> +			Sets the memory size reserved for contiguous memory
> +			allocations, to be used by amdtee device driver.
> +			Value is in MB and can range from 4 to 128 (MBs)

			                                       128 (MBs).

> +			CMA will be active only when CMA is enabled, and amdtee is

	That could use some improvement. How about:

			AMD-TEE CMA will be active only when CONFIG_CMA is enabled,
			and amdtee is

> +			built as inbuilt driver, and not loaded as module.
> +
>  	amijoy.map=	[HW,JOY] Amiga joystick support
>  			Map of devices attached to JOY0DAT and JOY1DAT
>  			Format: <a>,<b>

> diff --git a/drivers/tee/amdtee/Kconfig b/drivers/tee/amdtee/Kconfig
> index 191f9715fa9a..5843c739a7b8 100644
> --- a/drivers/tee/amdtee/Kconfig
> +++ b/drivers/tee/amdtee/Kconfig
> @@ -6,3 +6,12 @@ config AMDTEE
>  	depends on CRYPTO_DEV_SP_PSP && CRYPTO_DEV_CCP_DD
>  	help
>  	  This implements AMD's Trusted Execution Environment (TEE) driver.
> +
> +config AMDTEE_CMA_SIZE
> +	int "Size of Memory in MiB reserved in CMA for AMD-TEE"
> +	default "0"

Why won't this default value cause an allocation error message?
Maybe I'm just not following the call paths correctly.

It looks to me like this causes a call to
cma_declare_contiguous_nid() with @size = 0, and that function says:

	if (!size)
		return -EINVAL;

> +	depends on CMA && (AMDTEE=y)
> +	help
> +	  Specify the default amount of memory in MiB reserved in CMA for AMD-TEE driver

	                                                                          driver.

> +	  Any amdtee shm buffer allocation larger than 64k will allocate memory from the CMA

	                                                                                 CMA.

> +	  The default can be overridden with the kernel commandline parameter "amdtee_cma".
> \ No newline at end of file

Please fix that ^^^ warning.

Thanks.
-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ