Linux 6.12: support 3arg dequeue_signal() without task param

See torvalds/linux@a2b80ce87a. It claims the task arg is always
`current`, and so it is with us, so this is a safe change to make. The
only spanner is that we also support the older pre-5.17 3-arg
dequeue_signal() which had different meaning, so we have to check the
types to get the right one.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16582
This commit is contained in:
Rob Norris
2024-09-24 16:06:14 +10:00
committed by Brian Behlendorf
parent bc96b80550
commit d6b8c17f1d
2 changed files with 40 additions and 15 deletions
+10 -8
View File
@@ -162,20 +162,22 @@ issig(void)
if (!signal_pending(current))
return (0);
struct task_struct *task = current;
spl_kernel_siginfo_t __info;
sigset_t set;
siginitsetinv(&set, 1ULL << (SIGSTOP - 1) | 1ULL << (SIGTSTP - 1));
sigorsets(&set, &task->blocked, &set);
sigorsets(&set, &current->blocked, &set);
spin_lock_irq(&task->sighand->siglock);
#ifdef HAVE_DEQUEUE_SIGNAL_4ARG
spin_lock_irq(&current->sighand->siglock);
#if defined(HAVE_DEQUEUE_SIGNAL_4ARG)
enum pid_type __type;
if (dequeue_signal(task, &set, &__info, &__type) != 0) {
if (dequeue_signal(current, &set, &__info, &__type) != 0) {
#elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TASK)
if (dequeue_signal(current, &set, &__info) != 0) {
#else
if (dequeue_signal(task, &set, &__info) != 0) {
enum pid_type __type;
if (dequeue_signal(&set, &__info, &__type) != 0) {
#endif
spin_unlock_irq(&task->sighand->siglock);
spin_unlock_irq(&current->sighand->siglock);
kernel_signal_stop();
/*
@@ -188,7 +190,7 @@ issig(void)
return (0);
}
spin_unlock_irq(&task->sighand->siglock);
spin_unlock_irq(&current->sighand->siglock);
return (1);
}