From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935842AbdADMr4 (ORCPT ); Wed, 4 Jan 2017 07:47:56 -0500 Received: from mga04.intel.com ([192.55.52.120]:23661 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935393AbdADMqZ (ORCPT ); Wed, 4 Jan 2017 07:46:25 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,459,1477983600"; d="scan'208";a="49388714" Date: Wed, 4 Jan 2017 14:45:13 +0200 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: tpmdd-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, Peter Huewe , Marcel Selhorst , open list Subject: Re: [PATCH RFC 4/4] tpm: add the infrastructure for TPM space for TPM 2.0 Message-ID: <20170104124513.judaizma744gnqkf@intel.com> References: <20170102132213.22880-1-jarkko.sakkinen@linux.intel.com> <20170102132213.22880-5-jarkko.sakkinen@linux.intel.com> <20170102210953.GB5544@obsidianresearch.com> <20170103003730.he32vl55kkta2q64@intel.com> <20170103191634.GC26706@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170103191634.GC26706@obsidianresearch.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 03, 2017 at 12:16:34PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 03, 2017 at 02:37:30AM +0200, Jarkko Sakkinen wrote: > > On Mon, Jan 02, 2017 at 02:09:53PM -0700, Jason Gunthorpe wrote: > > > On Mon, Jan 02, 2017 at 03:22:10PM +0200, Jarkko Sakkinen wrote: > > > > Added a ioctl for creating a TPM space. The space is isolated from the > > > > other users of the TPM. Only a process holding the file with the handle > > > > can access the objects and only objects that are created through that > > > > file handle can be accessed. > > > > > > I don't understand this comment. /dev/tpmX is forced to be > > > single-process-open, so how can there ever be more than 1 FD for it? > > > > > > Since the space is tied to that single fd these patches just create a > > > way for the single user-space process to auto-cleanup if it crashes? > > > > > > Is that the entire intent of this design? I guess it is OK as a > > > stepping point.. > > > > is_open is cleared in tpm_ioc_new_space. > > There is also a bug with the uncondtional clear of is_open in > tpm_release - this cannot happen if the ioctl is done - but I think > this approach of using an ioctl is not a good idea. > > I have pondered using an open flag in the past - what about using > something like O_EXCL to indicate that the fd is to be used in > resource sharing mode? Not sure if that would be considered abuse of > the open flags or not. I've now leaned toward James' idea of having a separate /dev/tpms0. > Jason /Jarkko From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH RFC 4/4] tpm: add the infrastructure for TPM space for TPM 2.0 Date: Wed, 4 Jan 2017 14:45:13 +0200 Message-ID: <20170104124513.judaizma744gnqkf@intel.com> References: <20170102132213.22880-1-jarkko.sakkinen@linux.intel.com> <20170102132213.22880-5-jarkko.sakkinen@linux.intel.com> <20170102210953.GB5544@obsidianresearch.com> <20170103003730.he32vl55kkta2q64@intel.com> <20170103191634.GC26706@obsidianresearch.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20170103191634.GC26706-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Jason Gunthorpe Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, open list List-Id: tpmdd-devel@lists.sourceforge.net On Tue, Jan 03, 2017 at 12:16:34PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 03, 2017 at 02:37:30AM +0200, Jarkko Sakkinen wrote: > > On Mon, Jan 02, 2017 at 02:09:53PM -0700, Jason Gunthorpe wrote: > > > On Mon, Jan 02, 2017 at 03:22:10PM +0200, Jarkko Sakkinen wrote: > > > > Added a ioctl for creating a TPM space. The space is isolated from the > > > > other users of the TPM. Only a process holding the file with the handle > > > > can access the objects and only objects that are created through that > > > > file handle can be accessed. > > > > > > I don't understand this comment. /dev/tpmX is forced to be > > > single-process-open, so how can there ever be more than 1 FD for it? > > > > > > Since the space is tied to that single fd these patches just create a > > > way for the single user-space process to auto-cleanup if it crashes? > > > > > > Is that the entire intent of this design? I guess it is OK as a > > > stepping point.. > > > > is_open is cleared in tpm_ioc_new_space. > > There is also a bug with the uncondtional clear of is_open in > tpm_release - this cannot happen if the ioctl is done - but I think > this approach of using an ioctl is not a good idea. > > I have pondered using an open flag in the past - what about using > something like O_EXCL to indicate that the fd is to be used in > resource sharing mode? Not sure if that would be considered abuse of > the open flags or not. I've now leaned toward James' idea of having a separate /dev/tpms0. > Jason /Jarkko ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot