From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH 1/2] tpm2: add session handle context saving and restoring to the space code Date: Fri, 27 Jan 2017 08:45:48 +0200 Message-ID: <20170127064548.qakqjphmuhphtima@intel.com> References: <1485236113.2534.69.camel@HansenPartnership.com> <1485236231.2534.71.camel@HansenPartnership.com> <20170126125151.32sky3tajp6zigpd@intel.com> <1485443929.2457.5.camel@HansenPartnership.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1485443929.2457.5.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: James Bottomley 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 Thu, Jan 26, 2017 at 07:18:49AM -0800, James Bottomley wrote: > On Thu, 2017-01-26 at 14:51 +0200, Jarkko Sakkinen wrote: > > On Mon, Jan 23, 2017 at 09:37:11PM -0800, James Bottomley wrote: > > > sessions are different from transient objects in that their handles > > > may not be virtualized (because they're used for some hmac > > > calculations). Additionally when a session is context saved, a > > > vestigial memory remains in the TPM and if it is also flushed, that > > > will be lost and the session context will refuse to load next time, > > > so the code is updated to flush only transient objects after a > > > context save. Add a separate array (chip->session_tbl) to save and > > > restore sessions by handle. Use the failure of a context save or > > > load to signal that the session has been flushed from the TPM and > > > we can remove its memory from chip->session_tbl. > > > > > > Sessions are also isolated during each instance of a tpm space. > > > This means that spaces shouldn't be able to see each other's > > > sessions and is enforced by ensuring that a space user may only > > > refer to sessions handles that are present in their own chip > > > ->session_tbl. Finally when a space is closed, all the sessions > > > belonging to it should be flushed so the handles may be re-used by > > > other spaces. > > > > > > Signed-off-by: James Bottomley < > > > James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> > > > > I'm wondering if you ever need more than two sessions at once? If we > > would limit the number of sessions to that you could probably > > simplify a lot. > > Three seems to be the agreed maximum: hmac authority, parameter > encryption and command audit. > > I'll fix up the rest > > James Right. I've also set the limit for trasient objects to three. /Jarkko ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754203AbdA0GqJ (ORCPT ); Fri, 27 Jan 2017 01:46:09 -0500 Received: from mga07.intel.com ([134.134.136.100]:50262 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754008AbdA0GqE (ORCPT ); Fri, 27 Jan 2017 01:46:04 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,293,1477983600"; d="scan'208";a="57802771" Date: Fri, 27 Jan 2017 08:45:48 +0200 From: Jarkko Sakkinen To: James Bottomley Cc: tpmdd-devel@lists.sourceforge.net, open list , linux-security-module@vger.kernel.org Subject: Re: [PATCH 1/2] tpm2: add session handle context saving and restoring to the space code Message-ID: <20170127064548.qakqjphmuhphtima@intel.com> References: <1485236113.2534.69.camel@HansenPartnership.com> <1485236231.2534.71.camel@HansenPartnership.com> <20170126125151.32sky3tajp6zigpd@intel.com> <1485443929.2457.5.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1485443929.2457.5.camel@HansenPartnership.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 Thu, Jan 26, 2017 at 07:18:49AM -0800, James Bottomley wrote: > On Thu, 2017-01-26 at 14:51 +0200, Jarkko Sakkinen wrote: > > On Mon, Jan 23, 2017 at 09:37:11PM -0800, James Bottomley wrote: > > > sessions are different from transient objects in that their handles > > > may not be virtualized (because they're used for some hmac > > > calculations). Additionally when a session is context saved, a > > > vestigial memory remains in the TPM and if it is also flushed, that > > > will be lost and the session context will refuse to load next time, > > > so the code is updated to flush only transient objects after a > > > context save. Add a separate array (chip->session_tbl) to save and > > > restore sessions by handle. Use the failure of a context save or > > > load to signal that the session has been flushed from the TPM and > > > we can remove its memory from chip->session_tbl. > > > > > > Sessions are also isolated during each instance of a tpm space. > > > This means that spaces shouldn't be able to see each other's > > > sessions and is enforced by ensuring that a space user may only > > > refer to sessions handles that are present in their own chip > > > ->session_tbl. Finally when a space is closed, all the sessions > > > belonging to it should be flushed so the handles may be re-used by > > > other spaces. > > > > > > Signed-off-by: James Bottomley < > > > James.Bottomley@HansenPartnership.com> > > > > I'm wondering if you ever need more than two sessions at once? If we > > would limit the number of sessions to that you could probably > > simplify a lot. > > Three seems to be the agreed maximum: hmac authority, parameter > encryption and command audit. > > I'll fix up the rest > > James Right. I've also set the limit for trasient objects to three. /Jarkko