signal/riscv: Remove tsk parameter from do_trap

The do_trap function is always called with tsk == current.
Make that obvious by removing the tsk parameter.

This also makes it clear that do_trap calls force_sig_fault
on the current task.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
Eric W. Biederman
2019-02-05 19:10:48 -06:00
parent e165682971
commit 6f25a96764
3 changed files with 8 additions and 7 deletions

View File

@@ -94,7 +94,7 @@ struct task_struct;
extern void die(struct pt_regs *regs, const char *str); extern void die(struct pt_regs *regs, const char *str);
extern void do_trap(struct pt_regs *regs, int signo, int code, extern void do_trap(struct pt_regs *regs, int signo, int code,
unsigned long addr, struct task_struct *tsk); unsigned long addr);
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */

View File

@@ -63,9 +63,10 @@ void die(struct pt_regs *regs, const char *str)
do_exit(SIGSEGV); do_exit(SIGSEGV);
} }
void do_trap(struct pt_regs *regs, int signo, int code, void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr)
unsigned long addr, struct task_struct *tsk)
{ {
struct task_struct *tsk = current;
if (show_unhandled_signals && unhandled_signal(tsk, signo) if (show_unhandled_signals && unhandled_signal(tsk, signo)
&& printk_ratelimit()) { && printk_ratelimit()) {
pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT,
@@ -82,7 +83,7 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code,
unsigned long addr, const char *str) unsigned long addr, const char *str)
{ {
if (user_mode(regs)) { if (user_mode(regs)) {
do_trap(regs, signo, code, addr, current); do_trap(regs, signo, code, addr);
} else { } else {
if (!fixup_exception(regs)) if (!fixup_exception(regs))
die(regs, str); die(regs, str);

View File

@@ -181,7 +181,7 @@ bad_area:
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
/* User mode accesses just cause a SIGSEGV */ /* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) { if (user_mode(regs)) {
do_trap(regs, SIGSEGV, code, addr, tsk); do_trap(regs, SIGSEGV, code, addr);
return; return;
} }
@@ -217,7 +217,7 @@ do_sigbus:
/* Kernel mode? Handle exceptions or die */ /* Kernel mode? Handle exceptions or die */
if (!user_mode(regs)) if (!user_mode(regs))
goto no_context; goto no_context;
do_trap(regs, SIGBUS, BUS_ADRERR, addr, tsk); do_trap(regs, SIGBUS, BUS_ADRERR, addr);
return; return;
vmalloc_fault: vmalloc_fault:
@@ -231,7 +231,7 @@ vmalloc_fault:
/* User mode accesses just cause a SIGSEGV */ /* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) if (user_mode(regs))
return do_trap(regs, SIGSEGV, code, addr, tsk); return do_trap(regs, SIGSEGV, code, addr);
/* /*
* Synchronize this task's top level page-table * Synchronize this task's top level page-table