Messages in this thread Patch in this message | | | Subject | [PATCH 10/12] x86, pkeys: differentiate Protection Key faults from normal | From | Dave Hansen <> | Date | Thu, 07 May 2015 10:41:36 -0700 |
| |
---
b/arch/x86/mm/fault.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff -puN arch/x86/mm/fault.c~pkeys-12-fault-differentiation arch/x86/mm/fault.c --- a/arch/x86/mm/fault.c~pkeys-12-fault-differentiation 2015-05-07 10:31:44.570330979 -0700 +++ b/arch/x86/mm/fault.c 2015-05-07 10:31:44.573331114 -0700 @@ -1009,6 +1009,15 @@ int show_unhandled_signals = 1; static inline int access_error(unsigned long error_code, struct vm_area_struct *vma) { + /* + * Access or read was blocked by protection keys. We do + * this check before any others because we do not want + * to, for instance, confuse a protection-key-denied + * write with one for which we should do a COW. + */ + if (error_code & PF_PK) + return 1; + if (error_code & PF_WRITE) { /* write, present and write, not present: */ if (unlikely(!(vma->vm_flags & VM_WRITE))) _
| |