fork timing hole ???...
Tom Wood
wood at rtp47.UUCP
Fri Aug 23 23:01:15 AEST 1985
> Finally, my question ..... Is this a bug??
> And the next, as yet unanswered question .... Should children inherit pending
> signals?? .... Will it do any harm??
Yes, all UNIX implementations I've seen do suffer from an
incorrect implementation of sending signals to a process group. The
manual for kill is quite correct though: when killing a process group,
the signal will be sent to all members of the process group. Simply
stated, *one* signal sent to a process group should be received by *all*
its members.
The problem with the implementation is that the typical UNIX
mind-set takes hold. Killing a process group is simply killing each
process which is a member of the group, and everyone knows that killing
a process is just a matter of setting a bit. This can be solved by the
following implementation.
First, all signals sent to a process are differentiated by the
manner in which they were sent. Suppose then, that we have two bit
arrays: incomming_signals_for_pid and incomming_signals_for_pgrp. At
the time a fork operation is performed, the latter should be inherited
by the child, while the former should not. This means that signals sent
to a specific process are not inherited, while those sent to a process
group are. Furthermore, only those signals that have not yet been
processed are subject to being inherited.
In support of this change, I won't stand too long on the fact
that this is entirely consistent with what is (not) stated in the manual
for fork! All UNIX implementations I've seen clear the pending signal
vector in the child process. However, I believe this change is
consistent with the intent of kill (and killpg), and behaves reasonably
when one considers the ability to block signals (as in BSD 4.2).
So I think a child should inherit incomming signals (those that
have not been processed) which were sent to the parent's process group
as a natural course of inheriting the parent's process group. The child
should not inherit incomming signals which were sent specifically to the
parent.
The incomming_signals_for_pgrp vector would also suffice for
sending signals to a group of process's based on other selection
criteria such as Ken Lalonde's "kill by real user-id".
--
Tom Wood
Data General, Research Triangle Park, NC
{the known world}!mcnc!rti-sel!rtp47!wood
More information about the Comp.unix.wizards
mailing list