* Ram Pai: > So the problem is as follows: > > Currently the kernel supports 'disable-write' and 'disable-access'. > > On x86, cpu supports 'disable-write' and 'disable-access'. This > matches with what the kernel supports. All good. > > However on power, cpu supports 'disable-read' too. Since userspace can > program the cpu directly, userspace has the ability to set > 'disable-read' too. This can lead to inconsistency between the kernel > and the userspace. > > We want the kernel to match userspace on all architectures.
Correct. > Proposed Solution: > > Enhance the kernel to understand 'disable-read', and facilitate architectures > that understand 'disable-read' to allow it. > > Also explicitly define the semantics of disable-access as > 'disable-read and disable-write' > > Did I get this right? Assuming I did, the implementation has to do > the following -- > > On power, sys_pkey_alloc() should succeed if the init_val > is PKEY_DISABLE_READ, PKEY_DISABLE_WRITE, PKEY_DISABLE_ACCESS > or any combination of the three. Agreed. > On x86, sys_pkey_alloc() should succeed if the init_val is > PKEY_DISABLE_WRITE or PKEY_DISABLE_ACCESS or PKEY_DISABLE_READ > or any combination of the three, except PKEY_DISABLE_READ > specified all by itself. Again agreed. That's a clever way of phrasing it actually. > On all other arches, none of the flags are supported. > > > Are we on the same plate? I think so, thanks. Florian