* [PATCH 01/12] pseries/plpks: fix error handling in plpks_read_var()
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 02/12] pseries/plpks: fix error code for wrapping key reads Srish Srinivasan
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
When a PLPKS variable is initialized without a policy and used to read an
object with the PLPKS_WRAPPINGKEY policy set, the hypervisor returns
H_AUTHORITY along with the object's policy. However, plpks_read_var()
currently treats this the same as any other H_AUTHORITY failure and returns
an error without propagating the policy information to the caller.
Distinguish this case from other H_AUTHORITY failures and propagate the
returned policy to the caller while preserving the authorization error.
Remove the explicit assignment of zero to rc on H_SUCCESS, as it is
redundant.
Also validate the PLPKS variable pointer before dereferencing it.
Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
Cc: stable@vger.kernel.org # 6.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 23e4e2a922fc..7e56b3dcacbc 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -822,6 +822,9 @@ static int plpks_read_var(u8 consumer, struct plpks_var *var)
u8 *output;
int rc;
+ if (!var)
+ return -EINVAL;
+
if (var->namelen > PLPKS_MAX_NAME_SIZE)
return -EINVAL;
@@ -856,22 +859,21 @@ static int plpks_read_var(u8 consumer, struct plpks_var *var)
virt_to_phys(var->name), var->namelen, virt_to_phys(output),
maxobjsize);
-
if (rc != H_SUCCESS) {
rc = pseries_status_to_err(rc);
- goto out_free_output;
+ if (rc != -EPERM || !retbuf[1])
+ goto out_free_output;
+ goto out_copy_policy;
}
if (!var->data || var->datalen > retbuf[0])
var->datalen = retbuf[0];
- var->policy = retbuf[1];
-
if (var->data)
memcpy(var->data, output, var->datalen);
- rc = 0;
-
+out_copy_policy:
+ var->policy = retbuf[1];
out_free_output:
kfree(output);
out_free_label:
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 02/12] pseries/plpks: fix error code for wrapping key reads
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
2026-09-23 18:28 ` [PATCH 01/12] pseries/plpks: fix error handling in plpks_read_var() Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 03/12] pseries/plpks: validate input to plpks_signed_update_var() Srish Srinivasan
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
PLPKS variables with the PLPKS_WRAPPINGKEY policy bit set are not
readable. Return -EPERM instead of -EINVAL in this case to better
reflect the access restriction being enforced.
Fixes: 133aa79e211d ("pseries/plpks: add HCALLs for PowerVM Key Wrapping Module")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 7e56b3dcacbc..ccf5765a907b 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -829,7 +829,7 @@ static int plpks_read_var(u8 consumer, struct plpks_var *var)
return -EINVAL;
if (var->policy & PLPKS_WRAPPINGKEY)
- return -EINVAL;
+ return -EPERM;
auth = construct_auth(consumer);
if (IS_ERR(auth))
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 03/12] pseries/plpks: validate input to plpks_signed_update_var()
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
2026-09-23 18:28 ` [PATCH 01/12] pseries/plpks: fix error handling in plpks_read_var() Srish Srinivasan
2026-09-23 18:28 ` [PATCH 02/12] pseries/plpks: fix error code for wrapping key reads Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 04/12] pseries/plpks: clear sensitive PLPKS buffers Srish Srinivasan
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
plpks_signed_update_var() dereferences the supplied PLPKS variable pointer
without validating it. A NULL argument could therefore result in a NULL
pointer dereference.
Reject a NULL pointer argument with -EINVAL.
Fixes: 899d9b8fee66 ("powerpc/pseries: Implement signed update for PLPKS objects")
Cc: stable@vger.kernel.org # 6.3
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index ccf5765a907b..e3ae2cd78247 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -637,6 +637,9 @@ int plpks_signed_update_var(struct plpks_var *var, u64 flags)
u64 continuetoken = 0;
u64 timeout = 0;
+ if (!var)
+ return -EINVAL;
+
if (!var->data || var->datalen <= 0 || var->namelen > PLPKS_MAX_NAME_SIZE)
return -EINVAL;
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 04/12] pseries/plpks: clear sensitive PLPKS buffers
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (2 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 03/12] pseries/plpks: validate input to plpks_signed_update_var() Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 05/12] pseries/plpks: clear sensitive buffers in wrapping operations Srish Srinivasan
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
PLPKS read, remove, and write operations use authentication buffers that
contain passwords. The read output buffer may also contain sensitive data.
Freeing these buffers with kfree(), without wiping the contents, can leave
sensitive data in memory.
Use kfree_sensitive() to wipe the buffers when freeing them.
Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
Cc: stable@vger.kernel.org # 6.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index e3ae2cd78247..8dbf85e9714c 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -754,7 +754,7 @@ int plpks_write_var(struct plpks_var var)
rc = pseries_status_to_err(rc);
kfree(label);
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
@@ -812,7 +812,7 @@ int plpks_remove_var(char *component, u8 varos, struct plpks_var_name vname)
rc = pseries_status_to_err(rc);
kfree(label);
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
@@ -878,11 +878,11 @@ static int plpks_read_var(u8 consumer, struct plpks_var *var)
out_copy_policy:
var->policy = retbuf[1];
out_free_output:
- kfree(output);
+ kfree_sensitive(output);
out_free_label:
kfree(label);
out_free_auth:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 05/12] pseries/plpks: clear sensitive buffers in wrapping operations
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (3 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 04/12] pseries/plpks: clear sensitive PLPKS buffers Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 06/12] pseries/plpks: clear signed update authentication buffer Srish Srinivasan
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
PLPKS wrapping key generation, object wrapping, and object unwrapping use
authentication buffers that contain passwords. An object unwrapping failure
also frees an output buffer that may contain sensitive data. Freeing these
buffers with kfree(), without wiping the contents, can leave sensitive data
in memory.
Use kfree_sensitive() to wipe the buffers when freeing them.
Fixes: 133aa79e211d ("pseries/plpks: add HCALLs for PowerVM Key Wrapping Module")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 8dbf85e9714c..17a73a04d45b 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -975,7 +975,7 @@ int plpks_gen_wrapping_key(void)
kfree(label);
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
EXPORT_SYMBOL_GPL(plpks_gen_wrapping_key);
@@ -1100,7 +1100,7 @@ int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
out_free_label:
kfree(label);
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
EXPORT_SYMBOL_GPL(plpks_wrap_object);
@@ -1177,14 +1177,14 @@ int plpks_unwrap_object(u8 **input_buf, u32 input_len, u8 **output_buf,
if (rc) {
pr_err("H_PKS_UNWRAP_OBJECT failed. pseries_status=%d, rc=%d",
pseries_status, rc);
- kfree(*output_buf);
+ kfree_sensitive(*output_buf);
*output_buf = NULL;
} else {
*output_len = retbuf[1];
}
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
EXPORT_SYMBOL_GPL(plpks_unwrap_object);
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 06/12] pseries/plpks: clear signed update authentication buffer
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (4 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 05/12] pseries/plpks: clear sensitive buffers in wrapping operations Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 07/12] pseries/plpks: clear SED key data after use Srish Srinivasan
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
The PLPKS signed update operation uses an authentication buffer that
contains a password. Freeing this buffer with kfree(), without wiping
the contents, can leave sensitive data in memory.
Use kfree_sensitive() to wipe the buffer when freeing it.
Fixes: 899d9b8fee66 ("powerpc/pseries: Implement signed update for PLPKS objects")
Cc: stable@vger.kernel.org # 6.3
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 17a73a04d45b..b057e378a6b3 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -685,7 +685,7 @@ int plpks_signed_update_var(struct plpks_var *var, u64 flags)
kfree(label);
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 07/12] pseries/plpks: clear SED key data after use
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (5 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 06/12] pseries/plpks: clear signed update authentication buffer Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 08/12] pseries/plpks: fix self-reference in plpks_var initializer Srish Srinivasan
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
Explicitly clear the temporary buffer containing SED key data after read
and write operations.
Fixes: ec8cf230cecc ("powerpc/pseries: PLPKS SED Opal keystore support")
Cc: stable@vger.kernel.org # 6.7
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Greg Joyce <gjoyce@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks_sed_ops.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks_sed_ops.c b/arch/powerpc/platforms/pseries/plpks_sed_ops.c
index 7c873c9589ef..ac3ec2ca7fbe 100644
--- a/arch/powerpc/platforms/pseries/plpks_sed_ops.c
+++ b/arch/powerpc/platforms/pseries/plpks_sed_ops.c
@@ -84,14 +84,16 @@ int sed_read_key(char *keyname, char *key, u_int *keylen)
ret = plpks_read_os_var(&var);
if (ret != 0)
- return ret;
+ goto out;
len = min_t(u16, be32_to_cpu(data.key_len), var.datalen);
memcpy(key, data.key, len);
key[len] = '\0';
*keylen = len;
- return 0;
+out:
+ memzero_explicit(&data, sizeof(data));
+ return ret;
}
/*
@@ -102,6 +104,7 @@ int sed_write_key(char *keyname, char *key, u_int keylen)
struct plpks_var var;
struct plpks_sed_object_data data;
struct plpks_var_name vname;
+ int ret;
plpks_init_var(&var, keyname);
@@ -127,5 +130,8 @@ int sed_write_key(char *keyname, char *key, u_int keylen)
vname.name = var.name;
plpks_remove_var(var.component, var.os, vname);
- return plpks_write_var(var);
+ ret = plpks_write_var(var);
+ memzero_explicit(&data, sizeof(data));
+
+ return ret;
}
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 08/12] pseries/plpks: fix self-reference in plpks_var initializer
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (6 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 07/12] pseries/plpks: clear SED key data after use Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 09/12] pseries/plpks: hide wrapping_features when unsupported Srish Srinivasan
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
In plpks_gen_wrapping_key() and plpks_wrap_object(), strlen(var.name) is
used to initialize var.namelen within the same struct initializer. This
references a member of var before initialization of var is complete.
Use the compile-time length of PLPKS_WRAPKEY_NAME instead.
Reported-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
Fixes: 133aa79e211d ("pseries/plpks: add HCALLs for PowerVM Key Wrapping Module")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index b057e378a6b3..896eda3eb65f 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -939,7 +939,7 @@ int plpks_gen_wrapping_key(void)
int rc = 0, pseries_status = 0;
struct plpks_var var = {
.name = PLPKS_WRAPKEY_NAME,
- .namelen = strlen(var.name),
+ .namelen = sizeof(PLPKS_WRAPKEY_NAME) - 1,
.policy = PLPKS_WRAPPINGKEY,
.os = PLPKS_VAR_LINUX,
.component = PLPKS_WRAPKEY_COMPONENT
@@ -1034,7 +1034,7 @@ int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
bool sb_enforce_bit = wrap_flags & BIT(1);
struct plpks_var var = {
.name = PLPKS_WRAPKEY_NAME,
- .namelen = strlen(var.name),
+ .namelen = sizeof(PLPKS_WRAPKEY_NAME) - 1,
.os = PLPKS_VAR_LINUX,
.component = PLPKS_WRAPKEY_COMPONENT
};
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 09/12] pseries/plpks: hide wrapping_features when unsupported
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (7 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 08/12] pseries/plpks: fix self-reference in plpks_var initializer Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 10/12] pseries/plpks: make narrowing conversions explicit Srish Srinivasan
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish, stable
The PLPKS wrapping features config is only valid on systems that support
the "Key Wrapping" feature. Currently the config is always exposed, even
when the feature is unavailable.
Add an is_visible() callback to suppress the wrapping_features sysfs
attribute when the "Key Wrapping" feature is not supported. Declare the
attribute group static const, as it is not modified after initialization.
Fixes: 447eb1d5ef00 ("pseries/plpks: expose PowerVM wrapping features via the sysfs")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks-sysfs.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks-sysfs.c b/arch/powerpc/platforms/pseries/plpks-sysfs.c
index c2ebcbb41ae3..f2436229f323 100644
--- a/arch/powerpc/platforms/pseries/plpks-sysfs.c
+++ b/arch/powerpc/platforms/pseries/plpks-sysfs.c
@@ -45,6 +45,16 @@ static const struct attribute *config_attrs[] = {
static struct kobject *plpks_kobj, *plpks_config_kobj;
+static umode_t plpks_config_attr_is_visible(struct kobject *kobj,
+ struct attribute *attr, int n)
+{
+ if (attr == &attr_wrapping_features.attr &&
+ !plpks_wrapping_is_supported())
+ return 0;
+
+ return attr->mode;
+}
+
int plpks_config_create_softlink(struct kobject *from)
{
if (!plpks_config_kobj)
@@ -52,13 +62,13 @@ int plpks_config_create_softlink(struct kobject *from)
return sysfs_create_link(from, plpks_config_kobj, "config");
}
+static const struct attribute_group config_group = {
+ .attrs = (struct attribute **)config_attrs,
+ .is_visible = plpks_config_attr_is_visible,
+};
+
static __init int plpks_sysfs_config(struct kobject *kobj)
{
- struct attribute_group config_group = {
- .name = NULL,
- .attrs = (struct attribute **)config_attrs,
- };
-
return sysfs_create_group(kobj, &config_group);
}
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 10/12] pseries/plpks: make narrowing conversions explicit
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (8 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 09/12] pseries/plpks: hide wrapping_features when unsupported Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 11/12] pseries/plpks: rename the default wrapping key macro Srish Srinivasan
2026-09-23 18:28 ` [PATCH 12/12] pseries/plpks: update PKS documentation and MAINTAINERS entry Srish Srinivasan
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish
Add explicit casts when assigning values from the hcall return buffers
to narrower fields to make the intended conversions clear.
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 896eda3eb65f..eff968fe5ae0 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -576,7 +576,7 @@ static int plpks_confirm_object_flushed(struct label *label,
virt_to_phys(auth), virt_to_phys(label),
label->size);
- status = retbuf[0];
+ status = (u8)retbuf[0];
if (rc) {
timed_out = false;
if (rc == H_NOT_FOUND && status == 1)
@@ -870,13 +870,13 @@ static int plpks_read_var(u8 consumer, struct plpks_var *var)
}
if (!var->data || var->datalen > retbuf[0])
- var->datalen = retbuf[0];
+ var->datalen = (u16)retbuf[0];
if (var->data)
memcpy(var->data, output, var->datalen);
out_copy_policy:
- var->policy = retbuf[1];
+ var->policy = (u32)retbuf[1];
out_free_output:
kfree_sensitive(output);
out_free_label:
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 11/12] pseries/plpks: rename the default wrapping key macro
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (9 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 10/12] pseries/plpks: make narrowing conversions explicit Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
2026-09-23 18:28 ` [PATCH 12/12] pseries/plpks: update PKS documentation and MAINTAINERS entry Srish Srinivasan
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish
Rename PLPKS_WRAPKEY_NAME to PLPKS_DEFAULT_WRAPKEY_LABEL to clarify that
the macro represents the default wrapping key label used by PKWM.
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
arch/powerpc/platforms/pseries/plpks.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index eff968fe5ae0..240cd5632446 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -10,7 +10,7 @@
#define pr_fmt(fmt) "plpks: " fmt
#define PLPKS_WRAPKEY_COMPONENT "PLPKSWR"
-#define PLPKS_WRAPKEY_NAME "default-wrapping-key"
+#define PLPKS_DEFAULT_WRAPKEY_LABEL "default-wrapping-key"
/*
* To 4K align the {input, output} buffers to the {UN}WRAP H_CALLs
@@ -938,8 +938,8 @@ int plpks_gen_wrapping_key(void)
struct label *label;
int rc = 0, pseries_status = 0;
struct plpks_var var = {
- .name = PLPKS_WRAPKEY_NAME,
- .namelen = sizeof(PLPKS_WRAPKEY_NAME) - 1,
+ .name = PLPKS_DEFAULT_WRAPKEY_LABEL,
+ .namelen = sizeof(PLPKS_DEFAULT_WRAPKEY_LABEL) - 1,
.policy = PLPKS_WRAPPINGKEY,
.os = PLPKS_VAR_LINUX,
.component = PLPKS_WRAPKEY_COMPONENT
@@ -1033,8 +1033,8 @@ int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
bool sb_audit_or_enforce_bit = wrap_flags & BIT(0);
bool sb_enforce_bit = wrap_flags & BIT(1);
struct plpks_var var = {
- .name = PLPKS_WRAPKEY_NAME,
- .namelen = sizeof(PLPKS_WRAPKEY_NAME) - 1,
+ .name = PLPKS_DEFAULT_WRAPKEY_LABEL,
+ .namelen = sizeof(PLPKS_DEFAULT_WRAPKEY_LABEL) - 1,
.os = PLPKS_VAR_LINUX,
.component = PLPKS_WRAPKEY_COMPONENT
};
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 12/12] pseries/plpks: update PKS documentation and MAINTAINERS entry
2026-09-23 18:28 [PATCH 00/12] Refactor and harden PLPKS code Srish Srinivasan
` (10 preceding siblings ...)
2026-09-23 18:28 ` [PATCH 11/12] pseries/plpks: rename the default wrapping key macro Srish Srinivasan
@ 2026-09-23 18:28 ` Srish Srinivasan
11 siblings, 0 replies; 13+ messages in thread
From: Srish Srinivasan @ 2026-09-23 18:28 UTC (permalink / raw)
To: linuxppc-dev
Cc: maddy, mpe, npiggin, christophe.leroy, nayna, gjoyce,
ritesh.list, sshegde, linux-kernel, rnsastry, ssrish
Wrap long PKS hcall return-value lines consistently and fix a typo in the
H_PKS_UNWRAP_OBJECT description.
Also update the MAINTAINERS entry from KEYS-TRUSTED-PLPKS to
KEYS-TRUSTED-PKWM to reflect the PowerVM Key Wrapping Module naming.
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
Documentation/arch/powerpc/papr_hcalls.rst | 16 ++++++++--------
MAINTAINERS | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Documentation/arch/powerpc/papr_hcalls.rst b/Documentation/arch/powerpc/papr_hcalls.rst
index 14e39f095a1c..44c9c8b32ae3 100644
--- a/Documentation/arch/powerpc/papr_hcalls.rst
+++ b/Documentation/arch/powerpc/papr_hcalls.rst
@@ -305,8 +305,8 @@ like core instruction, core LLAT and nest.
| Input: authorization, objectlabel, objectlabellen, policy, out, outlen
| Out: *Hypervisor Generated Key, or None when the wrapping key policy is set*
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
- H_P3, H_P4, H_P5, H_P6, H_Authority, H_Nomem, H_Busy, H_Resource,
- H_Aborted*
+ H_P3, H_P4, H_P5, H_P6, H_Authority, H_Nomem, H_Busy,
+ H_Resource, H_Aborted*
H_PKS_GEN_KEY is used to have the hypervisor generate a new random key.
This key is stored as an object in the Power LPAR Platform KeyStore with
@@ -321,8 +321,8 @@ the user. Generation of wrapping keys is supported only for a key size of
| inlen, out, outlen, continue-token
| Out: *continue-token, byte size of wrapped object, wrapped object*
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
- H_P3, H_P4, H_P5, H_P6, H_P7, H_P8, H_P9, H_Authority, H_Invalid_Key,
- H_NOT_FOUND, H_Busy, H_LongBusy, H_Aborted*
+ H_P3, H_P4, H_P5, H_P6, H_P7, H_P8, H_P9, H_Authority,
+ H_Invalid_Key, H_NOT_FOUND, H_Busy, H_LongBusy, H_Aborted*
H_PKS_WRAP_OBJECT is used to wrap an object using a wrapping key stored in the
Power LPAR Platform KeyStore and return the wrapped object to the caller. The
@@ -331,16 +331,16 @@ which must have been previously created with H_PKS_GEN_KEY. The provided object
is then encrypted with the wrapping key and additional metadata and the result
is returned to the caller.
-
**H_PKS_UNWRAP_OBJECT**
| Input: authorization, objectwrapflags, in, inlen, out, outlen, continue-token
| Out: *continue-token, byte size of unwrapped object, unwrapped object*
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
- H_P3, H_P4, H_P5, H_P6, H_P7, H_Authority, H_Unsupported, H_Bad_Data,
- H_NOT_FOUND, H_Invalid_Key, H_Busy, H_LongBusy, H_Aborted*
+ H_P3, H_P4, H_P5, H_P6, H_P7, H_Authority, H_Unsupported,
+ H_Bad_Data, H_NOT_FOUND, H_Invalid_Key, H_Busy, H_LongBusy,
+ H_Aborted*
-H_PKS_UNWRAP_OBJECT is used to unwrap an object that was previously warapped with
+H_PKS_UNWRAP_OBJECT is used to unwrap an object that was previously wrapped with
H_PKS_WRAP_OBJECT.
References
diff --git a/MAINTAINERS b/MAINTAINERS
index cc3cae2e378b..932eb463428c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14485,7 +14485,7 @@ S: Supported
F: include/keys/trusted_dcp.h
F: security/keys/trusted-keys/trusted_dcp.c
-KEYS-TRUSTED-PLPKS
+KEYS-TRUSTED-PKWM
M: Srish Srinivasan <ssrish@linux.ibm.com>
M: Nayna Jain <nayna@linux.ibm.com>
L: linux-integrity@vger.kernel.org
--
2.52.0
^ permalink raw reply [flat|nested] 13+ messages in thread