Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Mateusz Guzik
zoo.freebsd.org crashed with what appears to be the same bug, so I
went ahead and committed the fix in r368271.

On 12/1/20, Hans Petter Selasky  wrote:
> On 12/1/20 12:26 PM, Mateusz Guzik wrote:
>> Does this fix it for you?https://people.freebsd.org/~mjg/poll.diff
>
> Will take some time to reproduce. Testing right now.
>
> --HPS
>


-- 
Mateusz Guzik 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Hans Petter Selasky

On 12/1/20 12:26 PM, Mateusz Guzik wrote:

Does this fix it for you?https://people.freebsd.org/~mjg/poll.diff


Will take some time to reproduce. Testing right now.

--HPS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Mateusz Guzik
Does this fix it for you? https://people.freebsd.org/~mjg/poll.diff

On 12/1/20, Hans Petter Selasky  wrote:
> On 12/1/20 12:06 PM, Mateusz Guzik wrote:
>> I see what the bug is, will think about the right fix.
>>
>> Is this reproducible for you?
>
> Yes, I have a crash dump.
>
> --HPS
>
>


-- 
Mateusz Guzik 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Hans Petter Selasky

On 12/1/20 12:06 PM, Mateusz Guzik wrote:

I see what the bug is, will think about the right fix.

Is this reproducible for you?


Yes, I have a crash dump.

--HPS

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Mateusz Guzik
I see what the bug is, will think about the right fix.

Is this reproducible for you?

On 12/1/20, Hans Petter Selasky  wrote:
> On 11/16/20 4:12 AM, Mateusz Guzik wrote:
>> Author: mjg
>> Date: Mon Nov 16 03:12:21 2020
>> New Revision: 367714
>> URL: https://svnweb.freebsd.org/changeset/base/367714
>>
>> Log:
>>select: call seltdfini on process and thread exit
>>
>>Since thread_zone is marked NOFREE the thread_fini callback is never
>>executed, meaning memory allocated by seltdinit is never released.
>>
>>Adding the call to thread_dtor is not sufficient as exiting processes
>>cache the main thread.
>>
>> Modified:
>>head/sys/kern/kern_exit.c
>>head/sys/kern/kern_thread.c
>>
>> Modified: head/sys/kern/kern_exit.c
>> ==
>> --- head/sys/kern/kern_exit.cMon Nov 16 03:09:18 2020
>> (r367713)
>> +++ head/sys/kern/kern_exit.cMon Nov 16 03:12:21 2020
>> (r367714)
>> @@ -355,6 +355,7 @@ exit1(struct thread *td, int rval, int signo)
>>  PROC_UNLOCK(p);
>>
>>  umtx_thread_exit(td);
>> +seltdfini(td);
>>
>>  /*
>>   * Reset any sigio structures pointing to us as a result of
>>
>> Modified: head/sys/kern/kern_thread.c
>> ==
>> --- head/sys/kern/kern_thread.c  Mon Nov 16 03:09:18 2020
>> (r367713)
>> +++ head/sys/kern/kern_thread.c  Mon Nov 16 03:12:21 2020
>> (r367714)
>> @@ -329,6 +329,7 @@ thread_ctor(void *mem, int size, void *arg, int
>> flags)
>>  audit_thread_alloc(td);
>>   #endif
>>  umtx_thread_alloc(td);
>> +MPASS(td->td_sel == NULL);
>>  return (0);
>>   }
>>
>> @@ -369,6 +370,7 @@ thread_dtor(void *mem, int size, void *arg)
>>  osd_thread_exit(td);
>>  td_softdep_cleanup(td);
>>  MPASS(td->td_su == NULL);
>> +seltdfini(td);
>>   }
>>
>>   /*
>> @@ -405,7 +407,7 @@ thread_fini(void *mem, int size)
>>  turnstile_free(td->td_turnstile);
>>  sleepq_free(td->td_sleepqueue);
>>  umtx_thread_fini(td);
>> -seltdfini(td);
>> +MPASS(td->td_sel == NULL);
>>   }
>>
>>   /*
>
> Hi,
>
> The following panic() has been observed after this change:
>
> panic: Assertion mtx_unowned(m) failed at /usr/src/sys/kern/kern_mutex:1181
> cpuid = 6
> 
> panic()
> _mtx_destroy()
> seltdfini()
> exit1()
> postsig()
> ast()
> doreti_ast()
>
> --HPS
>
>


-- 
Mateusz Guzik 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Hans Petter Selasky

On 11/16/20 4:12 AM, Mateusz Guzik wrote:

Author: mjg
Date: Mon Nov 16 03:12:21 2020
New Revision: 367714
URL: https://svnweb.freebsd.org/changeset/base/367714

Log:
   select: call seltdfini on process and thread exit
   
   Since thread_zone is marked NOFREE the thread_fini callback is never

   executed, meaning memory allocated by seltdinit is never released.
   
   Adding the call to thread_dtor is not sufficient as exiting processes

   cache the main thread.

Modified:
   head/sys/kern/kern_exit.c
   head/sys/kern/kern_thread.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Mon Nov 16 03:09:18 2020(r367713)
+++ head/sys/kern/kern_exit.c   Mon Nov 16 03:12:21 2020(r367714)
@@ -355,6 +355,7 @@ exit1(struct thread *td, int rval, int signo)
PROC_UNLOCK(p);
  
  	umtx_thread_exit(td);

+   seltdfini(td);
  
  	/*

 * Reset any sigio structures pointing to us as a result of

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Mon Nov 16 03:09:18 2020(r367713)
+++ head/sys/kern/kern_thread.c Mon Nov 16 03:12:21 2020(r367714)
@@ -329,6 +329,7 @@ thread_ctor(void *mem, int size, void *arg, int flags)
audit_thread_alloc(td);
  #endif
umtx_thread_alloc(td);
+   MPASS(td->td_sel == NULL);
return (0);
  }
  
@@ -369,6 +370,7 @@ thread_dtor(void *mem, int size, void *arg)

osd_thread_exit(td);
td_softdep_cleanup(td);
MPASS(td->td_su == NULL);
+   seltdfini(td);
  }
  
  /*

@@ -405,7 +407,7 @@ thread_fini(void *mem, int size)
turnstile_free(td->td_turnstile);
sleepq_free(td->td_sleepqueue);
umtx_thread_fini(td);
-   seltdfini(td);
+   MPASS(td->td_sel == NULL);
  }
  
  /*


Hi,

The following panic() has been observed after this change:

panic: Assertion mtx_unowned(m) failed at /usr/src/sys/kern/kern_mutex:1181
cpuid = 6

panic()
_mtx_destroy()
seltdfini()
exit1()
postsig()
ast()
doreti_ast()

--HPS

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367714 - head/sys/kern

2020-11-15 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov 16 03:12:21 2020
New Revision: 367714
URL: https://svnweb.freebsd.org/changeset/base/367714

Log:
  select: call seltdfini on process and thread exit
  
  Since thread_zone is marked NOFREE the thread_fini callback is never
  executed, meaning memory allocated by seltdinit is never released.
  
  Adding the call to thread_dtor is not sufficient as exiting processes
  cache the main thread.

Modified:
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_thread.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Mon Nov 16 03:09:18 2020(r367713)
+++ head/sys/kern/kern_exit.c   Mon Nov 16 03:12:21 2020(r367714)
@@ -355,6 +355,7 @@ exit1(struct thread *td, int rval, int signo)
PROC_UNLOCK(p);
 
umtx_thread_exit(td);
+   seltdfini(td);
 
/*
 * Reset any sigio structures pointing to us as a result of

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Mon Nov 16 03:09:18 2020(r367713)
+++ head/sys/kern/kern_thread.c Mon Nov 16 03:12:21 2020(r367714)
@@ -329,6 +329,7 @@ thread_ctor(void *mem, int size, void *arg, int flags)
audit_thread_alloc(td);
 #endif
umtx_thread_alloc(td);
+   MPASS(td->td_sel == NULL);
return (0);
 }
 
@@ -369,6 +370,7 @@ thread_dtor(void *mem, int size, void *arg)
osd_thread_exit(td);
td_softdep_cleanup(td);
MPASS(td->td_su == NULL);
+   seltdfini(td);
 }
 
 /*
@@ -405,7 +407,7 @@ thread_fini(void *mem, int size)
turnstile_free(td->td_turnstile);
sleepq_free(td->td_sleepqueue);
umtx_thread_fini(td);
-   seltdfini(td);
+   MPASS(td->td_sel == NULL);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"