summaryrefslogtreecommitdiff
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-07-19 14:49:42 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-08-03 16:06:50 +1000
commitd2e0d2c51adf348683e9f87da8298042a519deec (patch)
tree4e928b134ad6a4109f83d4945806135a56f6a14a /arch/powerpc/mm
parentb15021d994f09e9309ad37c1821ce4e3ee0cd62d (diff)
powerpc/mm: Set fault flags earlier
Move out the code that sets FAULT_FLAG_WRITE so the block that check access permissions can be extracted. While at it also set FAULT_FLAG_INSTRUCTION which will be used for protection keys. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/fault.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 572c80129581..ebe73c896aa8 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -384,6 +384,10 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
if (is_user)
flags |= FAULT_FLAG_USER;
+ if (is_write)
+ flags |= FAULT_FLAG_WRITE;
+ if (is_exec)
+ flags |= FAULT_FLAG_INSTRUCTION;
/* When running in the kernel we expect faults to occur only to
* addresses in user space. All other faults represent errors in the
@@ -476,7 +480,6 @@ good_area:
} else if (is_write) {
if (unlikely(!(vma->vm_flags & VM_WRITE)))
return bad_area(regs, address);
- flags |= FAULT_FLAG_WRITE;
/* a read */
} else {
if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))))