Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-09 Thread Dr. David Alan Gilbert
* Vlastimil Babka (vba...@suse.cz) wrote: > On 05/07/2015 08:09 PM, Dave Hansen wrote: > >On 05/07/2015 10:57 AM, Ingo Molnar wrote: > There are two new instructions (RDPKRU/WRPKRU) for reading and > writing to the new register. The feature is only available in > 64-bit mode, even thou

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Kevin Easton
On Thu, May 07, 2015 at 08:18:43PM +0100, One Thousand Gnomes wrote: > > We could keep heap metadata as R/O and only make it R/W inside of > > malloc() itself to catch corruption more quickly. > > If you implement multiple malloc pools you can chop up lots of stuff. > > In library land it isn't j

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Ingo Molnar
* One Thousand Gnomes wrote: > On Thu, 7 May 2015 21:26:20 +0200 > Ingo Molnar wrote: > > > > > * One Thousand Gnomes wrote: > > > > > > We could keep heap metadata as R/O and only make it R/W inside of > > > > malloc() itself to catch corruption more quickly. > > > > > > If you implement

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Dave Hansen
On 05/07/2015 11:48 AM, Vlastimil Babka wrote: > On 05/07/2015 08:09 PM, Dave Hansen wrote: >> On 05/07/2015 10:57 AM, Ingo Molnar wrote: > There are two new instructions (RDPKRU/WRPKRU) for reading and > writing to the new register. The feature is only available in > 64-bit mode, even

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread One Thousand Gnomes
On Thu, 7 May 2015 21:26:20 +0200 Ingo Molnar wrote: > > * One Thousand Gnomes wrote: > > > > We could keep heap metadata as R/O and only make it R/W inside of > > > malloc() itself to catch corruption more quickly. > > > > If you implement multiple malloc pools you can chop up lots of > >

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Christian Borntraeger
Am 07.05.2015 um 21:49 schrieb Dave Hansen: > On 05/07/2015 12:45 PM, Christian Borntraeger wrote: >> This all looks like s390 storage keys (with the key in pagetables instead >> of a dedicated place). There we also have 16 values for the key and 4 >> bits >> in the PSW that descr

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Dave Hansen
On 05/07/2015 12:45 PM, Christian Borntraeger wrote: >>> >> This all looks like s390 storage keys (with the key in pagetables instead >>> >> of a dedicated place). There we also have 16 values for the key and 4 >>> >> bits >>> >> in the PSW that describe the thread local key both are matched. >>>

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Christian Borntraeger
Am 07.05.2015 um 21:29 schrieb Dave Hansen: > On 05/07/2015 12:22 PM, Christian Borntraeger wrote: >> Am 07.05.2015 um 20:09 schrieb Dave Hansen: >>> On 05/07/2015 10:57 AM, Ingo Molnar wrote: >> There are two new instructions (RDPKRU/WRPKRU) for reading and >> writing to the new register.

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Dave Hansen
On 05/07/2015 12:26 PM, Ingo Molnar wrote: > The Valgrind usecase looks somewhat legit, albeit not necessarily for > multithreaded apps: there you generally really want protection changes > to be globally visible, such as publishing the effects of free() or > malloc(). I guess we could theoreti

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Dave Hansen
On 05/07/2015 12:22 PM, Christian Borntraeger wrote: > Am 07.05.2015 um 20:09 schrieb Dave Hansen: >> On 05/07/2015 10:57 AM, Ingo Molnar wrote: > There are two new instructions (RDPKRU/WRPKRU) for reading and > writing to the new register. The feature is only available in > 64-bit m

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Ingo Molnar
* One Thousand Gnomes wrote: > > We could keep heap metadata as R/O and only make it R/W inside of > > malloc() itself to catch corruption more quickly. > > If you implement multiple malloc pools you can chop up lots of > stuff. I'd say that a 64-bit address space is large enough to hide buf

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Christian Borntraeger
Am 07.05.2015 um 20:09 schrieb Dave Hansen: > On 05/07/2015 10:57 AM, Ingo Molnar wrote: There are two new instructions (RDPKRU/WRPKRU) for reading and writing to the new register. The feature is only available in 64-bit mode, even though there is theoretically space in the PAE >

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread One Thousand Gnomes
> Data structures like logs or journals that are only written to in very > limited code paths, but that you want to protect from "stray" writes. Anything with lots of data where you want to minimise the risk of stray accesses even if just as a debug aid (consider things like memcached). > > Maybe

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Vlastimil Babka
On 05/07/2015 08:09 PM, Dave Hansen wrote: On 05/07/2015 10:57 AM, Ingo Molnar wrote: There are two new instructions (RDPKRU/WRPKRU) for reading and writing to the new register. The feature is only available in 64-bit mode, even though there is theoretically space in the PAE PTEs. These permis

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Dave Hansen
On 05/07/2015 10:57 AM, Ingo Molnar wrote: >> > There are two new instructions (RDPKRU/WRPKRU) for reading and >> > writing to the new register. The feature is only available in >> > 64-bit mode, even though there is theoretically space in the PAE >> > PTEs. These permissions are enforced on d

Re: [PATCH 00/12] [RFC] x86: Memory Protection Keys

2015-05-07 Thread Ingo Molnar
* Dave Hansen wrote: > == FEATURE OVERVIEW == > > Memory Protection Keys for Userspace (PKU aka PKEYs) is a CPU > feature which will be found in future Intel CPUs. The work here was > done with the aid of simulators. > > Memory Protection Keys provides a mechanism for enforcing page-based