aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/signal_32.c29
-rw-r--r--arch/x86/kernel/signal_64.c30
2 files changed, 40 insertions, 19 deletions
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index bd9b65031a9a..48982f7ce886 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -338,8 +338,8 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size,
338} 338}
339 339
340static int 340static int
341setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, 341__setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
342 struct pt_regs *regs) 342 struct pt_regs *regs)
343{ 343{
344 struct sigframe __user *frame; 344 struct sigframe __user *frame;
345 void __user *restorer; 345 void __user *restorer;
@@ -416,8 +416,8 @@ give_sigsegv:
416 return -EFAULT; 416 return -EFAULT;
417} 417}
418 418
419static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 419static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
420 sigset_t *set, struct pt_regs *regs) 420 sigset_t *set, struct pt_regs *regs)
421{ 421{
422 struct rt_sigframe __user *frame; 422 struct rt_sigframe __user *frame;
423 void __user *restorer; 423 void __user *restorer;
@@ -502,6 +502,21 @@ give_sigsegv:
502 * OK, we're invoking a handler: 502 * OK, we're invoking a handler:
503 */ 503 */
504static int 504static int
505setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
506 sigset_t *set, struct pt_regs *regs)
507{
508 int ret;
509
510 /* Set up the stack frame */
511 if (ka->sa.sa_flags & SA_SIGINFO)
512 ret = __setup_rt_frame(sig, ka, info, set, regs);
513 else
514 ret = __setup_frame(sig, ka, set, regs);
515
516 return ret;
517}
518
519static int
505handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 520handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
506 sigset_t *oldset, struct pt_regs *regs) 521 sigset_t *oldset, struct pt_regs *regs)
507{ 522{
@@ -537,11 +552,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
537 likely(test_and_clear_thread_flag(TIF_FORCED_TF))) 552 likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
538 regs->flags &= ~X86_EFLAGS_TF; 553 regs->flags &= ~X86_EFLAGS_TF;
539 554
540 /* Set up the stack frame */ 555 ret = setup_rt_frame(sig, ka, info, oldset, regs);
541 if (ka->sa.sa_flags & SA_SIGINFO)
542 ret = setup_rt_frame(sig, ka, info, oldset, regs);
543 else
544 ret = setup_frame(sig, ka, oldset, regs);
545 556
546 if (ret) 557 if (ret)
547 return ret; 558 return ret;
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 19e2b9143205..8fbdd23d5cc6 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -195,8 +195,8 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
195 return (void __user *)round_down(sp - size, 64); 195 return (void __user *)round_down(sp - size, 64);
196} 196}
197 197
198static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 198static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
199 sigset_t *set, struct pt_regs *regs) 199 sigset_t *set, struct pt_regs *regs)
200{ 200{
201 struct rt_sigframe __user *frame; 201 struct rt_sigframe __user *frame;
202 void __user *fp = NULL; 202 void __user *fp = NULL;
@@ -280,6 +280,24 @@ give_sigsegv:
280/* 280/*
281 * OK, we're invoking a handler 281 * OK, we're invoking a handler
282 */ 282 */
283static int
284setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
285 sigset_t *set, struct pt_regs *regs)
286{
287 int ret;
288
289#ifdef CONFIG_IA32_EMULATION
290 if (test_thread_flag(TIF_IA32)) {
291 if (ka->sa.sa_flags & SA_SIGINFO)
292 ret = ia32_setup_rt_frame(sig, ka, info, set, regs);
293 else
294 ret = ia32_setup_frame(sig, ka, set, regs);
295 } else
296#endif
297 ret = __setup_rt_frame(sig, ka, info, set, regs);
298
299 return ret;
300}
283 301
284static int 302static int
285handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 303handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
@@ -317,14 +335,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
317 likely(test_and_clear_thread_flag(TIF_FORCED_TF))) 335 likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
318 regs->flags &= ~X86_EFLAGS_TF; 336 regs->flags &= ~X86_EFLAGS_TF;
319 337
320#ifdef CONFIG_IA32_EMULATION
321 if (test_thread_flag(TIF_IA32)) {
322 if (ka->sa.sa_flags & SA_SIGINFO)
323 ret = ia32_setup_rt_frame(sig, ka, info, oldset, regs);
324 else
325 ret = ia32_setup_frame(sig, ka, oldset, regs);
326 } else
327#endif
328 ret = setup_rt_frame(sig, ka, info, oldset, regs); 338 ret = setup_rt_frame(sig, ka, info, oldset, regs);
329 339
330 if (ret == 0) { 340 if (ret == 0) {