Subject: Re: SIGTRAP for traced processes and COMPAT_MACH
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Emmanuel Dreyfus <>
List: tech-kern
Date: 11/27/2003 23:52:05
> If you mean to unmask them and leave them that way, it seems to me that
> that will break signal semantics for Darwin emulation (since presumably
> Darwin won't deliver the signal when it's sent as a signal, eg with
> whatever Darwin's kill(2)-alike is).

Yes, that's the problem: Mach exceptions ignore the signal mask, but if
no exception port was set to catch an exeption, then a signal is
delivered, and this signal should respect the signal mask. Therefore
alowing anything in the signal mask is not the solution.

Let's imagine we don't touch the numerous psignal() that are everywhere
in the kernel. What about adding an emulation flag? EMUL_NEED_TRAPSIGNAL
could be checked in psignal(), and call trapsignal() from there if the
emulation needs that. It costs only one test for the native code path.

if (p->p_emul->e_flags & EMUL_NEED_TRAPSIGNAL) {
        ksiginfo_t ksi; 
        ksi.ksi_signo = signo;
        (*p->p_emul->e_trapsignal)(l, &ksi);

But I don't like this very much. KNOTE may be another solution, but we
still need to block the normal signal delivery, so that a signal is not
sent if there is a Mach exception generated. So this still needs some
kind of test in psignal() to inhibit signal delivery when appropriate.

I'm running out of good ideas. Anyone has a good idea?
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.