2002-10-02 09:18:54

by Ingo Molnar

[permalink] [raw]
Subject: [patch] sigfix-2.5.40-A0


the attached patch (against BK-curr) fixes yet another thread signal
detail, reported by Axel Zeuner (and also reproduced in Ulrich's thread
signal testcases) - sigwaiting threads do count as if they had those
signals unblocked. Fortunately fixing this means the removal of the
real_blocked field from task_struct.

Ingo

--- linux/include/linux/sched.h.orig Wed Oct 2 11:22:32 2002
+++ linux/include/linux/sched.h Wed Oct 2 11:23:28 2002
@@ -378,7 +378,7 @@
/* signal handlers */
struct signal_struct *sig;

- sigset_t blocked, real_blocked, shared_unblocked;
+ sigset_t blocked, shared_unblocked;
struct sigpending pending;

unsigned long sas_ss_sp;
--- linux/kernel/signal.c.orig Wed Oct 2 11:22:16 2002
+++ linux/kernel/signal.c Wed Oct 2 11:23:22 2002
@@ -843,8 +843,7 @@
struct pid *pid;

for_each_task_pid(p->tgid, PIDTYPE_TGID, tmp, l, pid)
- if (!sigismember(&tmp->blocked, signr) &&
- !sigismember(&tmp->real_blocked, signr))
+ if (!sigismember(&tmp->blocked, signr))
return tmp;
return NULL;
}
@@ -1482,7 +1481,8 @@
/* None ready -- temporarily unblock those we're
* interested while we are sleeping in so that we'll
* be awakened when they arrive. */
- current->real_blocked = current->blocked;
+ sigset_t orig_blocked = current->blocked;
+
sigandsets(&current->blocked, &current->blocked, &these);
recalc_sigpending();
spin_unlock_irq(&current->sig->siglock);
@@ -1494,8 +1494,7 @@
sig = dequeue_signal(&current->sig->shared_pending, &these, &info);
if (!sig)
sig = dequeue_signal(&current->pending, &these, &info);
- current->blocked = current->real_blocked;
- siginitset(&current->real_blocked, 0);
+ current->blocked = orig_blocked;
recalc_sigpending();
}
}


2002-10-02 23:07:10

by Oleg Nesterov

[permalink] [raw]
Subject: Re: [patch] sigfix-2.5.40-A0

Hello.

Ingo Molnar wrote:
> Fortunately fixing this means the removal of the
> real_blocked field from task_struct.

And what about shared_unblocked field ?
Nobody use it.

Oleg.