diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2018-04-19 20:20:58 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2018-09-27 15:59:17 -0400 |
commit | 4445229445273da16cc3a4928e3ba327b0301e7f (patch) | |
tree | 39db254b96a029dab7f0eebbb00030574b564d7d | |
parent | a618a2754ce6037beabe770aa01ae5ca97a0d65e (diff) |
signal/arc: Push siginfo generation into unhandled_exception
Pass signr, sicode, and address into unhandled_exception as explicit
parameters instead of members of struct siginfo. Then in unhandled
exception generate and send the siginfo using force_sig_fault.
This keeps the code simpler and less error prone.
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
-rw-r--r-- | arch/arc/kernel/traps.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c index b123558bf0bb..a7fcbc0d3943 100644 --- a/arch/arc/kernel/traps.c +++ b/arch/arc/kernel/traps.c | |||
@@ -42,21 +42,22 @@ void die(const char *str, struct pt_regs *regs, unsigned long address) | |||
42 | * -for kernel, chk if due to copy_(to|from)_user, otherwise die() | 42 | * -for kernel, chk if due to copy_(to|from)_user, otherwise die() |
43 | */ | 43 | */ |
44 | static noinline int | 44 | static noinline int |
45 | unhandled_exception(const char *str, struct pt_regs *regs, siginfo_t *info) | 45 | unhandled_exception(const char *str, struct pt_regs *regs, |
46 | int signo, int si_code, void __user *addr) | ||
46 | { | 47 | { |
47 | if (user_mode(regs)) { | 48 | if (user_mode(regs)) { |
48 | struct task_struct *tsk = current; | 49 | struct task_struct *tsk = current; |
49 | 50 | ||
50 | tsk->thread.fault_address = (__force unsigned int)info->si_addr; | 51 | tsk->thread.fault_address = (__force unsigned int)addr; |
51 | 52 | ||
52 | force_sig_info(info->si_signo, info, tsk); | 53 | force_sig_fault(signo, si_code, addr, tsk); |
53 | 54 | ||
54 | } else { | 55 | } else { |
55 | /* If not due to copy_(to|from)_user, we are doomed */ | 56 | /* If not due to copy_(to|from)_user, we are doomed */ |
56 | if (fixup_exception(regs)) | 57 | if (fixup_exception(regs)) |
57 | return 0; | 58 | return 0; |
58 | 59 | ||
59 | die(str, regs, (unsigned long)info->si_addr); | 60 | die(str, regs, (unsigned long)addr); |
60 | } | 61 | } |
61 | 62 | ||
62 | return 1; | 63 | return 1; |
@@ -64,16 +65,9 @@ unhandled_exception(const char *str, struct pt_regs *regs, siginfo_t *info) | |||
64 | 65 | ||
65 | #define DO_ERROR_INFO(signr, str, name, sicode) \ | 66 | #define DO_ERROR_INFO(signr, str, name, sicode) \ |
66 | int name(unsigned long address, struct pt_regs *regs) \ | 67 | int name(unsigned long address, struct pt_regs *regs) \ |
67 | { \ | 68 | { \ |
68 | siginfo_t info; \ | 69 | return unhandled_exception(str, regs, signr, sicode, \ |
69 | \ | 70 | (void __user *)address); \ |
70 | clear_siginfo(&info); \ | ||
71 | info.si_signo = signr; \ | ||
72 | info.si_errno = 0; \ | ||
73 | info.si_code = sicode; \ | ||
74 | info.si_addr = (void __user *)address; \ | ||
75 | \ | ||
76 | return unhandled_exception(str, regs, &info);\ | ||
77 | } | 71 | } |
78 | 72 | ||
79 | /* | 73 | /* |