Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5307493imu; Sun, 20 Jan 2019 08:03:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Q/FkJhEXDrAJV9ZSvBlqKg7aM72js/Wmqul6gVcBIWd2YxuDcCH+hcMlEFFjHDN7C/b5j X-Received: by 2002:a62:13c3:: with SMTP id 64mr26703838pft.93.1548000213595; Sun, 20 Jan 2019 08:03:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548000213; cv=none; d=google.com; s=arc-20160816; b=x96DpKA5iiWe1zMsHins4k0/H9Xs6/9yfpqYfSQZC7/7fydlSYCZojN98txgVfvxlF +RuRiTVZmfdpWgIvWw/vhke9ZXDDC7FDXlQIq1z4HZkBIKPS3QJZoIz6/58LjjmkQm0i ki4kKdDdei7HJG9j0IjeLJIYppRuYZ1AyWwwv8H+yM8mwfj0ozTDxWhAmKMF9WZOcbb1 eUSj3IKpv2OLu5ewDZodqbVrNsWi3cgXpMhQpe5mYLKrTkuLVBPrvIirN8Bp2wdHQkjg lSB27OcjtZjBbF+5B5E0oc7BNW8ePoxA56OmbFy5HCt0xX5BV1/IxgFym28KdHwimEhX 1+mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pvowMkERYwSMyfvfbMko4nmH27qeJRjP9uTsW2+Sp5k=; b=QzorPq5jVfo2pBuIs+Wh6zUkbPW22hV+azbps6wQBoDZpHLbq4tGenH5e7H1EZKjPO sPIXH80YyByk/BtRG0/6Zzq7m/boqdkRi8mQ61kswfg6bg8F6t9EbfpQ0IDZpmX41ljX 7ZWsND5sFapJ5ALefe3zqzIDI4y0+ow4/4qjgBXkANP2nnRH0jgcNLR7LAPOeLKKVGXM kykUfhDKlicp6fXPRlWs+ZhDR5XbvBHPmZy1eSVNbJ7VZGP5Y8SoPlJqVOQipVn66WI6 sp44WYagbk7CC9eH2Oh1qpfPe3Lp+OXhGQgkPWXcvpiny3M/+HRTGfxC4os46Ym2xD70 skaw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 88si10295797plb.288.2019.01.20.08.03.17; Sun, 20 Jan 2019 08:03:33 -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; 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 S1726524AbfATQCP (ORCPT + 99 others); Sun, 20 Jan 2019 11:02:15 -0500 Received: from mga17.intel.com ([192.55.52.151]:18727 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725908AbfATQCP (ORCPT ); Sun, 20 Jan 2019 11:02:15 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2019 08:02:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,499,1539673200"; d="scan'208";a="137292600" Received: from smartikx-mobl2.ger.corp.intel.com (HELO localhost) ([10.249.254.134]) by fmsmga004.fm.intel.com with ESMTP; 20 Jan 2019 08:02:06 -0800 Date: Sun, 20 Jan 2019 18:02:04 +0200 From: Jarkko Sakkinen To: James Bottomley Cc: Andy Lutomirski , Stephan Mueller , Herbert Xu , "Lee, Chun-Yi" , "Rafael J . Wysocki" , Pavel Machek , LKML , linux-pm@vger.kernel.org, keyrings@vger.kernel.org, "Rafael J. Wysocki" , Chen Yu , Oliver Neukum , Ryan Chen , David Howells , Giovanni Gherdovich , Randy Dunlap , Jann Horn Subject: Re: [PATCH 1/5 v2] PM / hibernate: Create snapshot keys handler Message-ID: <20190120160204.GA30478@linux.intel.com> References: <4499700.LRS4F2YjjC@tauon.chronox.de> <20190108050358.llsox32hggn2jioe@gondor.apana.org.au> <1565399.7ulKdI1fm5@tauon.chronox.de> <1546994671.6077.10.camel@HansenPartnership.com> <20190111140226.GA6448@linux.intel.com> <1547220538.2793.6.camel@HansenPartnership.com> <20190118143348.GB4080@linux.intel.com> <1547845146.2794.69.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547845146.2794.69.camel@HansenPartnership.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 18, 2019 at 12:59:06PM -0800, James Bottomley wrote: > On Fri, 2019-01-18 at 16:33 +0200, Jarkko Sakkinen wrote: > > On Fri, Jan 11, 2019 at 07:28:58AM -0800, James Bottomley wrote: > > > On Fri, 2019-01-11 at 16:02 +0200, Jarkko Sakkinen wrote: > > > > On Tue, Jan 08, 2019 at 05:43:53PM -0800, Andy Lutomirski wrote: > > > > > (Also, do we have a sensible story of how the TPM interacts > > > > > with hibernation at all? Presumably we should at least try to > > > > > replay the PCR operations that have occurred so that we can > > > > > massage the PCRs into the same state post-hibernation. Also, > > > > > do we have any way for the kernel to sign something with the > > > > > TPM along with an attestation that the signature was requested > > > > > *by the kernel*? Something like a sub-hierarchy of keys that > > > > > the kernel explicitly prevents userspace from accessing?) > > > > > > > > Kernel can keep it is own key hierarchy in memory as TPM2 chips > > > > allow to offload data in encrypted form and load it to TPM when > > > > it needs to use it. > > > > > > > > The in-kernel resource manager that I initiated couple years ago > > > > provides this type of functionality. > > > > > > Actually, the resource manager only keeps volatile objects > > > separated when in use not when offloaded. The problem here is that > > > the object needs to be persisted across reboots, so either it gets > > > written to the NV area, bypassing the resource manager and making > > > it globally visible or it has to get stored in TPM form in the > > > hibernation image, meaning anyone with access to the TPM who can > > > read the image can extract and load it. Further: anyone with access > > > to the TPM can create a bogus sealed key and encrypt a malicious > > > hibernation image with it. So there are two additional problems > > > > > > 1. Given that the attacker may have access to the binary form of > > > the > > > key, can we make sure only the kernel can get it released? > > > 2. How do we prevent an attacker with access to the TPM from > > > creating a > > > bogus sealed key? > > > > > > This is why I was thinking localities. > > > > Why you would want to go for localities and not seal to PCRs? > > Because the requested functionality was a key that would be accessible > to the kernel and not to user space and also guaranteed created by the > kernel. The only discriminator we have to enforce that is the locality > (assuming we reserve a locality as accessible to the kernel but > inaccessible to userspace). PCRs alone can't restrict where the key is > accessed or created from. OK, locality would probably make sense, assuming that the key is stored in nvram. /Jarkko /Jarkko