From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.2414.1607662324935422813 for ; Thu, 10 Dec 2020 20:52:05 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: michael.d.kinney@intel.com) IronPort-SDR: 9rc0NxbxBdg6Z4WIX3ehPFg6fpuH3H+BpNZgpzGdSfAUiDbicV9YWZP9wkOgp5MjCANFrNtMa0 P+aO8iafRjmA== X-IronPort-AV: E=McAfee;i="6000,8403,9831"; a="171814621" X-IronPort-AV: E=Sophos;i="5.78,410,1599548400"; d="scan'208";a="171814621" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2020 20:52:03 -0800 IronPort-SDR: dfbMZ4iqKZR/ELvW2nhn0DbYAyu8cLo5OJ8a7xrL8J4ygiVdbDNgAXO5Dc8Y6ujpbtErKML7dW f7QeiTRaUSuA== X-IronPort-AV: E=Sophos;i="5.78,410,1599548400"; d="scan'208";a="349259481" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.212.202.206]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2020 20:52:03 -0800 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Hao A Wu , Liming Gao , Bret Barkelew Subject: [Patch v3 0/2] MdeModulePkg/Variable/RuntimeDxe: Restore Variable Lock Protocol behavior Date: Thu, 10 Dec 2020 20:51:54 -0800 Message-Id: <20201211045156.1758-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit New in V3 ========== * Split into 2 patches. One for code change. Second for unit tests. * Remove duplicate code and use ValidateSetVariable() to detect if a variable is already locked. https://bugzilla.tianocore.org/show_bug.cgi?id=3111 The VariableLock shim currently fails if called twice because the underlying Variable Policy engine returns an error if a policy is set on an existing variable. This breaks existing code which expect it to silently pass if a variable is locked multiple times (because it should "be locked"). Refactor the shim to confirm that the variable is indeed locked and then change the error to EFI_SUCCESS and generate a DEBUG_ERROR message so the duplicate lock can be reported in a debug log and removed. Add host based unit tests for the multiple lock case using Variable Lock Protocol, Variable Policy Protocol, and mixes of Variable Lock Protocol and Variable Policy Protocol. Cc: Michael D Kinney Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Bret Barkelew Bret Barkelew (1): MdeModulePkg/Variable/RuntimeDxe: Restore Variable Lock Protocol behavior Michael D Kinney (1): MdeModulePkg/Variable/RuntimeDxe: Add Variable Lock Protocol Unit Tests MdeModulePkg/Test/MdeModulePkgHostTest.dsc | 11 + .../VariableLockRequestToLockUnitTest.c | 565 ++++++++++++++++++ .../VariableLockRequestToLockUnitTest.inf | 36 ++ .../RuntimeDxe/VariableLockRequestToLock.c | 95 +-- 4 files changed, 671 insertions(+), 36 deletions(-) create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/RuntimeDxeUnitTest/VariableLockRequestToLockUnitTest.c create mode 100644 MdeModulePkg/Universal/Variable/RuntimeDxe/RuntimeDxeUnitTest/VariableLockRequestToLockUnitTest.inf -- 2.29.2.windows.2