On 5/7/25 11:47 AM, Andrew Donnellan wrote:
On Wed, 2025-05-07 at 00:29 +0530, Srish Srinivasan wrote:
+ rc = plpks_read_fw_var(&var);
+ if (rc) {
+ pr_info("Error %ld reading SB_VERSION from
firmware\n", rc);
We need to check for -ENOENT, otherwise this message is going to be
printed every time you boot a machine in static mode.
Yes, I agree with your concern. I just want to add that, as per my
understanding, we need to check for both -ENOENT and -EPERM,
as explained below:
As per H_PKS_READ_OBJECT semantics described in the PAPR v10.60
(https://files.openpower.foundation/s/XFgfMaqLMD5Bcm8),
* If the object is not world readable, verify that the consumer
password
matches the stored value in the hypervisor. Else return H_AUTHORITY.
* Verify if the object exists, else return H_NOT_FOUND.
* Verify if the policy for the object is met, else return
H_AUTHORITY.
So, the hypervisor returns H_NOT_FOUND only for the authenticated
consumer. For unauthenticated consumers, which is the case here,
it would return H_AUTHORITY.
We expect SB_VERSION to always be world-readable, I think? In which
case it shouldn't return H_AUTHORITY / -EPERM, ever, and if it does
that's an error which should be handled as an error. Or am I
misinterpreting the spec here?
Yes, SB_VERSION is world-readable and should not return H_AUTHORITY in
the case of dynamic key management mode. However, in
the case of static key management mode, when SB_VERSION does not exist,
the hypervisor tries to authenticate the consumer. If the
authentication is successful, H_NOT_FOUND is returned, else H_AUTHORITY
is returned. The intention behind authenticating the
consumer when the object is not found is to ensure that a
non-authenticated consumer is unable to conclude on the absence of
the object. Here, when the kernel tries to read the non-existent
SB_VERSION, it fails the authentication check and therefore,
gets the H_AUTHORITY error code.