From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754681AbbJGUrN (ORCPT ); Wed, 7 Oct 2015 16:47:13 -0400 Received: from www.sr71.net ([198.145.64.142]:40354 "EHLO blackbird.sr71.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754493AbbJGUrL (ORCPT ); Wed, 7 Oct 2015 16:47:11 -0400 Subject: Re: [PATCH 26/26] x86, pkeys: Documentation To: Andy Lutomirski References: <20150916174903.E112E464@viggo.jf.intel.com> <20150916174913.AF5FEA6D@viggo.jf.intel.com> <20150920085554.GA21906@gmail.com> <55FF88BA.6080006@sr71.net> <20150924094956.GA30349@gmail.com> <20151003081710.GA26206@gmail.com> <56157F60.1000503@sr71.net> Cc: Ingo Molnar , X86 ML , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Linus Torvalds , Andrew Morton , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Kees Cook , Brian Gerst From: Dave Hansen Message-ID: <561584CE.1010504@sr71.net> Date: Wed, 7 Oct 2015 13:47:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/07/2015 01:39 PM, Andy Lutomirski wrote: > On Wed, Oct 7, 2015 at 1:24 PM, Dave Hansen wrote: >> On 10/03/2015 01:17 AM, Ingo Molnar wrote: >>> Right now the native x86 PTE format allows two protection related bits for >>> user-space pages: >>> >>> _PAGE_BIT_RW: if 0 the page is read-only, if 1 then it's read-write >>> _PAGE_BIT_NX: if 0 the page is executable, if 1 then it's not executable >>> >>> As discussed previously, pkeys allows 'true execute only (--x)' mappings. >>> >>> Another possibility would be 'true write-only (-w-)' mappings. >> >> How would those work? >> >> Protection Keys has a Write-Disable and an Access-Disable bit. But, >> Access-Disable denies _all_ data access to the region. There's no way >> to allow only writes. > > Weird. I wonder why Intel did that. > > I also wonder whether EPT can do write-only. The SDM makes it look that way. There appear to be completely separate r/w/x bits. r=0/w=0/x=0 means !present. The bit 0 definition says, for instance: Read access; indicates whether reads are allowed from the 4-KByte page referenced by this entry