From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9E67C47404 for ; Mon, 7 Oct 2019 14:50:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BD2D21479 for ; Mon, 7 Oct 2019 14:50:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728724AbfJGOuZ (ORCPT ); Mon, 7 Oct 2019 10:50:25 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44529 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728708AbfJGOtr (ORCPT ); Mon, 7 Oct 2019 10:49:47 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iHUKI-00066Y-PO; Mon, 07 Oct 2019 16:49:30 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 0FE711C032F; Mon, 7 Oct 2019 16:49:26 +0200 (CEST) Date: Mon, 07 Oct 2019 14:49:25 -0000 From: "tip-bot2 for Hans de Goede" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/boot: Provide memzero_explicit() Cc: Arvind Sankar , Hans de Goede , Ard Biesheuvel , Borislav Petkov , "H . Peter Anvin" , Herbert Xu , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , linux-crypto@vger.kernel.org, Ingo Molnar , linux-kernel@vger.kernel.org In-Reply-To: <20191007134724.4019-1-hdegoede@redhat.com> References: <20191007134724.4019-1-hdegoede@redhat.com> MIME-Version: 1.0 Message-ID: <157045976599.9978.16157507866106024022.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 AuthorDate: Mon, 07 Oct 2019 15:47:24 +02:00 Committer: Ingo Molnar 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 Signed-off-by: Hans de Goede Cc: Ard Biesheuvel Cc: Borislav Petkov Cc: H . Peter Anvin Cc: Herbert Xu Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-crypto@vger.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 --- 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;