Skip to content

Commit

Permalink
signal: Push pid type down into __send_signal
Browse files Browse the repository at this point in the history
This information is already available in the callers and by pushing it
down it makes the code a little clearer, and allows implementing
better handling of signales set to a group of processes in fork.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
  • Loading branch information
ebiederm committed Jul 21, 2018
1 parent b213984 commit 5a883ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_str
#endif

static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
int group, int from_ancestor_ns)
enum pid_type type, int from_ancestor_ns)
{
struct sigpending *pending;
struct sigqueue *q;
Expand All @@ -1012,7 +1012,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
from_ancestor_ns || (info == SEND_SIG_FORCED)))
goto ret;

pending = group ? &t->signal->shared_pending : &t->pending;
pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending;
/*
* Short-circuit ignored signals and support queuing
* exactly one non-rt signal, so that we can get more
Expand Down Expand Up @@ -1096,9 +1096,9 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
out_set:
signalfd_notify(t, sig);
sigaddset(&pending->signal, sig);
complete_signal(sig, t, group);
complete_signal(sig, t, type != PIDTYPE_PID);
ret:
trace_signal_generate(sig, info, t, group, result);
trace_signal_generate(sig, info, t, type != PIDTYPE_PID, result);
return ret;
}

Expand All @@ -1112,7 +1112,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
!task_pid_nr_ns(current, task_active_pid_ns(t));
#endif

return __send_signal(sig, info, t, type != PIDTYPE_PID, from_ancestor_ns);
return __send_signal(sig, info, t, type, from_ancestor_ns);
}

static void print_fatal_signal(int signr)
Expand Down Expand Up @@ -1377,7 +1377,7 @@ int kill_pid_info_as_cred(int sig, struct siginfo *info, struct pid *pid,

if (sig) {
if (lock_task_sighand(p, &flags)) {
ret = __send_signal(sig, info, p, 1, 0);
ret = __send_signal(sig, info, p, PIDTYPE_TGID, 0);
unlock_task_sighand(p, &flags);
} else
ret = -ESRCH;
Expand Down

0 comments on commit 5a883ce

Please sign in to comment.