cvs commit: src/sys/kern kern_sig.c

Matthew Dillon dillon at apollo.backplane.com
Sun Jul 1 14:59:50 PDT 2007


:Matthew Dillon wrote:
:>   Log:
:>   A signal is sent to a particular LWP must be delivered to that LWP an=
:d never
:>   posted to the process generically.  Otherwise things like seg faults =
:can
:>   end up being posted to the wrong LWP.
:
:How did this happen?  I just see the case for a stopped process where I h=
:ad a bug.
:
:cheers
:  simon

    Yah, that was where one bug was.   There was also some logic down below
    a bit:

    if (lp == NULL) {
	lp = find_lwp_for_signal(p, sig);
    }
    ...
    if (lp == NULL || SIGISMEMBER(lp->lwp_sigmask, sig)) {
	SIGADDSET(p->p_siglist, sig);
	...
    }

    Meaning, if a signal is sent to a particular LWP but that lwp has
    masked the signal, the signal gets added to the generic siglist instead.
    We can only do that if the signal was generic in the first place so
    I modified the logic so if a particular LWP was being signaled the 
    signal would be sent to that LWP even if masked.

    if (lp == NULL) {
	lp = find_lwp_for_signal(p, sig);
	if (lp && SIGISMEMBER(lp->lwp_sigmask, sig))
	     lp = NULL;
    }
    ...
    if (lp == NULL) {
	SIGADDSET(p->p_siglist, sig);
	...
    }

    I'm not 100% sure the reasoning is valid, but if not we still can't
    route any old signal to the generic process if the target LWP can't
    handle it, because some signals (e.g. like exceptions) are
    LWP-specific.

					-Matt






More information about the Commits mailing list