Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp472495yba; Wed, 15 May 2019 04:44:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyO9D8JV7SzHabu8sO9k0I7k68Riomu+YoD+lw+FVOHlVvnrHSCPtV3e+QhBGZXaCIH5wT7 X-Received: by 2002:a17:902:a01:: with SMTP id 1mr42988382plo.36.1557920698922; Wed, 15 May 2019 04:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920698; cv=none; d=google.com; s=arc-20160816; b=ACN8ogDw+fDnQLgGkG2ynVwAhTkiDipR+vQYe8HFxwvxoFcErnHYq5CRTkyk9UtvZw UVdq0pg/baNg8RHhRHgrBfS7gPB4hXfxiJ9+mGVldrl4nHypLavF5DNwP7CmeuvkbfNS Om9IslPesOZYQxTnJVlunyezRT7tMteTA0gMqDLYQVsLmfMGsK2cfB6+S6PE/rtvJ+Dy VqeMY+8V0e25bgw2n9sqrJFXUUG1Srw+zA6Enq1hjyKUpF78q/8UNa75T6vUbMl4czdX wVuEGJBD01Hv8uMnoMS/DUyTpuLIRusiBaF1pTUzMm7VGeCeKxCVzOR5Hcl1ahl2r+p4 VYpA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dNQyD1EicKVi0fRDB3QHc0PVbJvWC8m0d9XjR6YrWkI=; b=RKzUNutYGlD2YVWzN/BYEMEx+UWsSO4/57wf1Nor4ks2MEKIYYyLodXquFbPfwaWGp R0Aw9AiXlJNgzvThya0gsPNKlePk/hoqcfE1sa84nxLW+GN9xlF2zU45e8rEMxZmW2aY TahOPyeoY38wtZ2xH17ppxWuV+YNOudpHfpL4O/ztD2hLLV5yrLF6jt6ENq2i7Ne80Sd 9m9382wmLKSeLaQgyedUYOKnSvaRuAPRrdAMplo3RYJ2rwRIQEZSI/yrkf+L6RwSj5Lv 9Ir06yK9c75I2QJwAny4e64c/3MTWKDyq9cBqxb1DK0N5ub600NnJtMgUw7kZGC2HTQH xRAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mouAywqL; 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 z7si1535976plo.274.2019.05.15.04.44.44; Wed, 15 May 2019 04:44:58 -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; dkim=pass header.i=@kernel.org header.s=default header.b=mouAywqL; 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 S1732187AbfEOLnm (ORCPT + 99 others); Wed, 15 May 2019 07:43:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:38120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731844AbfEOL1O (ORCPT ); Wed, 15 May 2019 07:27:14 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 166BD2166E; Wed, 15 May 2019 11:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919633; bh=O3jLAS35KOhBoNrBnIE+M3oZ7XyfA1uIaCLqapopw5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mouAywqLofbfxlTW6EtC+QSX8Yn8ZzwuV8KN8pEG1ykMqKVMQFxtKaU4SDSm+dtb9 HsIUKPClAUXLAIcGa7Bon5qzt/TmC2HFBRj8J82MKuWiuPnNBU9WWXgKQCnDsb8vaf IW7MQjWxq5cZ74QwQevQSUgSNX6As/YG7cQ8V8LI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Jiang , Dan Williams , Sasha Levin Subject: [PATCH 5.0 028/137] tools/testing/nvdimm: Retain security state after overwrite Date: Wed, 15 May 2019 12:55:09 +0200 Message-Id: <20190515090655.330894122@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 2170a0d53bee1a6c1a4ebd042f99d85aafc6c0ea ] Overwrite retains the security state after completion of operation. Fix nfit_test to reflect this so that the kernel can test the behavior it is more likely to see in practice. Fixes: 926f74802cb1 ("tools/testing/nvdimm: Add overwrite support for nfit_test") Signed-off-by: Dave Jiang Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- tools/testing/nvdimm/test/nfit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index cad719876ef45..85ffdcfa596b5 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c @@ -146,6 +146,7 @@ static int dimm_fail_cmd_code[ARRAY_SIZE(handle)]; struct nfit_test_sec { u8 state; u8 ext_state; + u8 old_state; u8 passphrase[32]; u8 master_passphrase[32]; u64 overwrite_end_time; @@ -1100,7 +1101,7 @@ static int nd_intel_test_cmd_overwrite(struct nfit_test *t, return 0; } - memset(sec->passphrase, 0, ND_INTEL_PASSPHRASE_SIZE); + sec->old_state = sec->state; sec->state = ND_INTEL_SEC_STATE_OVERWRITE; dev_dbg(dev, "overwrite progressing.\n"); sec->overwrite_end_time = get_jiffies_64() + 5 * HZ; @@ -1122,7 +1123,8 @@ static int nd_intel_test_cmd_query_overwrite(struct nfit_test *t, if (time_is_before_jiffies64(sec->overwrite_end_time)) { sec->overwrite_end_time = 0; - sec->state = 0; + sec->state = sec->old_state; + sec->old_state = 0; sec->ext_state = ND_INTEL_SEC_ESTATE_ENABLED; dev_dbg(dev, "overwrite is complete\n"); } else -- 2.20.1