From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH v17 18/23] platform/x86: Intel SGX driver Date: Mon, 17 Dec 2018 20:23:19 +0200 Message-ID: <20181217182319.GA13288@linux.intel.com> References: <20181210104908.GA23132@wind.enjellic.com> <20181212180036.GC6333@linux.intel.com> <20181214235917.GA14049@wind.enjellic.com> <20181215000627.GA5799@linux.intel.com> <20181217132859.GA31936@linux.intel.com> <20181217133928.GA32706@linux.intel.com> <20181217140811.GA4601@linux.intel.com> <20181217173106.GB12491@linux.intel.com> <20181217174935.GA12617@linux.intel.com> <20181217180957.GC12491@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20181217180957.GC12491@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Sean Christopherson Cc: "Dr. Greg" , Andy Lutomirski , Andy Lutomirski , X86 ML , Platform Driver , linux-sgx@vger.kernel.org, Dave Hansen , nhorman@redhat.com, npmccallum@redhat.com, "Ayoun, Serge" , shay.katz-zamir@intel.com, haitao.huang@linux.intel.com, Andy Shevchenko , Thomas Gleixner , "Svahn, Kai" , mark.shanahan@intel.com, Suresh Siddha , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Darren Hart , Andy Shevchenko LKML List-Id: platform-driver-x86.vger.kernel.org On Mon, Dec 17, 2018 at 10:09:57AM -0800, Sean Christopherson wrote: > No, EREMOVE should never fail if the enclave is being released, i.e. all > references to the enclave are gone. And failure during sgx_encl_release() > means we leaked an EPC page, which warrants a WARN. Right that what I was suspecting as swapper should hold a ref to the enclave while it is working on it. It is a programming error when this happens. Maybe change the boolean parameter to flags parameter have a flag to use sgx_free_page()? > That makes sense. What do you think of Dave's proposal? /Jarkko