Re: [PATCH v2] arch/x86: Fix size overflows in sgx_encl_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 04, 2025 at 04:30:21PM -0800, Dave Hansen wrote:
> On 3/4/25 16:19, Jarkko Sakkinen wrote:
> > On Tue, Mar 04, 2025 at 04:18:03PM -0800, Dave Hansen wrote:
> >> On 3/4/25 16:06, Jarkko Sakkinen wrote:
> >>> +	/*
> >>> +	 * This is a micro-architectural requirement. ECREATE would detect this
> >>> +	 * too without mentionable overhead but this check guarantees also that
> >>> +	 * the space calculations for EPC and shmem allocations never overflow.
> >>> +	 */
> >>> +	if (!is_power_of_2(secs->size))
> >>> +		return -EINVAL;
> >> Isn't it a plain old documented architectural requirement?
> > Yes, but it requires some explanation why it exists here instead of
> > counting on ECREATE.
> > 
> > What do you suggest?
> 
> 	/*
> 	 * ECREATE would detect this too, but checking here also ensures
> 	 * that the 'encl_size' calculations below can never overflow.
> 	 */

Looks reasonable to me!

BR, Jarkko




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux