panic caused by EVFILT_SIGNAL detaching in rfork()ed thread

Uwe Doering gemini at geminix.org
Sat Oct 23 07:54:44 PDT 2004


Uwe Doering wrote:
> Igor Sysoev wrote:
> 
>> Here is more correct patch to fix the panic in 4.x reported in
>> http://freebsd.rambler.ru/bsdmail/freebsd-hackers_2004/msg02732.html
>>
>> -------------------------
>> --- src/sys/kern/kern_event.c   Sun Oct 10 12:17:55 2004
>> +++ src/sys/kern/kern_event.c   Sun Oct 10 12:19:29 2004
>> @@ -794,7 +794,8 @@
>>             while (kn != NULL) {
>>                 kn0 = SLIST_NEXT(kn, kn_link);
>>                 if (kq == kn->kn_kq) {
>> -                   kn->kn_fop->f_detach(kn);
>> +                   if (!(kn->kn_status & KN_DETACHED))
>> +                       kn->kn_fop->f_detach(kn);
>>         /* XXX non-fd release of kn->kn_ptr */
>>                     knote_free(kn);
>>                     *knp = kn0;
>> -------------------------
> 
> 
> Your patch appears to be an excerpt from the fix to RELENG_5.  May I 
> suggest a different approach for RELENG_4?  My reasoning is that the 
> implementation of kevents differs between RELENG_4 and RELENG_5.
> 
> In RELENG_5 the flag KN_DETACHED is used in a more general way.  It gets 
> set by knlist_add() and cleared by knlist_remove(), in sync with list 
> insertion and removal.
> [...]

Slight correction: The logic is of course the other way round.  That is, 
the text is supposed to read:

   It gets cleared by knlist_add() and set by knlist_remove() ...

Sorry about that. :-)

    Uwe
-- 
Uwe Doering         |  EscapeBox - Managed On-Demand UNIX Servers
gemini at geminix.org  |  http://www.escapebox.net


More information about the freebsd-stable mailing list