[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <157045976599.9978.16157507866106024022.tip-bot2@tip-bot2>
Date: Mon, 07 Oct 2019 14:49:25 -0000
From: "tip-bot2 for Hans de Goede" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Arvind Sankar <nivedita@...m.mit.edu>,
Hans de Goede <hdegoede@...hat.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-crypto@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [tip: x86/urgent] x86/boot: Provide memzero_explicit()
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: ee008a19f1c72c37ffa54326a592035dddb66fd6
Gitweb: https://git.kernel.org/tip/ee008a19f1c72c37ffa54326a592035dddb66fd6
Author: Hans de Goede <hdegoede@...hat.com>
AuthorDate: Mon, 07 Oct 2019 15:47:24 +02:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Mon, 07 Oct 2019 16:47:35 +02:00
x86/boot: Provide memzero_explicit()
The purgatory code now uses the shared lib/crypto/sha256.c sha256
implementation. This needs memzero_explicit(), implement this.
We also have barrier_data() call after the memset, making sure
neither the compiler nor the linker optimizes out this seemingly
unused function.
Reported-by: Arvind Sankar <nivedita@...m.mit.edu>
Signed-off-by: Hans de Goede <hdegoede@...hat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: H . Peter Anvin <hpa@...or.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-crypto@...r.kernel.org
Fixes: 906a4bb97f5d ("crypto: sha256 - Use get/put_unaligned_be32 to get input, memzero_explicit")
Link: https://lkml.kernel.org/r/20191007134724.4019-1-hdegoede@redhat.com
[ Added comment. ]
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/boot/compressed/string.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/x86/boot/compressed/string.c b/arch/x86/boot/compressed/string.c
index 81fc1ea..dd30e63 100644
--- a/arch/x86/boot/compressed/string.c
+++ b/arch/x86/boot/compressed/string.c
@@ -50,6 +50,16 @@ void *memset(void *s, int c, size_t n)
return s;
}
+void memzero_explicit(void *s, size_t count)
+{
+ memset(s, 0, count);
+ /*
+ * Make sure this function never gets inlined and
+ * the memset() never gets optimized away:
+ */
+ barrier_data(s);
+}
+
void *memmove(void *dest, const void *src, size_t n)
{
unsigned char *d = dest;
Powered by blists - more mailing lists