lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 31 Oct 2020 12:51:21 -0400
From:   "Daniel P. Smith" <dpsmith@...rtussolutions.com>
To:     linux-kernel@...r.kernel.org, x86@...nel.org,
        linux-integrity@...r.kernel.org
Cc:     ross.philipson@...cle.com, dpsmith@...rtussolutions.com,
        jarkko.sakkinen@...ux.intel.com, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, hpa@...or.com, luto@...capital.net,
        trenchboot-devel@...glegroups.com
Subject: [RFC PATCH 3/4] tpm: Conditionally use static buffer in TPM buffer management

Memory management calls cannot be made in the compressed kernel
environment to dynamically allocate TPM buffer space. For the Secure
Launch early PCR extend code, use a static buffer instead.

Signed-off-by: Daniel P. Smith <dpsmith@...rtussolutions.com>
Signed-off-by: Ross Philipson <ross.philipson@...cle.com>
---
 include/linux/tpm_buffer.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/tpm_buffer.h b/include/linux/tpm_buffer.h
index 8144a52fbc0a..c9482edf6618 100644
--- a/include/linux/tpm_buffer.h
+++ b/include/linux/tpm_buffer.h
@@ -18,6 +18,10 @@
 #ifndef __LINUX_TPM_BUFFER_H__
 #define __LINUX_TPM_BUFFER_H__
 
+#ifdef COMPRESSED_KERNEL
+static u8 _tpm_buffer[PAGE_SIZE] = {0};
+#endif
+
 struct tpm_header {
 	__be16 tag;
 	__be32 length;
@@ -52,7 +56,11 @@ static inline void tpm_buf_reset(struct tpm_buf *buf, u16 tag, u32 ordinal)
 
 static inline int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32 ordinal)
 {
+#ifdef COMPRESSED_KERNEL
+	buf->data = _tpm_buffer;
+#else
 	buf->data = (u8 *)__get_free_page(GFP_KERNEL);
+#endif
 	if (!buf->data)
 		return -ENOMEM;
 
@@ -63,7 +71,9 @@ static inline int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32 ordinal)
 
 static inline void tpm_buf_destroy(struct tpm_buf *buf)
 {
+#ifndef COMPRESSED_KERNEL
 	free_page((unsigned long)buf->data);
+#endif
 }
 
 static inline u32 tpm_buf_length(struct tpm_buf *buf)
@@ -92,7 +102,9 @@ static inline void tpm_buf_append(struct tpm_buf *buf,
 		return;
 
 	if ((len + new_len) > PAGE_SIZE) {
+#ifndef COMPRESSED_KERNEL
 		WARN(1, "tpm_buf: overflow\n");
+#endif
 		buf->flags |= TPM_BUF_OVERFLOW;
 		return;
 	}
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ