Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4392383ybp; Mon, 7 Oct 2019 07:50:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9Yi52lueqTv2SsBGNLlFRDaVB7dDgo3lzxs6gVW7DH/z/Q8LrMk9p/fE4P3385mbctRMJ X-Received: by 2002:a50:9eac:: with SMTP id a41mr9875259edf.193.1570459846361; Mon, 07 Oct 2019 07:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570459846; cv=none; d=google.com; s=arc-20160816; b=JbFzOSG8pl9IrHiRkwjG6yl9HNlX9lQGdRgBabiFuKql/iIIoxrHg4vee0da0qq2WP mMQm5HRug1hZQl+lCL0uPOhD7z2Ogn76I4zOOjVKErGKIsnF74LSuBxdcO3aelNhuhJO daC92LW1dQZdv0b0KV4feGJV5GzitNm0n9iPKBiLTtfNvHviNn49s3h8bO1IDiL5fkRh 2Z2bSPBMDIv0ZyJUp3VUO0qbRc5ABO2l/+RBG0s7eGKHYPxaFQlAg8rB7Y7BNJRal66L CiQ6HxEJSnfVwCfP9pfYoNwKzJY3MSeA1YMZLywCFMNRjfW2TnrS8Dmx8qPESUSB0Dl+ 8syA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=JcPQqv2g9ueGzGy//yktDq8Yij0+jOhkINc6TLyfeOo=; b=mBP6KscS9J87MN53bX3ksN/4OBT06soHbXk5owpVd4nMXFSV/cQUMhWGJoD2Isjdhl tw29b0y/JJ0fGvtn2WXaa6U6DEP+s/b8A9Eup1SkKKRG2EEg3OtDp6QTbJUBdAAvoZy9 O4hOQR15SVrMwtJEOpJg+aiCQqwxC9SlRzs0TbGTPRk7ctIFfritEG2yZykKzQtG8tOP q8Ib5UK89jMXtgEThtUo9d4jcG61EZCI/oohDcrjIaZgFMCNDLoqarSXtxlmzjAO3FRo VtX/7NF58sWp61TJmRVKTT7zCiIhRubFRLS/6fSwmQkLCpQCcNnrepn8/n1jOCpjcAP/ wfVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x47si9040582eda.396.2019.10.07.07.50.22; Mon, 07 Oct 2019 07:50:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728815AbfJGOty (ORCPT + 99 others); Mon, 7 Oct 2019 10:49:54 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44534 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728718AbfJGOts (ORCPT ); Mon, 7 Oct 2019 10:49:48 -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 1iHUKQ-0006Ep-Qt; Mon, 07 Oct 2019 16:49:38 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 8B87E1C0895; Mon, 7 Oct 2019 16:49:34 +0200 (CEST) Date: Mon, 07 Oct 2019 14:49:34 -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: <157045977450.9978.18318761982949903126.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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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;