From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web11.9157.1600851584158622583 for ; Wed, 23 Sep 2020 01:59:44 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LesHA4cR; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600851583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AIuB69cFYsXlWVQmxs6iAVhvIsdH4HB9Xl7nO9DW4Cw=; b=LesHA4cRVj7OSBneZ67VZGVrmhs7HYrai+gZ8gxnuGP2Dq87vmVDJO0AbEHgkrxhDZHwQd iOctEnA6Q9/O6e3SJeEuBrXm6GNTzsj+FANtcKwSZYPTDkEnu3QbgBf9qTYFVbVV9Jsxui U/9gg/z/IPOpB9EyvSjqisu6uQUvMAU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-TgvvT0dhNFKDmqse7uiXsg-1; Wed, 23 Sep 2020 04:59:38 -0400 X-MC-Unique: TgvvT0dhNFKDmqse7uiXsg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5212A884E4E; Wed, 23 Sep 2020 08:59:25 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-233.ams2.redhat.com [10.36.112.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E0451002388; Wed, 23 Sep 2020 08:59:24 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. To: devel@edk2.groups.io, jbrasen@nvidia.com References: <4d637a44c99f0aaa8d78b2def96114d7dc3b1bb6.1599844750.git.jbrasen@nvidia.com> From: "Laszlo Ersek" Message-ID: <5fedff50-5a4b-e57a-055f-794d071eac86@redhat.com> Date: Wed, 23 Sep 2020 10:59:23 +0200 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US On 09/23/20 00:13, Jeff Brasen wrote: > Any comments on this change? I suggest CC'ing the maintainers responsible for reviewing this change. (I don't know who they are, unfortunately -- is there a Maintainers.txt file in the uefi-sct tree?) Thanks Laszlo > > > Thanks, > > Jeff > > ________________________________ > From: Jeff Brasen > Sent: Friday, September 11, 2020 11:23 AM > To: devel@edk2.groups.io > Cc: Jeff Brasen > Subject: [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. > > On systems with memory protection enabled the modification of local > function initialization data results in permission issue. Make a copy of > data prior to modification. > > Signed-off-by: Jeff Brasen > --- > .../UnicodeCollationBBTestFunction.c | 38 ++++++++++--------- > .../UnicodeCollation2BBTestFunction.c | 38 ++++++++++--------- > 2 files changed, 42 insertions(+), 34 deletions(-) > > diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > index 6fa11e6c..e0b4c1d9 100644 > --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c > @@ -25,7 +25,7 @@ Abstract: > --*/ > > > > > > -#include "SctLib.h" > +#include "SctLib.h" > > #include "UnicodeCollationBBTestMain.h" > > > > > > @@ -337,6 +337,7 @@ BBTestStrLwrFunctionAutoTest ( > }; > > > > CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; > > + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; > > > > > > > > @@ -368,14 +369,15 @@ BBTestStrLwrFunctionAutoTest ( > // > > // Backup current test data > > // > > + CopyUnicodeString (TestDataRw, TestData[Index]); > > CopyUnicodeString (TestDataSav, TestData[Index]); > > > > // > > // For each test data, test the StrLwr functionality. > > // > > - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrLwr (TestDataSav, TestData[Index])) { > > + if (CheckStrLwr (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -390,15 +392,15 @@ BBTestStrLwrFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > > > > > - CopyUnicodeString (TestDataSav, TestData[Index]); > > - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); > > - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > + CopyUnicodeString (TestDataSav, TestDataRw); > > + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); > > + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrEql (TestDataSav, TestData[Index])) { > > + if (CheckStrEql (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -413,7 +415,7 @@ BBTestStrLwrFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > }; > > > > @@ -458,6 +460,7 @@ BBTestStrUprFunctionAutoTest ( > }; > > > > CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; > > + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; > > > > > > > > @@ -490,13 +493,14 @@ BBTestStrUprFunctionAutoTest ( > // Backup current test data > > // > > CopyUnicodeString (TestDataSav, TestData[Index]); > > + CopyUnicodeString (TestDataRw, TestData[Index]); > > > > // > > // For each test data, test the StrUpr functionality. > > // > > - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); > > + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrUpr (TestDataSav, TestData[Index])) { > > + if (CheckStrUpr (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -511,14 +515,14 @@ BBTestStrUprFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > > > - CopyUnicodeString (TestDataSav, TestData[Index]); > > - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); > > + CopyUnicodeString (TestDataSav, TestDataRw); > > + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrEql (TestDataSav, TestData[Index])) { > > + if (CheckStrEql (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -533,7 +537,7 @@ BBTestStrUprFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > }; > > > > diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c > index 653b263a..19ff6764 100644 > --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c > +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c > @@ -25,7 +25,7 @@ Abstract: > --*/ > > > > > > -#include "SctLib.h" > +#include "SctLib.h" > > #include "UnicodeCollation2BBTestMain.h" > > > > STATIC CONST STRICOLL_TEST_DATA_FIELD mStriCollTestData[] ={ > > @@ -335,6 +335,7 @@ BBTestStrLwrFunctionAutoTest ( > }; > > > > CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; > > + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; > > > > > > > > @@ -367,13 +368,14 @@ BBTestStrLwrFunctionAutoTest ( > // Backup current test data > > // > > CopyUnicodeString (TestDataSav, TestData[Index]); > > + CopyUnicodeString (TestDataRw, TestData[Index]); > > > > // > > // For each test data, test the StrLwr functionality. > > // > > - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrLwr (TestDataSav, TestData[Index])) { > > + if (CheckStrLwr (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -388,15 +390,15 @@ BBTestStrLwrFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > > > > > - CopyUnicodeString (TestDataSav, TestData[Index]); > > - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); > > - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > + CopyUnicodeString (TestDataSav, TestDataRw); > > + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); > > + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrEql (TestDataSav, TestData[Index])) { > > + if (CheckStrEql (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -411,7 +413,7 @@ BBTestStrLwrFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > }; > > > > @@ -456,6 +458,7 @@ BBTestStrUprFunctionAutoTest ( > }; > > > > CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]; > > + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1]; > > > > > > > > @@ -488,13 +491,14 @@ BBTestStrUprFunctionAutoTest ( > // Backup current test data > > // > > CopyUnicodeString (TestDataSav, TestData[Index]); > > + CopyUnicodeString (TestDataRw, TestData[Index]); > > > > // > > // For each test data, test the StrUpr functionality. > > // > > - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); > > + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrUpr (TestDataSav, TestData[Index])) { > > + if (CheckStrUpr (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -509,14 +513,14 @@ BBTestStrUprFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > > > - CopyUnicodeString (TestDataSav, TestData[Index]); > > - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]); > > - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]); > > + CopyUnicodeString (TestDataSav, TestDataRw); > > + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw); > > + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw); > > > > - if (CheckStrEql (TestDataSav, TestData[Index])) { > > + if (CheckStrEql (TestDataSav, TestDataRw)) { > > AssertionType = EFI_TEST_ASSERTION_PASSED; > > } else { > > AssertionType = EFI_TEST_ASSERTION_FAILED; > > @@ -531,7 +535,7 @@ BBTestStrUprFunctionAutoTest ( > __FILE__, > > (UINTN)__LINE__, > > TestDataSav, > > - TestData[Index] > > + TestDataRw > > ); > > }; > > > > -- > 2.25.1 > > > > > > >