aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2014-03-05 09:49:40 -0500
committerRichard Weinberger <richard@sigma-star.at>2014-08-06 07:04:31 -0400
commit8e2beafa2f7f48b1392c00897578e5daf858fe59 (patch)
treee3f650ae3cfe786476d66ca94821a533031b76b1
parenta8040ff82ee623bfd070b920fb4b5d133f9d9953 (diff)
openrisc: Use sigsp()
Use sigsp() instead of the open coded variant. Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--arch/openrisc/kernel/signal.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 66775bc07a8e..7d1b8235bf90 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -132,30 +132,16 @@ static inline unsigned long align_sigframe(unsigned long sp)
132 * or the alternate stack. 132 * or the alternate stack.
133 */ 133 */
134 134
135static inline void __user *get_sigframe(struct k_sigaction *ka, 135static inline void __user *get_sigframe(struct ksignal *ksig,
136 struct pt_regs *regs, size_t frame_size) 136 struct pt_regs *regs, size_t frame_size)
137{ 137{
138 unsigned long sp = regs->sp; 138 unsigned long sp = regs->sp;
139 int onsigstack = on_sig_stack(sp);
140 139
141 /* redzone */ 140 /* redzone */
142 sp -= STACK_FRAME_OVERHEAD; 141 sp -= STACK_FRAME_OVERHEAD;
143 142 sp = sigsp(sp, ksig);
144 /* This is the X/Open sanctioned signal stack switching. */
145 if ((ka->sa.sa_flags & SA_ONSTACK) && !onsigstack) {
146 if (current->sas_ss_size)
147 sp = current->sas_ss_sp + current->sas_ss_size;
148 }
149
150 sp = align_sigframe(sp - frame_size); 143 sp = align_sigframe(sp - frame_size);
151 144
152 /*
153 * If we are on the alternate signal stack and would overflow it, don't.
154 * Return an always-bogus address instead so we will die with SIGSEGV.
155 */
156 if (onsigstack && !likely(on_sig_stack(sp)))
157 return (void __user *)-1L;
158
159 return (void __user *)sp; 145 return (void __user *)sp;
160} 146}
161 147
@@ -173,7 +159,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
173 unsigned long return_ip; 159 unsigned long return_ip;
174 int err = 0; 160 int err = 0;
175 161
176 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); 162 frame = get_sigframe(ksig, regs, sizeof(*frame));
177 163
178 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 164 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
179 return -EFAULT; 165 return -EFAULT;