signal/arc: Use force_sig_fault where appropriate
[ Upstream commit 15773ae938d8d93d982461990bebad6e1d7a1830 ] Acked-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fcb2f1e2ea
commit
0828438e52
@ -66,14 +66,12 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
|
|||||||
struct vm_area_struct *vma = NULL;
|
struct vm_area_struct *vma = NULL;
|
||||||
struct task_struct *tsk = current;
|
struct task_struct *tsk = current;
|
||||||
struct mm_struct *mm = tsk->mm;
|
struct mm_struct *mm = tsk->mm;
|
||||||
siginfo_t info;
|
int si_code;
|
||||||
int ret;
|
int ret;
|
||||||
vm_fault_t fault;
|
vm_fault_t fault;
|
||||||
int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */
|
int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */
|
||||||
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
|
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
|
||||||
|
|
||||||
clear_siginfo(&info);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We fault-in kernel-space virtual memory on-demand. The
|
* We fault-in kernel-space virtual memory on-demand. The
|
||||||
* 'reference' page table is init_mm.pgd.
|
* 'reference' page table is init_mm.pgd.
|
||||||
@ -91,7 +89,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info.si_code = SEGV_MAPERR;
|
si_code = SEGV_MAPERR;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're in an interrupt or have no user
|
* If we're in an interrupt or have no user
|
||||||
@ -119,7 +117,7 @@ retry:
|
|||||||
* we can handle it..
|
* we can handle it..
|
||||||
*/
|
*/
|
||||||
good_area:
|
good_area:
|
||||||
info.si_code = SEGV_ACCERR;
|
si_code = SEGV_ACCERR;
|
||||||
|
|
||||||
/* Handle protection violation, execute on heap or stack */
|
/* Handle protection violation, execute on heap or stack */
|
||||||
|
|
||||||
@ -204,11 +202,7 @@ bad_area_nosemaphore:
|
|||||||
/* User mode accesses just cause a SIGSEGV */
|
/* User mode accesses just cause a SIGSEGV */
|
||||||
if (user_mode(regs)) {
|
if (user_mode(regs)) {
|
||||||
tsk->thread.fault_address = address;
|
tsk->thread.fault_address = address;
|
||||||
info.si_signo = SIGSEGV;
|
force_sig_fault(SIGSEGV, si_code, (void __user *)address, tsk);
|
||||||
info.si_errno = 0;
|
|
||||||
/* info.si_code has been set above */
|
|
||||||
info.si_addr = (void __user *)address;
|
|
||||||
force_sig_info(SIGSEGV, &info, tsk);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,9 +237,5 @@ do_sigbus:
|
|||||||
goto no_context;
|
goto no_context;
|
||||||
|
|
||||||
tsk->thread.fault_address = address;
|
tsk->thread.fault_address = address;
|
||||||
info.si_signo = SIGBUS;
|
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, tsk);
|
||||||
info.si_errno = 0;
|
|
||||||
info.si_code = BUS_ADRERR;
|
|
||||||
info.si_addr = (void __user *)address;
|
|
||||||
force_sig_info(SIGBUS, &info, tsk);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user