diff options
| -rw-r--r-- | arch/xtensa/include/asm/thread_info.h | 1 | ||||
| -rw-r--r-- | arch/xtensa/kernel/entry.S | 5 | ||||
| -rw-r--r-- | arch/xtensa/kernel/signal.c | 20 |
3 files changed, 20 insertions, 6 deletions
diff --git a/arch/xtensa/include/asm/thread_info.h b/arch/xtensa/include/asm/thread_info.h index 6abbedd09d85..81abfd5d01ac 100644 --- a/arch/xtensa/include/asm/thread_info.h +++ b/arch/xtensa/include/asm/thread_info.h | |||
| @@ -131,6 +131,7 @@ static inline struct thread_info *current_thread_info(void) | |||
| 131 | #define TIF_IRET 4 /* return with iret */ | 131 | #define TIF_IRET 4 /* return with iret */ |
| 132 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ | 132 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ |
| 133 | #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ | 133 | #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ |
| 134 | #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ | ||
| 134 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 135 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
| 135 | 136 | ||
| 136 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 137 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index b1bb6d79d8b9..7e6236073397 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
| @@ -409,14 +409,15 @@ common_exception_return: | |||
| 409 | l32i a4, a2, TI_FLAGS | 409 | l32i a4, a2, TI_FLAGS |
| 410 | 410 | ||
| 411 | _bbsi.l a4, TIF_NEED_RESCHED, 3f | 411 | _bbsi.l a4, TIF_NEED_RESCHED, 3f |
| 412 | _bbsi.l a4, TIF_NOTIFY_RESUME, 2f | ||
| 412 | _bbci.l a4, TIF_SIGPENDING, 4f | 413 | _bbci.l a4, TIF_SIGPENDING, 4f |
| 413 | 414 | ||
| 414 | l32i a4, a1, PT_DEPC | 415 | 2: l32i a4, a1, PT_DEPC |
| 415 | bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f | 416 | bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f |
| 416 | 417 | ||
| 417 | /* Call do_signal() */ | 418 | /* Call do_signal() */ |
| 418 | 419 | ||
| 419 | movi a4, do_signal # int do_signal(struct pt_regs*, sigset_t*) | 420 | movi a4, do_notify_resume # int do_notify_resume(struct pt_regs*) |
| 420 | mov a6, a1 | 421 | mov a6, a1 |
| 421 | callx4 a4 | 422 | callx4 a4 |
| 422 | j 1b | 423 | j 1b |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index bb00cc470ca9..c5e4ec0598d2 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/ptrace.h> | 20 | #include <linux/ptrace.h> |
| 21 | #include <linux/personality.h> | 21 | #include <linux/personality.h> |
| 22 | #include <linux/freezer.h> | 22 | #include <linux/freezer.h> |
| 23 | #include <linux/tracehook.h> | ||
| 23 | 24 | ||
| 24 | #include <asm/ucontext.h> | 25 | #include <asm/ucontext.h> |
| 25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
| @@ -446,16 +447,13 @@ asmlinkage long xtensa_sigaltstack(const stack_t __user *uss, | |||
| 446 | * the kernel can handle, and then we build all the user-level signal handling | 447 | * the kernel can handle, and then we build all the user-level signal handling |
| 447 | * stack-frames in one go after that. | 448 | * stack-frames in one go after that. |
| 448 | */ | 449 | */ |
| 449 | void do_signal(struct pt_regs *regs) | 450 | static void do_signal(struct pt_regs *regs) |
| 450 | { | 451 | { |
| 451 | siginfo_t info; | 452 | siginfo_t info; |
| 452 | int signr; | 453 | int signr; |
| 453 | struct k_sigaction ka; | 454 | struct k_sigaction ka; |
| 454 | sigset_t oldset; | 455 | sigset_t oldset; |
| 455 | 456 | ||
| 456 | if (!user_mode(regs)) | ||
| 457 | return; | ||
| 458 | |||
| 459 | if (try_to_freeze()) | 457 | if (try_to_freeze()) |
| 460 | goto no_signal; | 458 | goto no_signal; |
| 461 | 459 | ||
| @@ -542,3 +540,17 @@ no_signal: | |||
| 542 | return; | 540 | return; |
| 543 | } | 541 | } |
| 544 | 542 | ||
| 543 | void do_notify_resume(struct pt_regs *regs) | ||
| 544 | { | ||
| 545 | if (!user_mode(regs)) | ||
| 546 | return; | ||
| 547 | |||
| 548 | if (test_thread_flag(TIF_SIGPENDING)) | ||
| 549 | do_signal(regs); | ||
| 550 | |||
| 551 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { | ||
| 552 | tracehook_notify_resume(regs); | ||
| 553 | if (current->replacement_session_keyring) | ||
| 554 | key_replace_session_keyring(); | ||
| 555 | } | ||
| 556 | } | ||
