aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-10-06 16:52:44 -0400
committerRichard Weinberger <richard@sigma-star.at>2014-08-06 06:56:16 -0400
commit00554fa4f80279db92f82c4f52c8ae72711f173e (patch)
treed267dfb25a83f455b91851e389b7f1a6fd842007 /arch/arm64
parentf6dd2a3f1f8d8df640cfa2d60f85c0b818af1593 (diff)
arm64: Use get_signal() signal_setup_done()
Use the more generic functions get_signal() signal_setup_done() for signal delivery. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/include/asm/signal32.h11
-rw-r--r--arch/arm64/kernel/signal.c48
-rw-r--r--arch/arm64/kernel/signal32.c14
3 files changed, 32 insertions, 41 deletions
diff --git a/arch/arm64/include/asm/signal32.h b/arch/arm64/include/asm/signal32.h
index 7c275e3b640f..eeaa97559bab 100644
--- a/arch/arm64/include/asm/signal32.h
+++ b/arch/arm64/include/asm/signal32.h
@@ -24,22 +24,21 @@
24 24
25extern const compat_ulong_t aarch32_sigret_code[6]; 25extern const compat_ulong_t aarch32_sigret_code[6];
26 26
27int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, 27int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
28 struct pt_regs *regs); 28 struct pt_regs *regs);
29int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 29int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
30 sigset_t *set, struct pt_regs *regs); 30 struct pt_regs *regs);
31 31
32void compat_setup_restart_syscall(struct pt_regs *regs); 32void compat_setup_restart_syscall(struct pt_regs *regs);
33#else 33#else
34 34
35static inline int compat_setup_frame(int usid, struct k_sigaction *ka, 35static inline int compat_setup_frame(int usid, struct ksignal *ksig,
36 sigset_t *set, struct pt_regs *regs) 36 sigset_t *set, struct pt_regs *regs)
37{ 37{
38 return -ENOSYS; 38 return -ENOSYS;
39} 39}
40 40
41static inline int compat_setup_rt_frame(int usig, struct k_sigaction *ka, 41static inline int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
42 siginfo_t *info, sigset_t *set,
43 struct pt_regs *regs) 42 struct pt_regs *regs)
44{ 43{
45 return -ENOSYS; 44 return -ENOSYS;
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 6357b9c6c90e..b29f5dab77ae 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -253,13 +253,13 @@ static void setup_return(struct pt_regs *regs, struct k_sigaction *ka,
253 regs->regs[30] = (unsigned long)sigtramp; 253 regs->regs[30] = (unsigned long)sigtramp;
254} 254}
255 255
256static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 256static int setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
257 sigset_t *set, struct pt_regs *regs) 257 struct pt_regs *regs)
258{ 258{
259 struct rt_sigframe __user *frame; 259 struct rt_sigframe __user *frame;
260 int err = 0; 260 int err = 0;
261 261
262 frame = get_sigframe(ka, regs); 262 frame = get_sigframe(&ksig->ka, regs);
263 if (!frame) 263 if (!frame)
264 return 1; 264 return 1;
265 265
@@ -269,9 +269,9 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
269 err |= __save_altstack(&frame->uc.uc_stack, regs->sp); 269 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
270 err |= setup_sigframe(frame, regs, set); 270 err |= setup_sigframe(frame, regs, set);
271 if (err == 0) { 271 if (err == 0) {
272 setup_return(regs, ka, frame, usig); 272 setup_return(regs, &ksig->ka, frame, usig);
273 if (ka->sa.sa_flags & SA_SIGINFO) { 273 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
274 err |= copy_siginfo_to_user(&frame->info, info); 274 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
275 regs->regs[1] = (unsigned long)&frame->info; 275 regs->regs[1] = (unsigned long)&frame->info;
276 regs->regs[2] = (unsigned long)&frame->uc; 276 regs->regs[2] = (unsigned long)&frame->uc;
277 } 277 }
@@ -291,13 +291,12 @@ static void setup_restart_syscall(struct pt_regs *regs)
291/* 291/*
292 * OK, we're invoking a handler 292 * OK, we're invoking a handler
293 */ 293 */
294static void handle_signal(unsigned long sig, struct k_sigaction *ka, 294static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
295 siginfo_t *info, struct pt_regs *regs)
296{ 295{
297 struct thread_info *thread = current_thread_info(); 296 struct thread_info *thread = current_thread_info();
298 struct task_struct *tsk = current; 297 struct task_struct *tsk = current;
299 sigset_t *oldset = sigmask_to_save(); 298 sigset_t *oldset = sigmask_to_save();
300 int usig = sig; 299 int usig = ksig->sig;
301 int ret; 300 int ret;
302 301
303 /* 302 /*
@@ -310,13 +309,12 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
310 * Set up the stack frame 309 * Set up the stack frame
311 */ 310 */
312 if (is_compat_task()) { 311 if (is_compat_task()) {
313 if (ka->sa.sa_flags & SA_SIGINFO) 312 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
314 ret = compat_setup_rt_frame(usig, ka, info, oldset, 313 ret = compat_setup_rt_frame(usig, ksig, oldset, regs);
315 regs);
316 else 314 else
317 ret = compat_setup_frame(usig, ka, oldset, regs); 315 ret = compat_setup_frame(usig, ksig, oldset, regs);
318 } else { 316 } else {
319 ret = setup_rt_frame(usig, ka, info, oldset, regs); 317 ret = setup_rt_frame(usig, ksig, oldset, regs);
320 } 318 }
321 319
322 /* 320 /*
@@ -324,18 +322,14 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
324 */ 322 */
325 ret |= !valid_user_regs(&regs->user_regs); 323 ret |= !valid_user_regs(&regs->user_regs);
326 324
327 if (ret != 0) {
328 force_sigsegv(sig, tsk);
329 return;
330 }
331
332 /* 325 /*
333 * Fast forward the stepping logic so we step into the signal 326 * Fast forward the stepping logic so we step into the signal
334 * handler. 327 * handler.
335 */ 328 */
336 user_fastforward_single_step(tsk); 329 if (!ret)
330 user_fastforward_single_step(tsk);
337 331
338 signal_delivered(sig, info, ka, regs, 0); 332 signal_setup_done(ret, ksig, 0);
339} 333}
340 334
341/* 335/*
@@ -350,10 +344,9 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
350static void do_signal(struct pt_regs *regs) 344static void do_signal(struct pt_regs *regs)
351{ 345{
352 unsigned long continue_addr = 0, restart_addr = 0; 346 unsigned long continue_addr = 0, restart_addr = 0;
353 struct k_sigaction ka; 347 int retval = 0;
354 siginfo_t info;
355 int signr, retval = 0;
356 int syscall = (int)regs->syscallno; 348 int syscall = (int)regs->syscallno;
349 struct ksignal ksig;
357 350
358 /* 351 /*
359 * If we were from a system call, check for system call restarting... 352 * If we were from a system call, check for system call restarting...
@@ -387,8 +380,7 @@ static void do_signal(struct pt_regs *regs)
387 * Get the signal to deliver. When running under ptrace, at this point 380 * Get the signal to deliver. When running under ptrace, at this point
388 * the debugger may change all of our registers. 381 * the debugger may change all of our registers.
389 */ 382 */
390 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 383 if (get_signal(&ksig)) {
391 if (signr > 0) {
392 /* 384 /*
393 * Depending on the signal settings, we may need to revert the 385 * Depending on the signal settings, we may need to revert the
394 * decision to restart the system call, but skip this if a 386 * decision to restart the system call, but skip this if a
@@ -398,12 +390,12 @@ static void do_signal(struct pt_regs *regs)
398 (retval == -ERESTARTNOHAND || 390 (retval == -ERESTARTNOHAND ||
399 retval == -ERESTART_RESTARTBLOCK || 391 retval == -ERESTART_RESTARTBLOCK ||
400 (retval == -ERESTARTSYS && 392 (retval == -ERESTARTSYS &&
401 !(ka.sa.sa_flags & SA_RESTART)))) { 393 !(ksig.ka.sa.sa_flags & SA_RESTART)))) {
402 regs->regs[0] = -EINTR; 394 regs->regs[0] = -EINTR;
403 regs->pc = continue_addr; 395 regs->pc = continue_addr;
404 } 396 }
405 397
406 handle_signal(signr, &ka, &info, regs); 398 handle_signal(&ksig, regs);
407 return; 399 return;
408 } 400 }
409 401
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index 3491c638f172..b69ee6921c48 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -520,18 +520,18 @@ static int compat_setup_sigframe(struct compat_sigframe __user *sf,
520/* 520/*
521 * 32-bit signal handling routines called from signal.c 521 * 32-bit signal handling routines called from signal.c
522 */ 522 */
523int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 523int compat_setup_rt_frame(int usig, struct ksignal *ksig,
524 sigset_t *set, struct pt_regs *regs) 524 sigset_t *set, struct pt_regs *regs)
525{ 525{
526 struct compat_rt_sigframe __user *frame; 526 struct compat_rt_sigframe __user *frame;
527 int err = 0; 527 int err = 0;
528 528
529 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 529 frame = compat_get_sigframe(&ksig->ka, regs, sizeof(*frame));
530 530
531 if (!frame) 531 if (!frame)
532 return 1; 532 return 1;
533 533
534 err |= copy_siginfo_to_user32(&frame->info, info); 534 err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
535 535
536 __put_user_error(0, &frame->sig.uc.uc_flags, err); 536 __put_user_error(0, &frame->sig.uc.uc_flags, err);
537 __put_user_error(0, &frame->sig.uc.uc_link, err); 537 __put_user_error(0, &frame->sig.uc.uc_link, err);
@@ -541,7 +541,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
541 err |= compat_setup_sigframe(&frame->sig, regs, set); 541 err |= compat_setup_sigframe(&frame->sig, regs, set);
542 542
543 if (err == 0) { 543 if (err == 0) {
544 compat_setup_return(regs, ka, frame->sig.retcode, frame, usig); 544 compat_setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig);
545 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info; 545 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info;
546 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc; 546 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc;
547 } 547 }
@@ -549,13 +549,13 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
549 return err; 549 return err;
550} 550}
551 551
552int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, 552int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
553 struct pt_regs *regs) 553 struct pt_regs *regs)
554{ 554{
555 struct compat_sigframe __user *frame; 555 struct compat_sigframe __user *frame;
556 int err = 0; 556 int err = 0;
557 557
558 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 558 frame = compat_get_sigframe(&ksig->ka, regs, sizeof(*frame));
559 559
560 if (!frame) 560 if (!frame)
561 return 1; 561 return 1;
@@ -564,7 +564,7 @@ int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set,
564 564
565 err |= compat_setup_sigframe(frame, regs, set); 565 err |= compat_setup_sigframe(frame, regs, set);
566 if (err == 0) 566 if (err == 0)
567 compat_setup_return(regs, ka, frame->retcode, frame, usig); 567 compat_setup_return(regs, &ksig->ka, frame->retcode, frame, usig);
568 568
569 return err; 569 return err;
570} 570}