From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by mx.groups.io with SMTP id smtpd.web11.279.1599845040050100451 for ; Fri, 11 Sep 2020 10:24:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=LJNcFXDV; spf=pass (domain: nvidia.com, ip: 216.228.121.64, mailfrom: jbrasen@nvidia.com) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 11 Sep 2020 10:23:14 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 11 Sep 2020 10:23:59 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 11 Sep 2020 10:23:59 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 11 Sep 2020 17:23:59 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 11 Sep 2020 17:23:59 +0000 Received: from jbrasen-ux.nvidia.com (Not Verified[10.20.23.1]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 11 Sep 2020 10:23:59 -0700 From: "Jeff Brasen" To: CC: Jeff Brasen Subject: [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled. Date: Fri, 11 Sep 2020 11:23:55 -0600 Message-ID: <4d637a44c99f0aaa8d78b2def96114d7dc3b1bb6.1599844750.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1599844994; bh=SR1fALo6IThevuLejwWqc3Gh1jgQLvZkSjkrty9EoZA=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Transfer-Encoding: Content-Type; b=LJNcFXDVKwJVKQcgaZU1qR11uRREp4OmDI+hSQAKR4tRStMw2UAhIx3ls2I5Kc7cN Do14nEDR7VEGWvxNmSPKO4+kwNbUxNlsxFDFtbe2d4elBJi5KwFohnc631PMLHR29D ERiV671ILYgvToA5D4wKjJJjTkeGUgtVY1G7V0OQM5G+5RMzs9bJiYWOFYp2tIOuJs 2qI/Z5TvAvf4xc/fqpW+9GYtflCCPvVH+3EbbZBxoxL0xHXUFti1AHbt3iK2EKxYs1 CfdGeWP4qRXEMJXRom5xFxZkhTQViVs5Wcgyn2cMHysHR+7TvTe/ijP3HFQkhri96K weZ1x6AYzxSgg== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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/Bl= ackBoxTest/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/BlackBoxT= est/UnicodeCollationBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxT= est/UnicodeCollationBBTestFunction.c @@ -25,7 +25,7 @@ Abstract: --*/=0D =0D =0D -#include "SctLib.h" +#include "SctLib.h"=0D #include "UnicodeCollationBBTestMain.h"=0D =0D =0D @@ -337,6 +337,7 @@ BBTestStrLwrFunctionAutoTest ( };=0D =0D CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]= ;=0D + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1];= =0D =0D =0D =0D @@ -368,14 +369,15 @@ BBTestStrLwrFunctionAutoTest ( //=0D // Backup current test data=0D //=0D + CopyUnicodeString (TestDataRw, TestData[Index]);=0D CopyUnicodeString (TestDataSav, TestData[Index]);=0D =0D //=0D // For each test data, test the StrLwr functionality.=0D //=0D - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);=0D + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrLwr (TestDataSav, TestData[Index])) {=0D + if (CheckStrLwr (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -390,15 +392,15 @@ BBTestStrLwrFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D =0D =0D - CopyUnicodeString (TestDataSav, TestData[Index]);=0D - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);=0D - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);=0D + CopyUnicodeString (TestDataSav, TestDataRw);=0D + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);=0D + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrEql (TestDataSav, TestData[Index])) {=0D + if (CheckStrEql (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -413,7 +415,7 @@ BBTestStrLwrFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D };=0D =0D @@ -458,6 +460,7 @@ BBTestStrUprFunctionAutoTest ( };=0D =0D CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]= ;=0D + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1];= =0D =0D =0D =0D @@ -490,13 +493,14 @@ BBTestStrUprFunctionAutoTest ( // Backup current test data=0D //=0D CopyUnicodeString (TestDataSav, TestData[Index]);=0D + CopyUnicodeString (TestDataRw, TestData[Index]);=0D =0D //=0D // For each test data, test the StrUpr functionality.=0D //=0D - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);=0D + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrUpr (TestDataSav, TestData[Index])) {=0D + if (CheckStrUpr (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -511,14 +515,14 @@ BBTestStrUprFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D =0D - CopyUnicodeString (TestDataSav, TestData[Index]);=0D - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);=0D - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);=0D + CopyUnicodeString (TestDataSav, TestDataRw);=0D + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);=0D + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrEql (TestDataSav, TestData[Index])) {=0D + if (CheckStrEql (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -533,7 +537,7 @@ BBTestStrUprFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D };=0D =0D diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/B= lackBoxTest/UnicodeCollation2BBTestFunction.c b/uefi-sct/SctPkg/TestCase/UE= FI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunct= ion.c index 653b263a..19ff6764 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBox= Test/UnicodeCollation2BBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBox= Test/UnicodeCollation2BBTestFunction.c @@ -25,7 +25,7 @@ Abstract: --*/=0D =0D =0D -#include "SctLib.h" +#include "SctLib.h"=0D #include "UnicodeCollation2BBTestMain.h"=0D =0D STATIC CONST STRICOLL_TEST_DATA_FIELD mStriCollTestData[] =3D{= =0D @@ -335,6 +335,7 @@ BBTestStrLwrFunctionAutoTest ( };=0D =0D CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]= ;=0D + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1];= =0D =0D =0D =0D @@ -367,13 +368,14 @@ BBTestStrLwrFunctionAutoTest ( // Backup current test data=0D //=0D CopyUnicodeString (TestDataSav, TestData[Index]);=0D + CopyUnicodeString (TestDataRw, TestData[Index]);=0D =0D //=0D // For each test data, test the StrLwr functionality.=0D //=0D - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);=0D + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrLwr (TestDataSav, TestData[Index])) {=0D + if (CheckStrLwr (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -388,15 +390,15 @@ BBTestStrLwrFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D =0D =0D - CopyUnicodeString (TestDataSav, TestData[Index]);=0D - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);=0D - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);=0D + CopyUnicodeString (TestDataSav, TestDataRw);=0D + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);=0D + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrEql (TestDataSav, TestData[Index])) {=0D + if (CheckStrEql (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -411,7 +413,7 @@ BBTestStrLwrFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D };=0D =0D @@ -456,6 +458,7 @@ BBTestStrUprFunctionAutoTest ( };=0D =0D CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1]= ;=0D + CHAR16 TestDataRw[MAX_SIZE_OF_STRING + 1];= =0D =0D =0D =0D @@ -488,13 +491,14 @@ BBTestStrUprFunctionAutoTest ( // Backup current test data=0D //=0D CopyUnicodeString (TestDataSav, TestData[Index]);=0D + CopyUnicodeString (TestDataRw, TestData[Index]);=0D =0D //=0D // For each test data, test the StrUpr functionality.=0D //=0D - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);=0D + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrUpr (TestDataSav, TestData[Index])) {=0D + if (CheckStrUpr (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -509,14 +513,14 @@ BBTestStrUprFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D =0D - CopyUnicodeString (TestDataSav, TestData[Index]);=0D - UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);=0D - UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);=0D + CopyUnicodeString (TestDataSav, TestDataRw);=0D + UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);=0D + UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);=0D =0D - if (CheckStrEql (TestDataSav, TestData[Index])) {=0D + if (CheckStrEql (TestDataSav, TestDataRw)) {=0D AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D } else {=0D AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D @@ -531,7 +535,7 @@ BBTestStrUprFunctionAutoTest ( __FILE__,=0D (UINTN)__LINE__,=0D TestDataSav,=0D - TestData[Index]=0D + TestDataRw=0D );=0D };=0D =0D --=20 2.25.1