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: <1a19722b2f979cf34125ec562523ddf0ea8e0b26.camel@intel.com>
Date: Wed, 13 Aug 2025 11:07:33 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Reshetova, Elena" <elena.reshetova@...el.com>, "Hansen, Dave"
	<dave.hansen@...el.com>
CC: "seanjc@...gle.com" <seanjc@...gle.com>, "mingo@...nel.org"
	<mingo@...nel.org>, "Scarlata, Vincent R" <vincent.r.scarlata@...el.com>,
	"x86@...nel.org" <x86@...nel.org>, "jarkko@...nel.org" <jarkko@...nel.org>,
	"Annapurve, Vishal" <vannapurve@...gle.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "Mallick, Asit K" <asit.k.mallick@...el.com>,
	"Aktas, Erdem" <erdemaktas@...gle.com>, "Cai, Chong" <chongc@...gle.com>,
	"Bondarevska, Nataliia" <bondarn@...gle.com>, "linux-sgx@...r.kernel.org"
	<linux-sgx@...r.kernel.org>, "Raynor, Scott" <scott.raynor@...el.com>
Subject: Re: [PATCH v13 4/5] x86/sgx: Implement ENCLS[EUPDATESVN]


>  
> +/* Counter to count the active SGX users */
> +static int sgx_usage_count;
> 

[...]

> + * Return:
> + * %0:			- Success or not supported
> + * %-EAGAIN:	- Can be safely retried, failure is due to lack of
> + *				entropy in RNG
> + * %-EIO:		- Unexpected error, retries are not advisable
> + */

This time I actually downloaded those patches and applied to my local, and
I found the descriptions of the error codes are not vertically aligned.

Please fix (and it's sad we still need to fix this type of thing in v13).

Nit: as said before, the k-doc comment doc says:

    .. in order to produce the desired line breaks, you need to use a ReST
    list, e. g.:

    * Return:
    * * %0            - OK to runtime suspend the device
    * * %-EBUSY       - Device should not be runtime suspended

(hint: there's an additional '*' before the '%'.)

But I guess it's just a nit but not a blocker.

> +static int __maybe_unused sgx_update_svn(void)
> +{
> +	int ret;
> +
> +	/*
> +	 * If EUPDATESVN is not available, it is ok to
> +	 * silently skip it to comply with legacy behavior.
> +	 */
> +	if (!cpu_feature_enabled(X86_FEATURE_SGX_EUPDATESVN))
> +		return 0;
> +
> +	/*
> +	 * EPC is guaranteed to be empty when there are no users.
> +	 * Ensure we are on our first user before proceeding further.
> +	 */
> +	WARN(sgx_usage_count != 1, "Elevated usage count when calling EUPDATESVN\n");

It seems you are obsessed to use "!= 1", rather than "!= 0".

IIUC, Dave suggested the latter [*]:

    	/* EPC is guaranteed to be empty when there are no users: */
	WARN(count, "Elevated usage count...");

.. which is my natural response too.

And the odd is I actually need to look at the next patch to see why "!= 1"
is used.

[*]
https://lore.kernel.org/linux-sgx/20250801112619.1117549-1-elena.reshetova@intel.com/T/#m2225b27448de868a7bc1b86ed7f2ee784367ba84

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ