From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web09.17018.1641949632143312422 for ; Tue, 11 Jan 2022 17:07:13 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Wed, 12 Jan 2022 09:06:54 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Heinrich Schuchardt'" , "'G Edhaya Chandran'" , "'Samer El-Haj-Mahmoud'" References: <20220111213720.1358-1-Sunny.Wang@arm.com> In-Reply-To: <20220111213720.1358-1-Sunny.Wang@arm.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIXSBNZGVNb2R1bGVQa2cvVmFyaWFibGU6IE1ha2Ugb25seSBFRklfVkFSSUFCTEVfTk9OX1ZPTEFUSUxFIGludmFsaWQ=?= Date: Wed, 12 Jan 2022 09:06:59 +0800 Message-ID: <000001d80750$b3ada770$1b08f650$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIMGlR/9bABxZfqEbTtw8UZ4/bv6qv2bJng Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io = =B4=FA=B1=ED Sunny Wang > =B7=A2=CB=CD=CA=B1=BC=E4: 2022=C4=EA1=D4=C212=C8=D5 5:37 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Sunny Wang ; Liming Gao > ; Heinrich Schuchardt > ; G Edhaya Chandran > ; Samer El-Haj-Mahmoud > ; Sunny Wang > =D6=F7=CC=E2: [edk2-devel] [PATCH] MdeModulePkg/Variable: Make only > EFI_VARIABLE_NON_VOLATILE invalid >=20 > Only EFI_VARIABLE_NON_VOLATILE attribute is an invalid combination > of attribute bits, so update the variable driver to return > EFI_INVALID_PARAMETER so that we can prevent the invalid variable > being created. >=20 > This change also fixes the SCT failure below: > - RT.QueryVariableInfo - With being an invalid combination -- FAILURE >=20 > For details, please check the threads below: > - https://edk2.groups.io/g/devel/topic/86486174 > - https://edk2.groups.io/g/devel/message/82466 >=20 > Cc: Liming Gao > Cc: Heinrich Schuchardt > Cc: G Edhaya Chandran > Cc: Samer El-Haj-Mahmoud >=20 > Signed-off-by: Sunny Wang > --- > .../Universal/Variable/RuntimeDxe/Variable.c | 16 = +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index 9722a94420..6c1a3440ac 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -19,6 +19,7 @@ > Copyright (c) 2006 - 2020, Intel Corporation. All rights = reserved.
> (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
> Copyright (c) Microsoft Corporation.
> +Copyright (c) 2022, ARM Limited. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -2660,14 +2661,22 @@ VariableServiceSetVariable ( > } >=20 > // > - // Make sure if runtime bit is set, boot service bit is set also. > + // Check if the combination of attribute bits is valid. > // > if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | > EFI_VARIABLE_BOOTSERVICE_ACCESS)) =3D=3D EFI_VARIABLE_RUNTIME_ACCESS) > { > + // > + // Make sure if runtime bit is set, boot service bit is set also. > + // > if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) !=3D = 0) > { > return EFI_UNSUPPORTED; > } else { > return EFI_INVALID_PARAMETER; > } > + } else if ((Attributes & EFI_VARIABLE_ATTRIBUTES_MASK) =3D=3D > EFI_VARIABLE_NON_VOLATILE) { > + // > + // Only EFI_VARIABLE_NON_VOLATILE attribute is invalid > + // > + return EFI_INVALID_PARAMETER; > } else if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) !=3D 0) { > if (!mVariableModuleGlobal->VariableGlobal.AuthSupport) { > // > @@ -3142,6 +3151,11 @@ VariableServiceQueryVariableInfo ( > // Make sure the Attributes combination is supported by the = platform. > // > return EFI_UNSUPPORTED; > + } else if ((Attributes & EFI_VARIABLE_ATTRIBUTES_MASK) =3D=3D > EFI_VARIABLE_NON_VOLATILE) { > + // > + // Only EFI_VARIABLE_NON_VOLATILE attribute is invalid > + // > + return EFI_INVALID_PARAMETER; > } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | > EFI_VARIABLE_BOOTSERVICE_ACCESS)) =3D=3D EFI_VARIABLE_RUNTIME_ACCESS) > { > // > // Make sure if runtime bit is set, boot service bit is set also. > -- > 2.33.0.windows.2 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#85574): = https://edk2.groups.io/g/devel/message/85574 > Mute This Topic: https://groups.io/mt/88359863/4905953 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [gaoliming@byosoft.com.cn] > -=3D-=3D-=3D-=3D-=3D-=3D >=20