* [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx()
@ 2018-10-13 15:42 Eric Jin
2018-10-15 1:33 ` Supreeth Venkatesh
0 siblings, 1 reply; 5+ messages in thread
From: Eric Jin @ 2018-10-13 15:42 UTC (permalink / raw)
To: edk2-devel; +Cc: Supreeth Venkatesh, Jiaxin Wu
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
...rTaskPriorityServicesBBTestCreateEventEx.c | 26 +++++++++++--------
.../BlackBoxTest/Support.c | 19 +++++++++++++-
2 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
index e2e173ab..25d1ed97 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
@@ -1,7 +1,7 @@
/** @file
Copyright 2006 - 2016 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -192,6 +192,10 @@ BBTestCreateEventEx_Func (
BBTestCreateEventEx_Func_Sub2 (StandardLib);
#endif
+ //
+ // The test for the EFI_EVENT_GROUP_MEMORY_MAP_CHANGE
+ // This event group is notified by the system when the memory map has changed.
+ //
BBTestCreateEventEx_Func_Sub3 (StandardLib);
//
@@ -599,12 +603,12 @@ BBTestCreateEventEx_Func_Sub1 (
UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
//
- // Initialize Buffer
+ // Initialize Buffer and the 0xAA is only for the Sub3 test
//
for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
Buffer[Index] = Index;
- Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
- Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+ Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
+ Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
}
//
@@ -755,12 +759,12 @@ BBTestCreateEventEx_Func_Sub2 (
UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
//
- // Initialize Buffer
+ // Initialize Buffer and the 0xAA is only for the Sub3 test
//
for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
Buffer[Index] = Index;
- Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
- Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+ Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
+ Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
}
//
@@ -914,12 +918,12 @@ BBTestCreateEventEx_Func_Sub3 (
UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
//
- // Initialize Buffer
+ // Initialize Buffer and the trick to initial it as 0xAA
//
for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
Buffer[Index] = Index;
- Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
- Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+ Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
+ Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
}
//
@@ -974,7 +978,7 @@ BBTestCreateEventEx_Func_Sub3 (
}
//
- // Install a configuration table at TPL_NOTIFY
+ // Call AllocatePage to change the memorymap
//
OldTpl = gtBS->RaiseTPL (TPL_NOTIFY);
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
index aa02383e..823e16ab 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
@@ -1,7 +1,7 @@
/** @file
Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -64,6 +64,23 @@ NotifyFunctionTplEx(
EventIndex = Buffer[0];
+ //
+ // The special code for the sub3
+ // To block possible enter triggered by CreateEventEx
+ //
+ if (EventIndex != 2 && Buffer[4] == (UINTN)(0xAA))
+ return;
+
+ //
+ // The special code for the sub3
+ // To initial the Buffer and block the possible enter caused by the CloseEvent
+ //
+ if (EventIndex == 2 && Buffer[1] == (UINTN)(0xAA)) {
+ for (Index=1; Index<7; Index++) {
+ Buffer[Index] = (UINTN)(-1);
+ }
+ }
+
Index = 3-EventIndex;
while (1) {
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx()
2018-10-13 15:42 [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx() Eric Jin
@ 2018-10-15 1:33 ` Supreeth Venkatesh
2018-10-15 12:49 ` Supreeth Venkatesh
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Supreeth Venkatesh @ 2018-10-15 1:33 UTC (permalink / raw)
To: Eric Jin, edk2-devel; +Cc: Jiaxin Wu
Please use a commit message less than 80 Cols.
On 10/13/2018 04:42 PM, Eric Jin wrote:
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin <eric.jin@intel.com>
> ---
> ...rTaskPriorityServicesBBTestCreateEventEx.c | 26 +++++++++++--------
> .../BlackBoxTest/Support.c | 19 +++++++++++++-
> 2 files changed, 33 insertions(+), 12 deletions(-)
>
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
> index e2e173ab..25d1ed97 100644
> --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
> @@ -1,7 +1,7 @@
> /** @file
>
> Copyright 2006 - 2016 Unified EFI, Inc.<BR>
> - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD License
> @@ -192,6 +192,10 @@ BBTestCreateEventEx_Func (
> BBTestCreateEventEx_Func_Sub2 (StandardLib);
> #endif
>
> + //
> + // The test for the EFI_EVENT_GROUP_MEMORY_MAP_CHANGE
> + // This event group is notified by the system when the memory map has changed.
> + //
> BBTestCreateEventEx_Func_Sub3 (StandardLib);
>
> //
> @@ -599,12 +603,12 @@ BBTestCreateEventEx_Func_Sub1 (
> UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
>
> //
> - // Initialize Buffer
> + // Initialize Buffer and the 0xAA is only for the Sub3 test
> //
> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
Strange Logic here. Needs re-look.
> Buffer[Index] = Index;
> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
Magic Number 0xAA
> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
Magic Number 0xAA. Please define Macro or const.
> }
>
> //
> @@ -755,12 +759,12 @@ BBTestCreateEventEx_Func_Sub2 (
> UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
>
> //
> - // Initialize Buffer
> + // Initialize Buffer and the 0xAA is only for the Sub3 test
> //
> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
> Buffer[Index] = Index;
> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
Magic Number 0xAA. Please define Macro or const.
> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
Magic Number 0xAA. Please define Macro or const.
> }
>
> //
> @@ -914,12 +918,12 @@ BBTestCreateEventEx_Func_Sub3 (
> UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
>
> //
> - // Initialize Buffer
> + // Initialize Buffer and the trick to initial it as 0xAA
> //
> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
> Buffer[Index] = Index;
> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
Strange Logic here. Needs re-look. Also, Magic Number AA.
> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
Strange Logic here. Needs re-look. Also, Magic Number AA.
> }
>
> //
> @@ -974,7 +978,7 @@ BBTestCreateEventEx_Func_Sub3 (
> }
>
> //
> - // Install a configuration table at TPL_NOTIFY
> + // Call AllocatePage to change the memorymap
> //
> OldTpl = gtBS->RaiseTPL (TPL_NOTIFY);
>
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
> index aa02383e..823e16ab 100644
> --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
> @@ -1,7 +1,7 @@
> /** @file
>
> Copyright 2006 - 2010 Unified EFI, Inc.<BR>
> - Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD License
> @@ -64,6 +64,23 @@ NotifyFunctionTplEx(
>
> EventIndex = Buffer[0];
>
> + //
> + // The special code for the sub3
> + // To block possible enter triggered by CreateEventEx
> + //
> + if (EventIndex != 2 && Buffer[4] == (UINTN)(0xAA))
Magic Numbers 2, 4 and OxAA.
> + return;
> +
> + //
> + // The special code for the sub3
> + // To initial the Buffer and block the possible enter caused by the CloseEvent
> + //
> + if (EventIndex == 2 && Buffer[1] == (UINTN)(0xAA)) {
Magic Numbers 2, 1 and OxAA.
> + for (Index=1; Index<7; Index++) {
Magic Numbers 1, 7.
> + Buffer[Index] = (UINTN)(-1);
Magic Number -1.
> + }
> + }
> +
> Index = 3-EventIndex;
Magic Number 3.
>
> while (1) {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx()
2018-10-15 1:33 ` Supreeth Venkatesh
@ 2018-10-15 12:49 ` Supreeth Venkatesh
2018-10-15 12:50 ` Supreeth Venkatesh
2018-10-15 13:10 ` Supreeth Venkatesh
2 siblings, 0 replies; 5+ messages in thread
From: Supreeth Venkatesh @ 2018-10-15 12:49 UTC (permalink / raw)
To: Eric Jin, edk2-devel; +Cc: Jiaxin Wu
On 10/15/2018 02:33 AM, Supreeth Venkatesh wrote:
> Please use a commit message less than 80 Cols.
>
>
> On 10/13/2018 04:42 PM, Eric Jin wrote:
>> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
>> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Eric Jin <eric.jin@intel.com>
>> ---
>> ...rTaskPriorityServicesBBTestCreateEventEx.c | 26 +++++++++++--------
>> .../BlackBoxTest/Support.c | 19 +++++++++++++-
>> 2 files changed, 33 insertions(+), 12 deletions(-)
>>
>> diff --git
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>>
>> index e2e173ab..25d1ed97 100644
>> ---
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>> +++
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>> @@ -1,7 +1,7 @@
>> /** @file
>> Copyright 2006 - 2016 Unified EFI, Inc.<BR>
>> - Copyright (c) 2010 - 2016, Intel Corporation. All rights
>> reserved.<BR>
>> + Copyright (c) 2010 - 2018, Intel Corporation. All rights
>> reserved.<BR>
>> This program and the accompanying materials
>> are licensed and made available under the terms and conditions of
>> the BSD License
>> @@ -192,6 +192,10 @@ BBTestCreateEventEx_Func (
>> BBTestCreateEventEx_Func_Sub2 (StandardLib);
>> #endif
>> + //
>> + // The test for the EFI_EVENT_GROUP_MEMORY_MAP_CHANGE
>> + // This event group is notified by the system when the memory map
>> has changed.
>> + //
>> BBTestCreateEventEx_Func_Sub3 (StandardLib);
>> //
>> @@ -599,12 +603,12 @@ BBTestCreateEventEx_Func_Sub1 (
>> UINTN Buffer[MAX_TEST_EVENT_NUM +
>> MAX_TEST_EVENT_NUM*2];
>> //
>> - // Initialize Buffer
>> + // Initialize Buffer and the 0xAA is only for the Sub3 test
>> //
>> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
> Strange Logic here. Needs re-look.
>> Buffer[Index] = Index;
>> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
>> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
>> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
> Magic Number 0xAA
>> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
> Magic Number 0xAA. Please define Macro or const.
>> }
>> //
>> @@ -755,12 +759,12 @@ BBTestCreateEventEx_Func_Sub2 (
>> UINTN Buffer[MAX_TEST_EVENT_NUM +
>> MAX_TEST_EVENT_NUM*2];
>> //
>> - // Initialize Buffer
>> + // Initialize Buffer and the 0xAA is only for the Sub3 test
>> //
>> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
>> Buffer[Index] = Index;
>> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
>> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
>> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
> Magic Number 0xAA. Please define Macro or const.
>> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
> Magic Number 0xAA. Please define Macro or const.
>> }
>> //
>> @@ -914,12 +918,12 @@ BBTestCreateEventEx_Func_Sub3 (
>> UINTN Buffer[MAX_TEST_EVENT_NUM +
>> MAX_TEST_EVENT_NUM*2];
>> //
>> - // Initialize Buffer
>> + // Initialize Buffer and the trick to initial it as 0xAA
>> //
>> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
>> Buffer[Index] = Index;
>> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
>> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
>> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
> Strange Logic here. Needs re-look. Also, Magic Number AA.
>> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
> Strange Logic here. Needs re-look. Also, Magic Number AA.
>> }
>> //
>> @@ -974,7 +978,7 @@ BBTestCreateEventEx_Func_Sub3 (
>> }
>> //
>> - // Install a configuration table at TPL_NOTIFY
>> + // Call AllocatePage to change the memorymap
>> //
>> OldTpl = gtBS->RaiseTPL (TPL_NOTIFY);
>> diff --git
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>>
>> index aa02383e..823e16ab 100644
>> ---
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>> +++
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>> @@ -1,7 +1,7 @@
>> /** @file
>> Copyright 2006 - 2010 Unified EFI, Inc.<BR>
>> - Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
>> + Copyright (c) 2010 - 2018, Intel Corporation. All rights
>> reserved.<BR>
>> This program and the accompanying materials
>> are licensed and made available under the terms and conditions of
>> the BSD License
>> @@ -64,6 +64,23 @@ NotifyFunctionTplEx(
>> EventIndex = Buffer[0];
>> + //
>> + // The special code for the sub3
>> + // To block possible enter triggered by CreateEventEx
>> + //
>> + if (EventIndex != 2 && Buffer[4] == (UINTN)(0xAA))
> Magic Numbers 2, 4 and OxAA.
>> + return;
>> +
>> + //
>> + // The special code for the sub3
>> + // To initial the Buffer and block the possible enter caused by
>> the CloseEvent
>> + //
>> + if (EventIndex == 2 && Buffer[1] == (UINTN)(0xAA)) {
> Magic Numbers 2, 1 and OxAA.
>> + for (Index=1; Index<7; Index++) {
> Magic Numbers 1, 7.
>> + Buffer[Index] = (UINTN)(-1);
> Magic Number -1.
>> + }
>> + }
>> +
>> Index = 3-EventIndex;
> Magic Number 3.
>> while (1) {
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx()
2018-10-15 1:33 ` Supreeth Venkatesh
2018-10-15 12:49 ` Supreeth Venkatesh
@ 2018-10-15 12:50 ` Supreeth Venkatesh
2018-10-15 13:10 ` Supreeth Venkatesh
2 siblings, 0 replies; 5+ messages in thread
From: Supreeth Venkatesh @ 2018-10-15 12:50 UTC (permalink / raw)
To: Eric Jin, edk2-devel; +Cc: Jiaxin Wu
FYI
On 10/15/2018 02:33 AM, Supreeth Venkatesh wrote:
> Please use a commit message less than 80 Cols.
>
>
> On 10/13/2018 04:42 PM, Eric Jin wrote:
>> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
>> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Eric Jin <eric.jin@intel.com>
>> ---
>> ...rTaskPriorityServicesBBTestCreateEventEx.c | 26 +++++++++++--------
>> .../BlackBoxTest/Support.c | 19 +++++++++++++-
>> 2 files changed, 33 insertions(+), 12 deletions(-)
>>
>> diff --git
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>>
>> index e2e173ab..25d1ed97 100644
>> ---
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>> +++
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
>> @@ -1,7 +1,7 @@
>> /** @file
>> Copyright 2006 - 2016 Unified EFI, Inc.<BR>
>> - Copyright (c) 2010 - 2016, Intel Corporation. All rights
>> reserved.<BR>
>> + Copyright (c) 2010 - 2018, Intel Corporation. All rights
>> reserved.<BR>
>> This program and the accompanying materials
>> are licensed and made available under the terms and conditions of
>> the BSD License
>> @@ -192,6 +192,10 @@ BBTestCreateEventEx_Func (
>> BBTestCreateEventEx_Func_Sub2 (StandardLib);
>> #endif
>> + //
>> + // The test for the EFI_EVENT_GROUP_MEMORY_MAP_CHANGE
>> + // This event group is notified by the system when the memory map
>> has changed.
>> + //
>> BBTestCreateEventEx_Func_Sub3 (StandardLib);
>> //
>> @@ -599,12 +603,12 @@ BBTestCreateEventEx_Func_Sub1 (
>> UINTN Buffer[MAX_TEST_EVENT_NUM +
>> MAX_TEST_EVENT_NUM*2];
>> //
>> - // Initialize Buffer
>> + // Initialize Buffer and the 0xAA is only for the Sub3 test
>> //
>> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
> Strange Logic here. Needs re-look.
>> Buffer[Index] = Index;
>> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
>> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
>> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
> Magic Number 0xAA
>> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
> Magic Number 0xAA. Please define Macro or const.
>> }
>> //
>> @@ -755,12 +759,12 @@ BBTestCreateEventEx_Func_Sub2 (
>> UINTN Buffer[MAX_TEST_EVENT_NUM +
>> MAX_TEST_EVENT_NUM*2];
>> //
>> - // Initialize Buffer
>> + // Initialize Buffer and the 0xAA is only for the Sub3 test
>> //
>> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
>> Buffer[Index] = Index;
>> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
>> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
>> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
> Magic Number 0xAA. Please define Macro or const.
>> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
> Magic Number 0xAA. Please define Macro or const.
>> }
>> //
>> @@ -914,12 +918,12 @@ BBTestCreateEventEx_Func_Sub3 (
>> UINTN Buffer[MAX_TEST_EVENT_NUM +
>> MAX_TEST_EVENT_NUM*2];
>> //
>> - // Initialize Buffer
>> + // Initialize Buffer and the trick to initial it as 0xAA
>> //
>> for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
>> Buffer[Index] = Index;
>> - Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
>> - Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
>> + Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
> Strange Logic here. Needs re-look. Also, Magic Number AA.
>> + Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
> Strange Logic here. Needs re-look. Also, Magic Number AA.
>> }
>> //
>> @@ -974,7 +978,7 @@ BBTestCreateEventEx_Func_Sub3 (
>> }
>> //
>> - // Install a configuration table at TPL_NOTIFY
>> + // Call AllocatePage to change the memorymap
>> //
>> OldTpl = gtBS->RaiseTPL (TPL_NOTIFY);
>> diff --git
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>>
>> index aa02383e..823e16ab 100644
>> ---
>> a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>> +++
>> b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
>> @@ -1,7 +1,7 @@
>> /** @file
>> Copyright 2006 - 2010 Unified EFI, Inc.<BR>
>> - Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
>> + Copyright (c) 2010 - 2018, Intel Corporation. All rights
>> reserved.<BR>
>> This program and the accompanying materials
>> are licensed and made available under the terms and conditions of
>> the BSD License
>> @@ -64,6 +64,23 @@ NotifyFunctionTplEx(
>> EventIndex = Buffer[0];
>> + //
>> + // The special code for the sub3
>> + // To block possible enter triggered by CreateEventEx
>> + //
>> + if (EventIndex != 2 && Buffer[4] == (UINTN)(0xAA))
> Magic Numbers 2, 4 and OxAA.
>> + return;
>> +
>> + //
>> + // The special code for the sub3
>> + // To initial the Buffer and block the possible enter caused by
>> the CloseEvent
>> + //
>> + if (EventIndex == 2 && Buffer[1] == (UINTN)(0xAA)) {
> Magic Numbers 2, 1 and OxAA.
>> + for (Index=1; Index<7; Index++) {
> Magic Numbers 1, 7.
>> + Buffer[Index] = (UINTN)(-1);
> Magic Number -1.
>> + }
>> + }
>> +
>> Index = 3-EventIndex;
> Magic Number 3.
>> while (1) {
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx()
2018-10-15 1:33 ` Supreeth Venkatesh
2018-10-15 12:49 ` Supreeth Venkatesh
2018-10-15 12:50 ` Supreeth Venkatesh
@ 2018-10-15 13:10 ` Supreeth Venkatesh
2 siblings, 0 replies; 5+ messages in thread
From: Supreeth Venkatesh @ 2018-10-15 13:10 UTC (permalink / raw)
To: Eric Jin, edk2-devel@lists.01.org; +Cc: Jiaxin Wu, Supreeth Venkatesh
On 10/15/2018 02:33 AM, Supreeth Venkatesh wrote:
Please use a commit message less than 80 Cols.
On 10/13/2018 04:42 PM, Eric Jin wrote:
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com><mailto:supreeth.venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com><mailto:jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com><mailto:eric.jin@intel.com>
---
...rTaskPriorityServicesBBTestCreateEventEx.c | 26 +++++++++++--------
.../BlackBoxTest/Support.c | 19 +++++++++++++-
2 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
index e2e173ab..25d1ed97 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
@@ -1,7 +1,7 @@
/** @file
Copyright 2006 - 2016 Unified EFI, Inc.<BR>
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -192,6 +192,10 @@ BBTestCreateEventEx_Func (
BBTestCreateEventEx_Func_Sub2 (StandardLib);
#endif
+ //
+ // The test for the EFI_EVENT_GROUP_MEMORY_MAP_CHANGE
+ // This event group is notified by the system when the memory map has changed.
+ //
BBTestCreateEventEx_Func_Sub3 (StandardLib);
//
@@ -599,12 +603,12 @@ BBTestCreateEventEx_Func_Sub1 (
UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
//
- // Initialize Buffer
+ // Initialize Buffer and the 0xAA is only for the Sub3 test
//
for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
Strange Logic here. Needs re-look.
Buffer[Index] = Index;
- Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
- Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+ Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
Magic Number 0xAA
+ Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
Magic Number 0xAA. Please define Macro or const.
}
//
@@ -755,12 +759,12 @@ BBTestCreateEventEx_Func_Sub2 (
UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
//
- // Initialize Buffer
+ // Initialize Buffer and the 0xAA is only for the Sub3 test
//
for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
Buffer[Index] = Index;
- Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
- Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+ Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
Magic Number 0xAA. Please define Macro or const.
+ Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
Magic Number 0xAA. Please define Macro or const.
}
//
@@ -914,12 +918,12 @@ BBTestCreateEventEx_Func_Sub3 (
UINTN Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
//
- // Initialize Buffer
+ // Initialize Buffer and the trick to initial it as 0xAA
//
for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
Buffer[Index] = Index;
- Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
- Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+ Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
Strange Logic here. Needs re-look. Also, Magic Number AA.
+ Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
Strange Logic here. Needs re-look. Also, Magic Number AA.
}
//
@@ -974,7 +978,7 @@ BBTestCreateEventEx_Func_Sub3 (
}
//
- // Install a configuration table at TPL_NOTIFY
+ // Call AllocatePage to change the memorymap
//
OldTpl = gtBS->RaiseTPL (TPL_NOTIFY);
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
index aa02383e..823e16ab 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
@@ -1,7 +1,7 @@
/** @file
Copyright 2006 - 2010 Unified EFI, Inc.<BR>
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -64,6 +64,23 @@ NotifyFunctionTplEx(
EventIndex = Buffer[0];
+ //
+ // The special code for the sub3
+ // To block possible enter triggered by CreateEventEx
+ //
+ if (EventIndex != 2 && Buffer[4] == (UINTN)(0xAA))
Magic Numbers 2, 4 and OxAA.
+ return;
+
+ //
+ // The special code for the sub3
+ // To initial the Buffer and block the possible enter caused by the CloseEvent
+ //
+ if (EventIndex == 2 && Buffer[1] == (UINTN)(0xAA)) {
Magic Numbers 2, 1 and OxAA.
+ for (Index=1; Index<7; Index++) {
Magic Numbers 1, 7.
+ Buffer[Index] = (UINTN)(-1);
Magic Number -1.
+ }
+ }
+
Index = 3-EventIndex;
Magic Number 3.
while (1) {
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-10-16 9:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-13 15:42 [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx() Eric Jin
2018-10-15 1:33 ` Supreeth Venkatesh
2018-10-15 12:49 ` Supreeth Venkatesh
2018-10-15 12:50 ` Supreeth Venkatesh
2018-10-15 13:10 ` Supreeth Venkatesh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox