[RFC v2 00/12] powerpc: Memory Protection Keys

Anshuman Khandual khandual at linux.vnet.ibm.com
Tue Jun 20 16:05:00 AEST 2017


On 06/20/2017 10:40 AM, 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?

Between threads due to race conditions or from the same thread
because of programming error.

> 
>>
>> 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?

Yeah but the same key can be given to multiple VMAs. Any
change will effect every VMA who got tagged by it.

> 
>>  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

With pkey_mprotect() system call, all the effected PTEs get
tagged for once. Switching the permission happens just by
writing into the register on the fly.

> in the PTE's and the access protection values can be
> set without involving the kernel?

PTE setting happens once, access protection values can be
changed on the fly through register.



More information about the Linuxppc-dev mailing list