提交 d2e0d2c5 编写于 作者: B Benjamin Herrenschmidt 提交者: Michael Ellerman

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: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 b15021d9
......@@ -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 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
} 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))))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册