Re: [PATCH 2/2] selftests/sgx: Add SGX selftest augment_via_eaccept_long

From: Jarkko Sakkinen
Date: Wed Aug 24 2022 - 21:29:10 EST


On Wed, Aug 17, 2022 at 03:39:36PM +0000, Dhanraj, Vijay wrote:
>
>
> > -----Original Message-----
> > From: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
> > Sent: Wednesday, August 17, 2022 7:39 AM
> > To: Dhanraj, Vijay <vijay.dhanraj@xxxxxxxxx>
> > Cc: Chatre, Reinette <reinette.chatre@xxxxxxxxx>; Dave Hansen
> > <dave.hansen@xxxxxxxxxxxxxxx>; linux-sgx@xxxxxxxxxxxxxxx; Shuah Khan
> > <shuah@xxxxxxxxxx>; open list:KERNEL SELFTEST FRAMEWORK <linux-
> > kselftest@xxxxxxxxxxxxxxx>; open list <linux-kernel@xxxxxxxxxxxxxxx>
> > Subject: Re: [PATCH 2/2] selftests/sgx: Add SGX selftest
> > augment_via_eaccept_long
> >
> > On Wed, Aug 17, 2022 at 01:27:38AM +0000, Dhanraj, Vijay wrote:
> > > I think changing it to "int i" will cause a buffer overflow with
> > > edmm_size being 8GB.
> >
> > Hmm.. 'i' iterates segments. Amd I missing something?
> >
> > BR, Jarkko
>
> It is also used when iterating over pages to eaccept. This might cause an issue.
>
> for (i = 0; i < edmm_size; i += 4096) {
> eaccept_op.epc_addr = (uint64_t)(addr + i);
>
> Regards, Vijay

Ah got it, thanks.

BR, Jarkko