X-Git-Url: https://git.stricted.de/?p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git;a=blobdiff_plain;f=kernel%2Fsignal.c;h=28db04b54a9bdea8ba8386d09e606dccd6242c4b;hp=113411bfe8b1205ad0f26556776f2a317e06eb0c;hb=HEAD;hpb=607eeb0b836aa24a6972a460a213c4f87902d403 diff --git a/kernel/signal.c b/kernel/signal.c index 113411bfe8b1..28db04b54a9b 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -861,8 +861,10 @@ static bool prepare_signal(int sig, struct task_struct *p, bool force) struct task_struct *t; if (signal->flags & (SIGNAL_GROUP_EXIT | SIGNAL_GROUP_COREDUMP)) { - if (signal->flags & SIGNAL_GROUP_COREDUMP) - return sig == SIGKILL; + 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. */ @@ -1043,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) { @@ -1050,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; @@ -2768,7 +2777,8 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from) * Other callers might not initialize the si_lsb field, * so check explicitly for the right codes here. */ - if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) + if (from->si_signo == SIGBUS && + (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); #endif break; @@ -2848,7 +2858,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); @@ -3003,11 +3013,9 @@ static int do_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t *info) * Nor can they impersonate a kill()/tgkill(), which adds source info. */ if ((info->si_code >= 0 || info->si_code == SI_TKILL) && - (task_pid_vnr(current) != pid)) { - /* We used to allow any < 0 si_code */ - WARN_ON_ONCE(info->si_code < 0); + (task_pid_vnr(current) != pid)) return -EPERM; - } + info->si_signo = sig; /* POSIX.1b doesn't mention process groups. */ @@ -3035,7 +3043,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo, int, sig, struct compat_siginfo __user *, uinfo) { - siginfo_t info; + siginfo_t info = {}; int ret = copy_siginfo_from_user32(&info, uinfo); if (unlikely(ret)) return ret; @@ -3052,12 +3060,10 @@ static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) /* Not even root can pretend to send signals from the kernel. * Nor can they impersonate a kill()/tgkill(), which adds source info. */ - if (((info->si_code >= 0 || info->si_code == SI_TKILL)) && - (task_pid_vnr(current) != pid)) { - /* We used to allow any < 0 si_code */ - WARN_ON_ONCE(info->si_code < 0); + if ((info->si_code >= 0 || info->si_code == SI_TKILL) && + (task_pid_vnr(current) != pid)) return -EPERM; - } + info->si_signo = sig; return do_send_specific(tgid, pid, sig, info); @@ -3081,7 +3087,7 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo, int, sig, struct compat_siginfo __user *, uinfo) { - siginfo_t info; + siginfo_t info = {}; if (copy_siginfo_from_user32(&info, uinfo)) return -EFAULT; @@ -3550,7 +3556,7 @@ SYSCALL_DEFINE0(pause) #endif -int sigsuspend(sigset_t *set) +static int sigsuspend(sigset_t *set) { current->saved_sigmask = current->blocked; set_current_blocked(set);