From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=eric.jin@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0516321179240 for ; Sat, 13 Oct 2018 08:43:00 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2018 08:43:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,377,1534834800"; d="scan'208";a="94923418" Received: from jjin9-mobl.ccr.corp.intel.com ([10.249.168.56]) by fmsmga002.fm.intel.com with ESMTP; 13 Oct 2018 08:42:58 -0700 From: Eric Jin To: edk2-devel@lists.01.org Cc: Supreeth Venkatesh , Jiaxin Wu Date: Sat, 13 Oct 2018 23:42:52 +0800 Message-Id: <20181013154252.1260-1-eric.jin@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 Subject: [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() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2018 15:43:01 -0000 Cc: Supreeth Venkatesh Cc: Jiaxin Wu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Jin --- ...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.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
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.
- Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
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