Commit 157cc181 authored by Eric W. Biederman's avatar Eric W. Biederman

signal: Rename send_signal send_signal_locked

Rename send_signal and __send_signal to send_signal_locked and
__send_signal_locked to make send_signal usable outside of
signal.c.
Tested-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
Link: https://lkml.kernel.org/r/20220505182645.497868-1-ebiederm@xmission.comSigned-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 31231092
...@@ -283,6 +283,8 @@ extern int do_send_sig_info(int sig, struct kernel_siginfo *info, ...@@ -283,6 +283,8 @@ extern int do_send_sig_info(int sig, struct kernel_siginfo *info,
extern int group_send_sig_info(int sig, struct kernel_siginfo *info, extern int group_send_sig_info(int sig, struct kernel_siginfo *info,
struct task_struct *p, enum pid_type type); struct task_struct *p, enum pid_type type);
extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *); extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
extern int send_signal_locked(int sig, struct kernel_siginfo *info,
struct task_struct *p, enum pid_type type);
extern int sigprocmask(int, sigset_t *, sigset_t *); extern int sigprocmask(int, sigset_t *, sigset_t *);
extern void set_current_blocked(sigset_t *); extern void set_current_blocked(sigset_t *);
extern void __set_current_blocked(const sigset_t *); extern void __set_current_blocked(const sigset_t *);
......
...@@ -1071,8 +1071,8 @@ static inline bool legacy_queue(struct sigpending *signals, int sig) ...@@ -1071,8 +1071,8 @@ static inline bool legacy_queue(struct sigpending *signals, int sig)
return (sig < SIGRTMIN) && sigismember(&signals->signal, sig); return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
} }
static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t, static int __send_signal_locked(int sig, struct kernel_siginfo *info,
enum pid_type type, bool force) struct task_struct *t, enum pid_type type, bool force)
{ {
struct sigpending *pending; struct sigpending *pending;
struct sigqueue *q; struct sigqueue *q;
...@@ -1212,8 +1212,8 @@ static inline bool has_si_pid_and_uid(struct kernel_siginfo *info) ...@@ -1212,8 +1212,8 @@ static inline bool has_si_pid_and_uid(struct kernel_siginfo *info)
return ret; return ret;
} }
static int send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t, int send_signal_locked(int sig, struct kernel_siginfo *info,
enum pid_type type) struct task_struct *t, enum pid_type type)
{ {
/* Should SIGKILL or SIGSTOP be received by a pid namespace init? */ /* Should SIGKILL or SIGSTOP be received by a pid namespace init? */
bool force = false; bool force = false;
...@@ -1245,7 +1245,7 @@ static int send_signal(int sig, struct kernel_siginfo *info, struct task_struct ...@@ -1245,7 +1245,7 @@ static int send_signal(int sig, struct kernel_siginfo *info, struct task_struct
force = true; force = true;
} }
} }
return __send_signal(sig, info, t, type, force); return __send_signal_locked(sig, info, t, type, force);
} }
static void print_fatal_signal(int signr) static void print_fatal_signal(int signr)
...@@ -1284,7 +1284,7 @@ __setup("print-fatal-signals=", setup_print_fatal_signals); ...@@ -1284,7 +1284,7 @@ __setup("print-fatal-signals=", setup_print_fatal_signals);
int int
__group_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p) __group_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p)
{ {
return send_signal(sig, info, p, PIDTYPE_TGID); return send_signal_locked(sig, info, p, PIDTYPE_TGID);
} }
int do_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p, int do_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p,
...@@ -1294,7 +1294,7 @@ int do_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p ...@@ -1294,7 +1294,7 @@ int do_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p
int ret = -ESRCH; int ret = -ESRCH;
if (lock_task_sighand(p, &flags)) { if (lock_task_sighand(p, &flags)) {
ret = send_signal(sig, info, p, type); ret = send_signal_locked(sig, info, p, type);
unlock_task_sighand(p, &flags); unlock_task_sighand(p, &flags);
} }
...@@ -1347,7 +1347,7 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t, ...@@ -1347,7 +1347,7 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t,
if (action->sa.sa_handler == SIG_DFL && if (action->sa.sa_handler == SIG_DFL &&
(!t->ptrace || (handler == HANDLER_EXIT))) (!t->ptrace || (handler == HANDLER_EXIT)))
t->signal->flags &= ~SIGNAL_UNKILLABLE; t->signal->flags &= ~SIGNAL_UNKILLABLE;
ret = send_signal(sig, info, t, PIDTYPE_PID); ret = send_signal_locked(sig, info, t, PIDTYPE_PID);
spin_unlock_irqrestore(&t->sighand->siglock, flags); spin_unlock_irqrestore(&t->sighand->siglock, flags);
return ret; return ret;
...@@ -1567,7 +1567,7 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr, ...@@ -1567,7 +1567,7 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr,
if (sig) { if (sig) {
if (lock_task_sighand(p, &flags)) { if (lock_task_sighand(p, &flags)) {
ret = __send_signal(sig, &info, p, PIDTYPE_TGID, false); ret = __send_signal_locked(sig, &info, p, PIDTYPE_TGID, false);
unlock_task_sighand(p, &flags); unlock_task_sighand(p, &flags);
} else } else
ret = -ESRCH; ret = -ESRCH;
...@@ -2103,7 +2103,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig) ...@@ -2103,7 +2103,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
* parent's namespaces. * parent's namespaces.
*/ */
if (valid_signal(sig) && sig) if (valid_signal(sig) && sig)
__send_signal(sig, &info, tsk->parent, PIDTYPE_TGID, false); __send_signal_locked(sig, &info, tsk->parent, PIDTYPE_TGID, false);
__wake_up_parent(tsk, tsk->parent); __wake_up_parent(tsk, tsk->parent);
spin_unlock_irqrestore(&psig->siglock, flags); spin_unlock_irqrestore(&psig->siglock, flags);
...@@ -2601,7 +2601,7 @@ static int ptrace_signal(int signr, kernel_siginfo_t *info, enum pid_type type) ...@@ -2601,7 +2601,7 @@ static int ptrace_signal(int signr, kernel_siginfo_t *info, enum pid_type type)
/* If the (new) signal is now blocked, requeue it. */ /* If the (new) signal is now blocked, requeue it. */
if (sigismember(&current->blocked, signr) || if (sigismember(&current->blocked, signr) ||
fatal_signal_pending(current)) { fatal_signal_pending(current)) {
send_signal(signr, info, current, type); send_signal_locked(signr, info, current, type);
signr = 0; signr = 0;
} }
...@@ -4793,7 +4793,7 @@ void kdb_send_sig(struct task_struct *t, int sig) ...@@ -4793,7 +4793,7 @@ void kdb_send_sig(struct task_struct *t, int sig)
"the deadlock.\n"); "the deadlock.\n");
return; return;
} }
ret = send_signal(sig, SEND_SIG_PRIV, t, PIDTYPE_PID); ret = send_signal_locked(sig, SEND_SIG_PRIV, t, PIDTYPE_PID);
spin_unlock(&t->sighand->siglock); spin_unlock(&t->sighand->siglock);
if (ret) if (ret)
kdb_printf("Fail to deliver Signal %d to process %d.\n", kdb_printf("Fail to deliver Signal %d to process %d.\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment