Merge tag 'v3.10.55' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / signal.c
index dd72567767d963ccb8ac2f3cfa4a824fa5f81b4e..6217aa47d7e1e2a6883012cab0f8b543a5dbfabe 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/user_namespace.h>
 #include <linux/uprobes.h>
 #include <linux/compat.h>
+#include <linux/cn_proc.h>
 #define CREATE_TRACE_POINTS
 #include <trace/events/signal.h>
 
@@ -854,12 +855,16 @@ static void ptrace_trap_notify(struct task_struct *t)
  * Returns true if the signal should be actually delivered, otherwise
  * it should be dropped.
  */
-static int prepare_signal(int sig, struct task_struct *p, bool force)
+static bool prepare_signal(int sig, struct task_struct *p, bool force)
 {
        struct signal_struct *signal = p->signal;
        struct task_struct *t;
 
-       if (unlikely(signal->flags & SIGNAL_GROUP_EXIT)) {
+       if (signal->flags & (SIGNAL_GROUP_EXIT | SIGNAL_GROUP_COREDUMP)) {
+               if (signal->flags & SIGNAL_GROUP_COREDUMP) {
+                       printk(KERN_DEBUG "[%d:%s] is in the middle of dying so skip sig %d\n",p->pid, p->comm, sig);
+               }
+               return 0;
                /*
                 * The process is in the middle of dying, nothing to do.
                 */
@@ -1040,6 +1045,8 @@ static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_str
 }
 #endif
 
+static const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
+
 static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
                        int group, int from_ancestor_ns)
 {
@@ -1047,7 +1054,12 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
        struct sigqueue *q;
        int override_rlimit;
        int ret = 0, result;
+       unsigned state;
 
+       state = t->state ? __ffs(t->state) + 1 : 0;
+       printk(KERN_DEBUG "[%d:%s] sig %d to [%d:%s] stat=%c\n",
+              current->pid, current->comm, sig, t->pid, t->comm,
+              state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
        assert_spin_locked(&t->sighand->siglock);
 
        result = TRACE_SIGNAL_IGNORED;
@@ -1160,8 +1172,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
 static void print_fatal_signal(int signr)
 {
        struct pt_regs *regs = signal_pt_regs();
-       printk(KERN_INFO "%s/%d: potentially unexpected fatal signal %d.\n",
-               current->comm, task_pid_nr(current), signr);
+       printk(KERN_INFO "potentially unexpected fatal signal %d.\n", signr);
 
 #if defined(__i386__) && !defined(__arch_um__)
        printk(KERN_INFO "code at %08lx: ", regs->ip);
@@ -2350,6 +2361,7 @@ relock:
                if (sig_kernel_coredump(signr)) {
                        if (print_fatal_signals)
                                print_fatal_signal(info->si_signo);
+                       proc_coredump_connector(current);
                        /*
                         * If it was able to dump core, this kills all
                         * other threads in the group and synchronizes with
@@ -2845,7 +2857,7 @@ int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
                recalc_sigpending();
                spin_unlock_irq(&tsk->sighand->siglock);
 
-               timeout = schedule_timeout_interruptible(timeout);
+               timeout = freezable_schedule_timeout_interruptible(timeout);
 
                spin_lock_irq(&tsk->sighand->siglock);
                __set_task_blocked(tsk, &tsk->real_blocked);
@@ -2948,7 +2960,7 @@ do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info)
 
 static int do_tkill(pid_t tgid, pid_t pid, int sig)
 {
-       struct siginfo info;
+       struct siginfo info = {};
 
        info.si_signo = sig;
        info.si_errno = 0;