Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1336784
| From | Kees Cook <keescook@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 33/33] x86, pkeys: execute-only support |
| Date | 2016-02-17 22:30 +0100 |
| Message-ID | <r3hPA-3LD-27@gated-at.bofh.it> (permalink) |
| References | <r1t8t-3TO-3@gated-at.bofh.it> <r1t8v-3TO-39@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Feb 12, 2016 at 1:02 PM, Dave Hansen <dave@sr71.net> wrote: > > From: Dave Hansen <dave.hansen@linux.intel.com> > > Protection keys provide new page-based protection in hardware. > But, they have an interesting attribute: they only affect data > accesses and never affect instruction fetches. That means that > if we set up some memory which is set as "access-disabled" via > protection keys, we can still execute from it. > > This patch uses protection keys to set up mappings to do just that. > If a user calls: > > mmap(..., PROT_EXEC); > or > mprotect(ptr, sz, PROT_EXEC); > > (note PROT_EXEC-only without PROT_READ/WRITE), the kernel will > notice this, and set a special protection key on the memory. It > also sets the appropriate bits in the Protection Keys User Rights > (PKRU) register so that the memory becomes unreadable and > unwritable. > > I haven't found any userspace that does this today. With this > facility in place, we expect userspace to move to use it > eventually. Userspace _could_ start doing this today. Any > PROT_EXEC calls get converted to PROT_READ inside the kernel, and > would transparently be upgraded to "true" PROT_EXEC with this > code. IOW, userspace never has to do any PROT_EXEC runtime > detection. Random thought while skimming email: Is there a way to detect this feature's availability without userspace having to set up a segv handler and attempting to read a PROT_EXEC-only region? (i.e. cpu flag for protection keys, or a way to check the protection to see if PROT_READ got added automatically, etc?) -Kees -- Kees Cook Chrome OS & Brillo Security
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 33/33] x86, pkeys: execute-only support Dave Hansen <dave@sr71.net> - 2016-02-12 22:10 +0100
Re: [PATCH 33/33] x86, pkeys: execute-only support Kees Cook <keescook@google.com> - 2016-02-17 22:30 +0100
Re: [PATCH 33/33] x86, pkeys: execute-only support Dave Hansen <dave@sr71.net> - 2016-02-17 22:40 +0100
Re: [PATCH 33/33] x86, pkeys: execute-only support Kees Cook <keescook@google.com> - 2016-02-17 22:40 +0100
Re: [PATCH 33/33] x86, pkeys: execute-only support Andy Lutomirski <luto@amacapital.net> - 2016-02-17 23:20 +0100
Re: [PATCH 33/33] x86, pkeys: execute-only support Dave Hansen <dave@sr71.net> - 2016-02-18 00:00 +0100
Re: [PATCH 33/33] x86, pkeys: execute-only support Andy Lutomirski <luto@amacapital.net> - 2016-02-18 01:50 +0100
[tip:mm/pkeys] mm/core, x86/mm/pkeys: Add execute-only protection keys support tip-bot for Dave Hansen <tipbot@zytor.com> - 2016-02-18 21:30 +0100
csiph-web