Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp121444imu; Tue, 8 Jan 2019 15:59:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN79Lmixbuiz2bvHFNXIDQ5QoN3AvncUDCc5glnf5RBLKyJo5HC1lGpRneOO3lDDhOl2gzVc X-Received: by 2002:a65:514c:: with SMTP id g12mr3351176pgq.169.1546991959416; Tue, 08 Jan 2019 15:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546991959; cv=none; d=google.com; s=arc-20160816; b=i5GLRnOEXs5qQpFrhTEDTnRJTHaU0PyfsrrOzD0bk8ZQqkamZT96+/qOYTnW6pde+j JdcPAsd+fjQdzJHD8Nm0t8hGibFRAJcHr35MsJR6GQtSFGDZz8rEFrR7xcirv1Xi7tGi IJ8vpRaSWxidRko0whrHpUfP6NW6ab/AF0krGMRclPdO2NcHfxNF0UjQEJlhZF2Zvtd3 QAelLVT+0sLjFRmzad6ERHTWnIEggMj8Y0/Z3JyP+l5X+vFI02ObhfOh5EcZwypIYNfO yXp+TtPy/4pVbWlpFbdYpQfMFUyRCe8mTkQMyXxKmXZKACku6xTPFLTh/8YqCSw1qQyq CkjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eQ8wV+4IDEJTDJS1wbkPLavzlqW9+FSdjt05sq6wnGU=; b=zS0OsTDlSusZqvcbapP18/ecMFvwv6vJB2dBlV++jvcjVD7Lv9T3jpxK4bXDQTiuK4 19rbLo5NUClL00+01kz1XEQHTg5hhoFGsAcA5TPa1AP57T3XYxIfYjE2tp8ygKI+M5zb SrNITjpPgd83qKFUfkpJPMvW+mFKKt7mPLobX8nejV64rURrvm23YiMuGtymLwFMRo/Z YKzbplHYjqGSOQpvbUTP7o96AuScu4g70lINCbAMclJVrH0iNLsprKDdCIfzft08X447 CHDGtz1q1pS0wnZhnRRaH6/mhRp6oqG1H9Xyvk0MzH/gEEHIpmw+Rw3gj/YnR8VzkBDh sZew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=FyToSk8I; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o192si26310107pgo.129.2019.01.08.15.59.04; Tue, 08 Jan 2019 15:59:19 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=FyToSk8I; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729371AbfAHXyC (ORCPT + 99 others); Tue, 8 Jan 2019 18:54:02 -0500 Received: from mail-oi1-f180.google.com ([209.85.167.180]:36911 "EHLO mail-oi1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727829AbfAHXyC (ORCPT ); Tue, 8 Jan 2019 18:54:02 -0500 Received: by mail-oi1-f180.google.com with SMTP id y23so4880335oia.4 for ; Tue, 08 Jan 2019 15:54:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eQ8wV+4IDEJTDJS1wbkPLavzlqW9+FSdjt05sq6wnGU=; b=FyToSk8IUSU4wKUSoSn2OnvML9ZdU7h2zgBQyIBtdcMNJ+7wm++n1H6daLwwa59Nvw pzxHmjjZE8F+fbF3guHDSeBG4Bhks+Y/BchB3aPvW4DztMPyQxJArJidhbsBOalBM6ut TQ0O7caDRt7FPTK5KQ4ujqG9JljpJ0pUPYfb/EfoM1rgzt2zZvu+MqLi02cVBqfnRyga NscF0AsdJOahCE6IbB/uJZZd8r93O2c0v8953C762bIMeNJ3jRyrA7uN5KT44SYcivM5 8yDOF7xZJZl82nhkWIBKN6JQkV18oZAH9E6MZXJH5hQouS8/HCWTGf3p3yczrG4grA/R SjVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eQ8wV+4IDEJTDJS1wbkPLavzlqW9+FSdjt05sq6wnGU=; b=pX0e3lWeXo+1eww8Gffp1JYu1KbOgWOL1HWaIwGYdLguWD4g48jKL9au8BoTx8xLKA dfOFCHX5PNWbHNB21It4irt4M5MbRT76hvNKpkei6FRZHYWOQQOyuepFDP5/ZGlNUeYz kDZJLuvcOf30V2rbiaJCp2BsKfL48DLKhjR+EaXD9HQLor8V9ksJCJzLa/8e+BmWSDqm fCCgKmPy1Iakq6aHRKXVklsZ5cjU5if5BON8ZqRRxNUzo3GK+yDC1iycr/4t3lmC9DuD KviD9aHxqU2IHMN+3tk9xTumjVWPu3z4K3r8Yvmj60NU+7HokZxFiL/L2X82NBKbYzKQ /h0w== X-Gm-Message-State: AJcUukev0cXo05lRYzZ56x73wb3HRLJCBnxE96mSsq+wnllicPFHw2l1 0PPpm6pmnDAbaGWUc1bdCc8MF5CmDBj5umnCqOi/4w== X-Received: by 2002:aca:2dc8:: with SMTP id t191mr2350231oit.235.1546991641417; Tue, 08 Jan 2019 15:54:01 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dan Williams Date: Tue, 8 Jan 2019 15:53:50 -0800 Message-ID: Subject: Re: nvdimm crash at boot To: Kees Cook Cc: Dave Jiang , linux-nvdimm , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 8, 2019 at 3:34 PM Kees Cook wrote: > > On Tue, Jan 8, 2019 at 3:28 PM Dan Williams wrote: > > Ah, thanks for the report! The key difference is that you don't define > > a "label area", so the driver bails out early and never initializes > > the security state. > > > > This should fix it up. > > > > diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c > > index 4890310df874..636cdb06ee17 100644 > > --- a/drivers/nvdimm/dimm_devs.c > > +++ b/drivers/nvdimm/dimm_devs.c > > @@ -514,7 +514,7 @@ static umode_t nvdimm_visible(struct kobject > > *kobj, struct attribute *a, int n) > > > > if (a != &dev_attr_security.attr) > > return a->mode; > > - if (nvdimm->sec.state < 0) > > + if (!nvdimm->sec.ops || nvdimm->sec.state < 0) > > return 0; > > /* Are there any state mutation ops? */ > > if (nvdimm->sec.ops->freeze || nvdimm->sec.ops->disable > > Okay, cool. I wasn't sure if that test needed a deeper check. :) > > Fixes: 37833fb7989a9 ("acpi/nfit, libnvdimm: Add freeze security > support to Intel nvdimm") > Tested-by: Kees Cook > Actually, looking closer this should have been avoided by the fact that __nvdimm_create() initializes the security state early and that nvdimm->sec.state should have saved us. I'll dig a bit deeper with your qemu config.