From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752361AbdLNNKO (ORCPT ); Thu, 14 Dec 2017 08:10:14 -0500 Received: from mga03.intel.com ([134.134.136.65]:58653 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbdLNNKL (ORCPT ); Thu, 14 Dec 2017 08:10:11 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,400,1508828400"; d="scan'208";a="2355672" Date: Thu, 14 Dec 2017 15:10:06 +0200 From: Jarkko Sakkinen To: Sean Christopherson Cc: "intel-sgx-kernel-dev@lists.01.org" , "platform-driver-x86@vger.kernel.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Ingo Molnar , "H. Peter Anvin" , Darren Hart , Thomas Gleixner , Andy Shevchenko Subject: Re: [intel-sgx-kernel-dev] [PATCH v7 4/8] intel_sgx: driver for Intel Software Guard Extensions Message-ID: <20171214131006.moogpmrugtx43qju@linux.intel.com> References: <20171207015614.7914-1-jarkko.sakkinen@linux.intel.com> <20171207015614.7914-5-jarkko.sakkinen@linux.intel.com> <37306EFA9975BE469F115FDE982C075BC6B39193@ORSMSX108.amr.corp.intel.com> <20171207160548.doovfdh2lqg5brm3@linux.intel.com> <37306EFA9975BE469F115FDE982C075BC6B39E1D@ORSMSX108.amr.corp.intel.com> <1513115208.27842.18.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1513115208.27842.18.camel@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 12, 2017 at 01:46:48PM -0800, Sean Christopherson wrote: > So it looks like you avoid the described case by moving B to the head of > the list in sgx_eldu.  The bug I am seeing is still straightforward to > theorize: > >     1. Three VA pages.  List = A->B->C >     2. Fill A and B, use one entry in C.  List = C->B->A >     3. ELDU, freeing a slot in B.  List = B->C->A >     4. EWB, consuming the last slot in B.  List = B->C->A >     5. ELDU, freeing a slot in A.  List = A->B->C >     6. EWB, consuming the last slot in A.  List = A->B->C >     7. ELDU, but both A and B are full >     8. Explode I see. It is easy to fix by moving back to of the list immediately after last allocation. Thanks for pointing this out. /Jarkko