Thread (19 messages) 19 messages, 2 authors, 14d ago

[PATCH v4 6/9] keys/trusted_keys: clear sensitive PKWM buffers

flat view
COOLING14d SUPERSEDED: 3 (2M)

From: Srish Srinivasan <ssrish@linux.ibm.com>
Date: 2026-10-17 18:40:20
Also in: keyrings, linux-integrity, linuxppc-dev, lkml, stable
Subsystem: keys-trusted, keys-trusted-pkwm, keys/keyrings, security subsystem, the rest · Maintainers: James Bottomley, Jarkko Sakkinen, Mimi Zohar, Srish Srinivasan, Nayna Jain, David Howells, Paul Moore, James Morris, "Serge E. Hallyn", Linus Torvalds

Status: Superseded by v5 (posted 2026-10-18). [go to v5]

Revision v4 (5 revisions archived); 3 review trailers (2 from subsystem maintainers).

Revisions (5)
  1. v1
  2. v2 [diff against previous]
  3. v3 [diff against previous]
  4. v4 current [diff against previous]
  5. v5 [diff against previous]
The input buffer to PKWM seal and the output buffer from PKWM unseal
contain plaintext trusted-key payload data. Freeing these buffers with
kfree(), without wiping the contents, can leave sensitive key material
in memory.

Use kfree_sensitive() to wipe the sensitive key material when freeing
these buffers.

Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source")
Cc: <redacted> # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: R Nageswara Sastry <redacted>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
---
 security/keys/trusted-keys/trusted_pkwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
index 7345f233eb74..b5c3d17be475 100644
--- a/security/keys/trusted-keys/trusted_pkwm.c
+++ b/security/keys/trusted-keys/trusted_pkwm.c
@@ -118,7 +118,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
 		pr_err("Wrapping of payload key failed: %d\n", rc);
 	}
 
-	kfree(input_buf);
+	kfree_sensitive(input_buf);
 	kfree(output_buf);
 
 out:
@@ -153,7 +153,7 @@ static int trusted_pkwm_unseal(struct trusted_key_payload *p, char *datablob)
 	}
 
 	kfree(input_buf);
-	kfree(output_buf);
+	kfree_sensitive(output_buf);
 
 	return rc;
 }
-- 
2.52.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help