fault.c (9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e) fault.c (a050ba1e7422f2cc60ff8bfde3f96d34d00cb585)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4 *
5 * Derived from MIPS:
6 * Copyright (C) 1995 - 2000 by Ralf Baechle
7 */
8#include <linux/context_tracking.h>

--- 155 unchanged lines hidden (view full) ---

164 return;
165 }
166
167 if (user_mode(regs))
168 flags |= FAULT_FLAG_USER;
169
170 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
171retry:
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4 *
5 * Derived from MIPS:
6 * Copyright (C) 1995 - 2000 by Ralf Baechle
7 */
8#include <linux/context_tracking.h>

--- 155 unchanged lines hidden (view full) ---

164 return;
165 }
166
167 if (user_mode(regs))
168 flags |= FAULT_FLAG_USER;
169
170 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
171retry:
172 mmap_read_lock(mm);
173 vma = find_vma(mm, address);
174 if (!vma)
175 goto bad_area;
176 if (vma->vm_start <= address)
177 goto good_area;
178 if (!(vma->vm_flags & VM_GROWSDOWN))
179 goto bad_area;
180 if (!expand_stack(vma, address))
181 goto good_area;
172 vma = lock_mm_and_find_vma(mm, address, regs);
173 if (unlikely(!vma))
174 goto bad_area_nosemaphore;
175 goto good_area;
176
182/*
183 * Something tried to access memory that isn't in our memory map..
184 * Fix it, but check if it's kernel or user first..
185 */
186bad_area:
187 mmap_read_unlock(mm);
177/*
178 * Something tried to access memory that isn't in our memory map..
179 * Fix it, but check if it's kernel or user first..
180 */
181bad_area:
182 mmap_read_unlock(mm);
183bad_area_nosemaphore:
188 do_sigsegv(regs, write, address, si_code);
189 return;
190
191/*
192 * Ok, we have a good vm_area for this memory access, so
193 * we can handle it..
194 */
195good_area:

--- 73 unchanged lines hidden ---
184 do_sigsegv(regs, write, address, si_code);
185 return;
186
187/*
188 * Ok, we have a good vm_area for this memory access, so
189 * we can handle it..
190 */
191good_area:

--- 73 unchanged lines hidden ---