<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Any comments on this change?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<p>Thanks,</p>
<p>Jeff</p>
</div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Jeff Brasen <jbrasen@nvidia.com><br>
<b>Sent:</b> Friday, September 11, 2020 11:23 AM<br>
<b>To:</b> devel@edk2.groups.io <devel@edk2.groups.io><br>
<b>Cc:</b> Jeff Brasen <jbrasen@nvidia.com><br>
<b>Subject:</b> [PATCH] uefi-sct/SctPkg: Correct issue with memory protection enabled.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On systems with memory protection enabled the modification of local<br>
function initialization data results in permission issue. Make a copy of<br>
data prior to modification.<br>
<br>
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com><br>
---<br>
 .../UnicodeCollationBBTestFunction.c          | 38 ++++++++++---------<br>
 .../UnicodeCollation2BBTestFunction.c         | 38 ++++++++++---------<br>
 2 files changed, 42 insertions(+), 34 deletions(-)<br>
<br>
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<br>
index 6fa11e6c..e0b4c1d9 100644<br>
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c<br>
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation/BlackBoxTest/UnicodeCollationBBTestFunction.c<br>
@@ -25,7 +25,7 @@ Abstract:<br>
 --*/<br>
<br>
 <br>
<br>
 <br>
<br>
-#include "SctLib.h"<br>
+#include "SctLib.h"<br>
<br>
 #include "UnicodeCollationBBTestMain.h"<br>
<br>
 <br>
<br>
 <br>
<br>
@@ -337,6 +337,7 @@ BBTestStrLwrFunctionAutoTest (<br>
                                         };<br>
<br>
 <br>
<br>
   CHAR16                               TestDataSav[MAX_SIZE_OF_STRING + 1];<br>
<br>
+  CHAR16                               TestDataRw[MAX_SIZE_OF_STRING + 1];<br>
<br>
 <br>
<br>
 <br>
<br>
 <br>
<br>
@@ -368,14 +369,15 @@ BBTestStrLwrFunctionAutoTest (<br>
     //<br>
<br>
     // Backup current test data<br>
<br>
     //<br>
<br>
+    CopyUnicodeString (TestDataRw, TestData[Index]);<br>
<br>
     CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
 <br>
<br>
     //<br>
<br>
     // For each test data, test the StrLwr functionality.<br>
<br>
     //<br>
<br>
-    UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);<br>
<br>
+    UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrLwr (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrLwr (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -390,15 +392,15 @@ BBTestStrLwrFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
 <br>
<br>
 <br>
<br>
-    CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);<br>
<br>
+    CopyUnicodeString (TestDataSav, TestDataRw);<br>
<br>
+    UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);<br>
<br>
+    UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrEql (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrEql (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -413,7 +415,7 @@ BBTestStrLwrFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
   };<br>
<br>
 <br>
<br>
@@ -458,6 +460,7 @@ BBTestStrUprFunctionAutoTest (<br>
                                         };<br>
<br>
 <br>
<br>
   CHAR16                               TestDataSav[MAX_SIZE_OF_STRING + 1];<br>
<br>
+  CHAR16                               TestDataRw[MAX_SIZE_OF_STRING + 1];<br>
<br>
 <br>
<br>
 <br>
<br>
 <br>
<br>
@@ -490,13 +493,14 @@ BBTestStrUprFunctionAutoTest (<br>
     // Backup current test data<br>
<br>
     //<br>
<br>
     CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
+    CopyUnicodeString (TestDataRw, TestData[Index]);<br>
<br>
 <br>
<br>
     //<br>
<br>
     // For each test data, test the StrUpr functionality.<br>
<br>
     //<br>
<br>
-    UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);<br>
<br>
+    UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrUpr (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrUpr (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -511,14 +515,14 @@ BBTestStrUprFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
 <br>
<br>
-    CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);<br>
<br>
+    CopyUnicodeString (TestDataSav, TestDataRw);<br>
<br>
+    UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);<br>
<br>
+    UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrEql (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrEql (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -533,7 +537,7 @@ BBTestStrUprFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
   };<br>
<br>
 <br>
<br>
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<br>
index 653b263a..19ff6764 100644<br>
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c<br>
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c<br>
@@ -25,7 +25,7 @@ Abstract:<br>
 --*/<br>
<br>
 <br>
<br>
 <br>
<br>
-#include "SctLib.h"<br>
+#include "SctLib.h"<br>
<br>
 #include "UnicodeCollation2BBTestMain.h"<br>
<br>
 <br>
<br>
 STATIC CONST STRICOLL_TEST_DATA_FIELD             mStriCollTestData[] ={<br>
<br>
@@ -335,6 +335,7 @@ BBTestStrLwrFunctionAutoTest (<br>
                                         };<br>
<br>
 <br>
<br>
   CHAR16                               TestDataSav[MAX_SIZE_OF_STRING + 1];<br>
<br>
+  CHAR16                               TestDataRw[MAX_SIZE_OF_STRING + 1];<br>
<br>
 <br>
<br>
 <br>
<br>
 <br>
<br>
@@ -367,13 +368,14 @@ BBTestStrLwrFunctionAutoTest (<br>
     // Backup current test data<br>
<br>
     //<br>
<br>
     CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
+    CopyUnicodeString (TestDataRw, TestData[Index]);<br>
<br>
 <br>
<br>
     //<br>
<br>
     // For each test data, test the StrLwr functionality.<br>
<br>
     //<br>
<br>
-    UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);<br>
<br>
+    UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrLwr (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrLwr (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -388,15 +390,15 @@ BBTestStrLwrFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
 <br>
<br>
 <br>
<br>
-    CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);<br>
<br>
+    CopyUnicodeString (TestDataSav, TestDataRw);<br>
<br>
+    UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);<br>
<br>
+    UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrEql (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrEql (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -411,7 +413,7 @@ BBTestStrLwrFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
   };<br>
<br>
 <br>
<br>
@@ -456,6 +458,7 @@ BBTestStrUprFunctionAutoTest (<br>
                                         };<br>
<br>
 <br>
<br>
   CHAR16                               TestDataSav[MAX_SIZE_OF_STRING + 1];<br>
<br>
+  CHAR16                               TestDataRw[MAX_SIZE_OF_STRING + 1];<br>
<br>
 <br>
<br>
 <br>
<br>
 <br>
<br>
@@ -488,13 +491,14 @@ BBTestStrUprFunctionAutoTest (<br>
     // Backup current test data<br>
<br>
     //<br>
<br>
     CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
+    CopyUnicodeString (TestDataRw, TestData[Index]);<br>
<br>
 <br>
<br>
     //<br>
<br>
     // For each test data, test the StrUpr functionality.<br>
<br>
     //<br>
<br>
-    UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);<br>
<br>
+    UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrUpr (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrUpr (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -509,14 +513,14 @@ BBTestStrUprFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
 <br>
<br>
-    CopyUnicodeString (TestDataSav, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);<br>
<br>
-    UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);<br>
<br>
+    CopyUnicodeString (TestDataSav, TestDataRw);<br>
<br>
+    UnicodeCollation->StrLwr (UnicodeCollation, TestDataRw);<br>
<br>
+    UnicodeCollation->StrUpr (UnicodeCollation, TestDataRw);<br>
<br>
 <br>
<br>
-    if (CheckStrEql (TestDataSav, TestData[Index])) {<br>
<br>
+    if (CheckStrEql (TestDataSav, TestDataRw)) {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_PASSED;<br>
<br>
     } else {<br>
<br>
       AssertionType = EFI_TEST_ASSERTION_FAILED;<br>
<br>
@@ -531,7 +535,7 @@ BBTestStrUprFunctionAutoTest (<br>
                    __FILE__,<br>
<br>
                    (UINTN)__LINE__,<br>
<br>
                    TestDataSav,<br>
<br>
-                   TestData[Index]<br>
<br>
+                   TestDataRw<br>
<br>
                    );<br>
<br>
   };<br>
<br>
 <br>
<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</body>
</html>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr> Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/65475">View/Reply Online (#65475)</a> |    |  <a target="_blank" href="https://groups.io/mt/76784632/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>