From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.91.1675981870022158431 for ; Thu, 09 Feb 2023 14:31:10 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: stuart.yoder@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E3E602F4; Thu, 9 Feb 2023 14:31:51 -0800 (PST) Received: from beelzebub.ast.arm.com (unknown [10.118.28.31]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 646C83F8C6; Thu, 9 Feb 2023 14:31:09 -0800 (PST) From: "Stuart Yoder" To: devel@edk2.groups.io Cc: gaoliming@byosoft.com.cn, hao.a.wu@intel.com, Sunny.Wang@arm.com Subject: [PATCH] MdeModulePkg/Variable: Attribute combination should return EFI_UNSUPPORTED Date: Thu, 9 Feb 2023 16:30:58 -0600 Message-Id: <20230209223058.199878-1-stuart.yoder@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4341 Commit 21320ef66989 broke some tests in the AuthVar_Conf test in edk2-test. There are 2 testcases that invoke SetVariable with the following attribute value: (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and the UEFI spec says this should return EFI_UNSUPPORTED. Cc: Liming Gao Cc: Hao A Wu Cc: Sunny Wang Signed-off-by: Stuart Yoder --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeMod= ulePkg/Universal/Variable/RuntimeDxe/Variable.c index 6c1a3440ac..14c176887a 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -2676,7 +2676,11 @@ VariableServiceSetVariable ( //=0D // Only EFI_VARIABLE_NON_VOLATILE attribute is invalid=0D //=0D - return EFI_INVALID_PARAMETER;=0D + if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) !=3D 0) {=0D + return EFI_UNSUPPORTED;=0D + } else {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D } else if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) !=3D 0) {=0D if (!mVariableModuleGlobal->VariableGlobal.AuthSupport) {=0D //=0D --=20 2.34.1