Skip to content

Commit 157cc18

Browse files
committed
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: Kees Cook <[email protected]> Reviewed-by: Oleg Nesterov <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 3123109 commit 157cc18

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

include/linux/signal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ extern int do_send_sig_info(int sig, struct kernel_siginfo *info,
283283
extern int group_send_sig_info(int sig, struct kernel_siginfo *info,
284284
struct task_struct *p, enum pid_type type);
285285
extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
286+
extern int send_signal_locked(int sig, struct kernel_siginfo *info,
287+
struct task_struct *p, enum pid_type type);
286288
extern int sigprocmask(int, sigset_t *, sigset_t *);
287289
extern void set_current_blocked(sigset_t *);
288290
extern void __set_current_blocked(const sigset_t *);

kernel/signal.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,8 @@ static inline bool legacy_queue(struct sigpending *signals, int sig)
10711071
return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
10721072
}
10731073

1074-
static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t,
1075-
enum pid_type type, bool force)
1074+
static int __send_signal_locked(int sig, struct kernel_siginfo *info,
1075+
struct task_struct *t, enum pid_type type, bool force)
10761076
{
10771077
struct sigpending *pending;
10781078
struct sigqueue *q;
@@ -1212,8 +1212,8 @@ static inline bool has_si_pid_and_uid(struct kernel_siginfo *info)
12121212
return ret;
12131213
}
12141214

1215-
static int send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t,
1216-
enum pid_type type)
1215+
int send_signal_locked(int sig, struct kernel_siginfo *info,
1216+
struct task_struct *t, enum pid_type type)
12171217
{
12181218
/* Should SIGKILL or SIGSTOP be received by a pid namespace init? */
12191219
bool force = false;
@@ -1245,7 +1245,7 @@ static int send_signal(int sig, struct kernel_siginfo *info, struct task_struct
12451245
force = true;
12461246
}
12471247
}
1248-
return __send_signal(sig, info, t, type, force);
1248+
return __send_signal_locked(sig, info, t, type, force);
12491249
}
12501250

12511251
static void print_fatal_signal(int signr)
@@ -1284,7 +1284,7 @@ __setup("print-fatal-signals=", setup_print_fatal_signals);
12841284
int
12851285
__group_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p)
12861286
{
1287-
return send_signal(sig, info, p, PIDTYPE_TGID);
1287+
return send_signal_locked(sig, info, p, PIDTYPE_TGID);
12881288
}
12891289

12901290
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
12941294
int ret = -ESRCH;
12951295

12961296
if (lock_task_sighand(p, &flags)) {
1297-
ret = send_signal(sig, info, p, type);
1297+
ret = send_signal_locked(sig, info, p, type);
12981298
unlock_task_sighand(p, &flags);
12991299
}
13001300

@@ -1347,7 +1347,7 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t,
13471347
if (action->sa.sa_handler == SIG_DFL &&
13481348
(!t->ptrace || (handler == HANDLER_EXIT)))
13491349
t->signal->flags &= ~SIGNAL_UNKILLABLE;
1350-
ret = send_signal(sig, info, t, PIDTYPE_PID);
1350+
ret = send_signal_locked(sig, info, t, PIDTYPE_PID);
13511351
spin_unlock_irqrestore(&t->sighand->siglock, flags);
13521352

13531353
return ret;
@@ -1567,7 +1567,7 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr,
15671567

15681568
if (sig) {
15691569
if (lock_task_sighand(p, &flags)) {
1570-
ret = __send_signal(sig, &info, p, PIDTYPE_TGID, false);
1570+
ret = __send_signal_locked(sig, &info, p, PIDTYPE_TGID, false);
15711571
unlock_task_sighand(p, &flags);
15721572
} else
15731573
ret = -ESRCH;
@@ -2103,7 +2103,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
21032103
* parent's namespaces.
21042104
*/
21052105
if (valid_signal(sig) && sig)
2106-
__send_signal(sig, &info, tsk->parent, PIDTYPE_TGID, false);
2106+
__send_signal_locked(sig, &info, tsk->parent, PIDTYPE_TGID, false);
21072107
__wake_up_parent(tsk, tsk->parent);
21082108
spin_unlock_irqrestore(&psig->siglock, flags);
21092109

@@ -2601,7 +2601,7 @@ static int ptrace_signal(int signr, kernel_siginfo_t *info, enum pid_type type)
26012601
/* If the (new) signal is now blocked, requeue it. */
26022602
if (sigismember(&current->blocked, signr) ||
26032603
fatal_signal_pending(current)) {
2604-
send_signal(signr, info, current, type);
2604+
send_signal_locked(signr, info, current, type);
26052605
signr = 0;
26062606
}
26072607

@@ -4793,7 +4793,7 @@ void kdb_send_sig(struct task_struct *t, int sig)
47934793
"the deadlock.\n");
47944794
return;
47954795
}
4796-
ret = send_signal(sig, SEND_SIG_PRIV, t, PIDTYPE_PID);
4796+
ret = send_signal_locked(sig, SEND_SIG_PRIV, t, PIDTYPE_PID);
47974797
spin_unlock(&t->sighand->siglock);
47984798
if (ret)
47994799
kdb_printf("Fail to deliver Signal %d to process %d.\n",

0 commit comments

Comments
 (0)