Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4319662ybp; Mon, 7 Oct 2019 06:48:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMHXkyTQSLX6f8awU+vE30IAYS20Icgejk4VARQ2l8mTtwpI0O1O6iLkGQZZJWqPt8VECg X-Received: by 2002:a50:918d:: with SMTP id g13mr28983273eda.64.1570456081579; Mon, 07 Oct 2019 06:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570456081; cv=none; d=google.com; s=arc-20160816; b=yxvbsFs1LlKg3UF5MQ6g25GQ2/227wtoCxk8SwGRtSo29ugdpz7Tut6d4FEmFEfOqR TreD2CdKQZsUkPFoc9tkFHmN1hFVMDgQpZGZMaverGLXXWVzPuYFWKToK7y6lFN5NMKW jbKkrU3hlDzTKBU2ulCc6d2dYRsB0cAg8eRyJSjncgGS1KKtaGq0GBSwRmmp6YE1RuwM O4SBnhNP27MsXhZRJKQdNAQJPKjjIRIocgYKvRTXZJAFuiHqWBj5pbUgRbgTWywMfG8V T/8Arna0TiioGfGCoD2YSGMiOywXxGQv6Vhq14EhyaqwZTdeBFj6adFDQpDFADJC2c1Z rMzw== 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:mime-version :message-id:date:subject:cc:to:from; bh=LEXhQi06LGCXidgEvEIhToNzpiYOuXHRhaeyF7aClbc=; b=ceRVM+EgH/cHHp8XqMn3Jrof4p7TZ2oMgePgjDBlq2jKiOTCMKTm+kcHw4Rcqh9uyf I9PnZt2qoSeieyqVbo3A7/E1Df8TsBCrbgDa7F3712AoGn8wfmEZ3Z2eY3cZRAAggp66 DrVjd8FSLtDoD+eKwyr30OpkddOYbD9yOSJiVOaeBBrZHju/lAjzc3OkpdwpU7S8nmfL ON7rK0mbVataL5xTjG7fuZRilWCtrfGLxjmALpvE/J8xW0cptfnrY1MPc9oFt+IwWf3m 1Zdf3WKTYWwD4sgvlPKAVfAy8ss52018XNOtHYz6krWkJqfLubLieqsFvlpK1Y3la+FH ZHlg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f57si8387861edb.165.2019.10.07.06.47.38; Mon, 07 Oct 2019 06:48:01 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbfJGNr2 (ORCPT + 99 others); Mon, 7 Oct 2019 09:47:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44574 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbfJGNr2 (ORCPT ); Mon, 7 Oct 2019 09:47:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAF594FCDA; Mon, 7 Oct 2019 13:47:27 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-197.ams2.redhat.com [10.36.116.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id B71AF66A06; Mon, 7 Oct 2019 13:47:25 +0000 (UTC) From: Hans de Goede To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" Cc: Hans de Goede , Herbert Xu , Ard Biesheuvel , linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Arvind Sankar Subject: [PATCH v2 5.4 regression fix] x86/boot: Provide memzero_explicit Date: Mon, 7 Oct 2019 15:47:24 +0200 Message-Id: <20191007134724.4019-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 07 Oct 2019 13:47:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The purgatory code now uses the shared lib/crypto/sha256.c sha256 implementation. This needs memzero_explicit, implement this. Reported-by: Arvind Sankar Fixes: 906a4bb97f5d ("crypto: sha256 - Use get/put_unaligned_be32 to get input, memzero_explicit") Signed-off-by: Hans de Goede --- Changes in v2: - Add barrier_data() call after the memset, making the function really explicit. Using barrier_data() works fine in the purgatory (build) environment. --- arch/x86/boot/compressed/string.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/boot/compressed/string.c b/arch/x86/boot/compressed/string.c index 81fc1eaa3229..654a7164a702 100644 --- a/arch/x86/boot/compressed/string.c +++ b/arch/x86/boot/compressed/string.c @@ -50,6 +50,12 @@ void *memset(void *s, int c, size_t n) return s; } +void memzero_explicit(void *s, size_t count) +{ + memset(s, 0, count); + barrier_data(s); +} + void *memmove(void *dest, const void *src, size_t n) { unsigned char *d = dest; -- 2.23.0