public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set
@ 2021-10-21 10:18 Sunny Wang
  2021-10-22  1:13 ` 回复: [edk2-devel] " gaoliming
  2021-10-23 11:03 ` Heinrich Schuchardt
  0 siblings, 2 replies; 3+ messages in thread
From: Sunny Wang @ 2021-10-21 10:18 UTC (permalink / raw)
  To: Wu, Hao A, gaoliming, edk2-devel-groups-io
  Cc: Samer El-Haj-Mahmoud, Sunny Wang, G Edhaya Chandran,
	xypron.glpk@gmx.de

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

Hi Liming, Hao, and all

Now we're checking the SCT runtime variable service test case. https://github.com/tianocore/edk2-test/blob/92a0343c1553342c53fae9d9d646b763add232c0/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c#L3401 and have a question below.

Is there any use case to call the runtime variable service functions with the Attributes that only has EFI_VARIABLE_NON_VOLATILE set?

We checked UEFI spec, documents, and current EDK2 implementation. There is no specific description or any implementation for this. However, there seems an implication that EFI_VARIABLE_NON_VOLATILE must be set with at least EFI_VARIABLE_BOOTSERVICE_ACCESS.  Actually, it looks like making NO sense to have a variable attribute combination that doesn't have any XXXXX_ACCESS attribute (BS, RT, or AT) set.

Therefore, we think only having EFI_VARIABLE_NON_VOLATILE set may be an invalid case and would like to add a check into the EDK2 variable driver to return EFI_INVALID_PARAMETER.  What do you guys think?

Best Regards,
Sunny




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.

[-- Attachment #2: Type: text/html, Size: 3974 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 回复: [edk2-devel] Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set
  2021-10-21 10:18 Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set Sunny Wang
@ 2021-10-22  1:13 ` gaoliming
  2021-10-23 11:03 ` Heinrich Schuchardt
  1 sibling, 0 replies; 3+ messages in thread
From: gaoliming @ 2021-10-22  1:13 UTC (permalink / raw)
  To: devel, Sunny.Wang, 'Wu, Hao A'
  Cc: 'Samer El-Haj-Mahmoud', 'G Edhaya Chandran',
	xypron.glpk

[-- Attachment #1: Type: text/plain, Size: 2153 bytes --]

Sunny:

 Yes. Only EFI_VARIABLE_NON_VOLATILE attribute can’t be used by any module.
So, I also think it is the invalid case. 

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Sunny Wang
发送时间: 2021年10月21日 18:19
收件人: Wu, Hao A <hao.a.wu@intel.com>; gaoliming
<gaoliming@byosoft.com.cn>; edk2-devel-groups-io <devel@edk2.groups.io>
抄送: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; Sunny Wang
<Sunny.Wang@arm.com>; G Edhaya Chandran <Edhaya.Chandran@arm.com>;
xypron.glpk@gmx.de
主题: [edk2-devel] Return EFI_INVALID_PARAMETER if attribute only has
EFI_VARIABLE_NON_VOLATILE set

 

Hi Liming, Hao, and all

 

Now we’re checking the SCT runtime variable service test case.
https://github.com/tianocore/edk2-test/blob/92a0343c1553342c53fae9d9d646b763
add232c0/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/
BlackBoxTest/VariableServicesBBTestConformance.c#L3401 and have a question
below. 

 

Is there any use case to call the runtime variable service functions with
the Attributes that only has EFI_VARIABLE_NON_VOLATILE set? 

 

We checked UEFI spec, documents, and current EDK2 implementation. There is
no specific description or any implementation for this. However, there seems
an implication that EFI_VARIABLE_NON_VOLATILE must be set with at least
EFI_VARIABLE_BOOTSERVICE_ACCESS.  Actually, it looks like making NO sense to
have a variable attribute combination that doesn’t have any XXXXX_ACCESS
attribute (BS, RT, or AT) set.

 

Therefore, we think only having EFI_VARIABLE_NON_VOLATILE set may be an
invalid case and would like to add a check into the EDK2 variable driver to
return EFI_INVALID_PARAMETER.  What do you guys think?

 

Best Regards,

Sunny

 

 

 

 

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. 




[-- Attachment #2: Type: text/html, Size: 6670 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set
  2021-10-21 10:18 Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set Sunny Wang
  2021-10-22  1:13 ` 回复: [edk2-devel] " gaoliming
@ 2021-10-23 11:03 ` Heinrich Schuchardt
  1 sibling, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2021-10-23 11:03 UTC (permalink / raw)
  To: Sunny Wang
  Cc: Samer El-Haj-Mahmoud, G Edhaya Chandran, gaoliming,
	edk2-devel-groups-io, Wu, Hao A



On 10/21/21 12:18, Sunny Wang wrote:
> Hi Liming, Hao, and all
>
> Now we’re checking the SCT runtime variable service test case.
> https://github.com/tianocore/edk2-test/blob/92a0343c1553342c53fae9d9d646b763add232c0/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c#L3401
> <https://github.com/tianocore/edk2-test/blob/92a0343c1553342c53fae9d9d646b763add232c0/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBoxTest/VariableServicesBBTestConformance.c#L3401>
> and have a question below.
>
> Is there any use case to call the runtime variable service functions
> with the Attributes that only has EFI_VARIABLE_NON_VOLATILE set?
>
> We checked UEFI spec, documents, and current EDK2 implementation. There
> is no specific description or any implementation for this. However,
> there seems an implication that EFI_VARIABLE_NON_VOLATILE must be set
> with at least EFI_VARIABLE_BOOTSERVICE_ACCESS.  Actually, it looks like
> making NO sense to have a variable attribute combination that doesn’t
> have any XXXXX_ACCESS attribute (BS, RT, or AT) set.
>
> Therefore, we think only having EFI_VARIABLE_NON_VOLATILE set may be an
> invalid case and would like to add a check into the EDK2 variable driver
> to return EFI_INVALID_PARAMETER.  What do you guys think?

The Self Certification Test (SCT) II Case Specification, June 2017
explicitly forbids this value for QueryVariableInfo():

<cite>
5.2.1.4.5

  Call QueryVariableInfo service with the Attributes:

* EFI_VARIABLE_NON_VOLATILE
* EFI_VARIABLE_RUNTIME_ACCESS
* EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_RUNTIME_ACCESS

The returned code must be EFI_INVALID_PARAMETER.
</cite>

This corresponds to the UEFI specification saying:
<cite>
QueryVariableInfo()
Status Codes returned
EFI_INVALID_PARAMETER:
An invalid combination of attribute bits was supplied.
</cite>

A variable being not accessible at BootTime seems not to be foreseen by
the specification:

<cite>
SetVariable()
...
If software uses a nonvolatile variable, it should use a variable that
is only accessible at boot services time if possible.
...
Attributes that have EFI_VARIABLE_RUNTIME_ACCESS set must also have
EFI_VARIABLE_BOOTSERVICE_ACCESS set.
</cite>

This sounds like a nonvolatile variable should always be accessible at
boot services time. But an explicit rule forbidding the creation of
inaccessible variables, i.e. without EFI_VARIABLE_BOOTSERVICE_ACCESS, is
missing.

It would be good to have a paragraph in the specification that
unambiguously defines which combination of attribute bits are valid.

How about:

"All variables must be created with attribute bit
EFI_VARIABLE_BOOTSERVICE_ACCESS."

Best regards

Heinrich

>
> Best Regards,
>
> Sunny

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-23 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-21 10:18 Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set Sunny Wang
2021-10-22  1:13 ` 回复: [edk2-devel] " gaoliming
2021-10-23 11:03 ` Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox