From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by mx.groups.io with SMTP id smtpd.web08.5317.1634987035176210632 for ; Sat, 23 Oct 2021 04:03:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=gnqBGZLd; spf=pass (domain: gmx.de, ip: 212.227.17.20, mailfrom: xypron.glpk@gmx.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1634987012; bh=41jDlPxt2vSpjRKTXoOHMWFU7gzGTbz+HeExNRNGJpE=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=gnqBGZLdkUfcyM3dPlVFBbYu+ikKmy1kb3bgPMvKISzh4A5IZj+0udVqsdfC49207 lYS2xvVCAENWlrmWf5PVkAqCpVP5K44sZBvDXahsgv8sIw9UAegjjaLt9gUBotmA7M tdFqOV4X7f+hJrm5O1hZz33/r5ODXIBC7Jth/cc4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.35] ([88.152.144.157]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MV67y-1mEHi93LD4-00SAiH; Sat, 23 Oct 2021 13:03:31 +0200 Message-ID: Date: Sat, 23 Oct 2021 13:03:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: Return EFI_INVALID_PARAMETER if attribute only has EFI_VARIABLE_NON_VOLATILE set To: Sunny Wang Cc: Samer El-Haj-Mahmoud , G Edhaya Chandran , gaoliming , edk2-devel-groups-io , "Wu, Hao A" References: From: "Heinrich Schuchardt" In-Reply-To: X-Provags-ID: V03:K1:R6K1q+bQJ8BfpR2l32IE1JdhTieS3RklVKZekn5+1yQ9BtVb5O6 dwwoz535m6I3CPDcF1xhaym2ZRyW3IApz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0RiMj7OR buXjl6f+NcNz1wDfe42W76ORnzBFnjgv90jq4L1b68S0logFKJ67b9GXNCiJ7klhaaifQWP+0 eY/vuFbF0rrx3YDXbc0lkDAzlgEmLM+CsfayA+wl4rKXPsFgz5keD6RVT6+kZcGqPx72Nz6lG sTb59Yod8PQsaY22QmeJ1qRmqdvm+Ujjmidrz/fQ0se1HaxZQqIOVon7rk1Peg7b/3yxn99zj kT6GyDL4VOKU8M= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 10/21/21 12:18, Sunny Wang wrote: > Hi Liming, Hao, and all > > Now we=E2=80=99re checking the SCT runtime variable service test case. > https://github.com/tianocore/edk2-test/blob/92a0343c1553342c53fae9d9d646= b763add232c0/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableSer= vices/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. =C2=A0Actually, it looks = like > making NO sense to have a variable attribute combination that doesn=E2= =80=99t > 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. =C2=A0What do you guys think? The Self Certification Test (SCT) II Case Specification, June 2017 explicitly forbids this value for QueryVariableInfo(): 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. This corresponds to the UEFI specification saying: QueryVariableInfo() Status Codes returned EFI_INVALID_PARAMETER: An invalid combination of attribute bits was supplied. A variable being not accessible at BootTime seems not to be foreseen by the specification: 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. 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