Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752462AbdFTJ5Q (ORCPT ); Tue, 20 Jun 2017 05:57:16 -0400 Received: from gate.crashing.org ([63.228.1.57]:55557 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbdFTJ5O (ORCPT ); Tue, 20 Jun 2017 05:57:14 -0400 Message-ID: <1497952580.31581.51.camel@kernel.crashing.org> Subject: Re: [RFC v2 00/12] powerpc: Memory Protection Keys From: Benjamin Herrenschmidt To: Balbir Singh , Ram Pai , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: paulus@samba.org, mpe@ellerman.id.au, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, dave.hansen@intel.com, hbabu@us.ibm.com Date: Tue, 20 Jun 2017 19:56:20 +1000 In-Reply-To: <1497935415.2255.1.camel@gmail.com> References: <1497671564-20030-1-git-send-email-linuxram@us.ibm.com> <1497935415.2255.1.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-2.fc25) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1551 Lines: 46 On Tue, 2017-06-20 at 15:10 +1000, Balbir Singh wrote: > On Fri, 2017-06-16 at 20:52 -0700, Ram Pai wrote: > > Memory protection keys enable applications to protect its > > address space from inadvertent access or corruption from > > itself. > > I presume by itself you mean protection between threads? Not necessarily. You could have for example a JIT that when it runs the JITed code, only "opens" the keys for the VM itself, preventing the JITed code from "leaking out" There are plenty of other usages... > > > The overall idea: > > > > A process allocates a key and associates it with > > a address range within its address space. > > OK, so this is per VMA? > > > The process than can dynamically set read/write > > permissions on the key without involving the > > kernel. > > This bit is not clear, how can the key be set without > involving the kernel? I presume you mean the key is set > in the PTE's and the access protection values can be > set without involving the kernel? > > Any code that violates the permissions > > off the address space; as defined by its associated > > key, will receive a segmentation fault. > > > > This patch series enables the feature on PPC64. > > It is enabled on HPTE 64K-page platform. > > > > ISA3.0 section 5.7.13 describes the detailed specifications. > > > > > > Testing: > > This patch series has passed all the protection key > > tests available in the selftests directory. > > The tests are updated to work on both x86 and powerpc. > > Balbir