mirror of https://github.com/OpenIPC/firmware.git
51 lines
1.4 KiB
Diff
51 lines
1.4 KiB
Diff
diff -drupN a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
|
|
--- a/arch/arm/mm/fault.c 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/arch/arm/mm/fault.c 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -219,6 +219,25 @@ static inline bool access_error(unsigned
|
|
return vma->vm_flags & mask ? false : true;
|
|
}
|
|
|
|
+static void aw_vma_pid_add(struct vm_area_struct *vma, pid_t pid)
|
|
+{
|
|
+ int i;
|
|
+
|
|
+ if (vma->access_vma_num > 62)
|
|
+ return;
|
|
+ if (vma->access_vma_num == 0) {
|
|
+ vma->access_vma_array[0] = pid;
|
|
+ vma->access_vma_num++;
|
|
+ return;
|
|
+ }
|
|
+ for (i = 0; i < vma->access_vma_num; i++) {
|
|
+ if (pid == vma->access_vma_array[i])
|
|
+ return;
|
|
+ }
|
|
+ vma->access_vma_array[vma->access_vma_num] = pid;
|
|
+ vma->access_vma_num++;
|
|
+}
|
|
+
|
|
static int __kprobes
|
|
__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
|
|
unsigned int flags, struct task_struct *tsk)
|
|
@@ -243,6 +262,7 @@ good_area:
|
|
goto out;
|
|
}
|
|
|
|
+ aw_vma_pid_add(vma, current->pid);
|
|
return handle_mm_fault(vma, addr & PAGE_MASK, flags);
|
|
|
|
check_stack:
|
|
@@ -273,10 +293,10 @@ do_page_fault(unsigned long addr, unsign
|
|
local_irq_enable();
|
|
|
|
/*
|
|
- * If we're in an interrupt or have no user
|
|
+ * If we're in an interrupt, or have no irqs, or have no user
|
|
* context, we must not take the fault..
|
|
*/
|
|
- if (faulthandler_disabled() || !mm)
|
|
+ if (faulthandler_disabled() || irqs_disabled() || !mm)
|
|
goto no_context;
|
|
|
|
if (user_mode(regs))
|