Re: fix races in if_clone_create()

2020-07-13 Thread Vitaliy Makkoveev
On Mon, Jul 13, 2020 at 12:52:15PM +0300, Vitaliy Makkoveev wrote: > On Mon, Jul 13, 2020 at 09:53:44AM +0200, Martin Pieuchot wrote: > > On 06/07/20(Mon) 15:44, Vitaliy Makkoveev wrote: > > > > On 6 Jul 2020, at 12:17, Martin Pieuchot wrote: > > > > Assertions and documentation are more important

Re: fix races in if_clone_create()

2020-07-13 Thread Vitaliy Makkoveev
On Mon, Jul 13, 2020 at 09:53:44AM +0200, Martin Pieuchot wrote: > On 06/07/20(Mon) 15:44, Vitaliy Makkoveev wrote: > > > On 6 Jul 2020, at 12:17, Martin Pieuchot wrote: > > > Assertions and documentation are more important than preventing races > > > because they allow to build awareness and eleg

Re: fix races in if_clone_create()

2020-07-13 Thread Martin Pieuchot
On 06/07/20(Mon) 15:44, Vitaliy Makkoveev wrote: > > On 6 Jul 2020, at 12:17, Martin Pieuchot wrote: > > Assertions and documentation are more important than preventing races > > because they allow to build awareness and elegant solutions instead of > > hacking diffs until stuff work without knowi

Re: fix races in if_clone_create()

2020-07-06 Thread Vitaliy Makkoveev
> On 6 Jul 2020, at 12:17, Martin Pieuchot wrote: > > On 01/07/20(Wed) 00:02, Vitaliy Makkoveev wrote: >> On Tue, Jun 30, 2020 at 03:48:22PM +0300, Vitaliy Makkoveev wrote: >>> On Tue, Jun 30, 2020 at 12:08:03PM +0200, Martin Pieuchot wrote: On 29/06/20(Mon) 11:59, Vitaliy Makkoveev wrote

Re: fix races in if_clone_create()

2020-07-06 Thread Martin Pieuchot
On 01/07/20(Wed) 00:02, Vitaliy Makkoveev wrote: > On Tue, Jun 30, 2020 at 03:48:22PM +0300, Vitaliy Makkoveev wrote: > > On Tue, Jun 30, 2020 at 12:08:03PM +0200, Martin Pieuchot wrote: > > > On 29/06/20(Mon) 11:59, Vitaliy Makkoveev wrote: > > > > [...] > > > > I reworked tool for reproduce. Now

Re: fix races in if_clone_create()

2020-07-03 Thread Vitaliy Makkoveev
ping? > On 1 Jul 2020, at 00:02, Vitaliy Makkoveev wrote: > > On Tue, Jun 30, 2020 at 03:48:22PM +0300, Vitaliy Makkoveev wrote: >> On Tue, Jun 30, 2020 at 12:08:03PM +0200, Martin Pieuchot wrote: >>> On 29/06/20(Mon) 11:59, Vitaliy Makkoveev wrote: [...] I reworked tool for reproduce

Re: fix races in if_clone_create()

2020-06-30 Thread Vitaliy Makkoveev
On Tue, Jun 30, 2020 at 03:48:22PM +0300, Vitaliy Makkoveev wrote: > On Tue, Jun 30, 2020 at 12:08:03PM +0200, Martin Pieuchot wrote: > > On 29/06/20(Mon) 11:59, Vitaliy Makkoveev wrote: > > > [...] > > > I reworked tool for reproduce. Now I avoided fork()/exec() route and it > > > takes couple of

Re: fix races in if_clone_create()

2020-06-30 Thread Vitaliy Makkoveev
On Tue, Jun 30, 2020 at 12:08:03PM +0200, Martin Pieuchot wrote: > On 29/06/20(Mon) 11:59, Vitaliy Makkoveev wrote: > > [...] > > I reworked tool for reproduce. Now I avoided fork()/exec() route and it > > takes couple of minutes to take panic on 4 cores. Also some screenshots > > attached. > > S

Re: fix races in if_clone_create()

2020-06-30 Thread Martin Pieuchot
On 29/06/20(Mon) 11:59, Vitaliy Makkoveev wrote: > [...] > I reworked tool for reproduce. Now I avoided fork()/exec() route and it > takes couple of minutes to take panic on 4 cores. Also some screenshots > attached. Setting kern.pool_debug=2 makes the race reproducible in seconds. Could you tur

Re: fix races in if_clone_create()

2020-06-29 Thread Vitaliy Makkoveev
On Mon, Jun 29, 2020 at 04:27:50PM +0200, Hrvoje Popovski wrote: > On 29.6.2020. 10:59, Vitaliy Makkoveev wrote: > > I reworked tool for reproduce. Now I avoided fork()/exec() route and it > > takes couple of minutes to take panic on 4 cores. Also some screenshots > > attached. > > > > I hope anyo

Re: fix races in if_clone_create()

2020-06-29 Thread Vitaliy Makkoveev
On Sat, Jun 27, 2020 at 12:10:24PM +0200, Martin Pieuchot wrote: > On 27/06/20(Sat) 00:35, Vitaliy Makkoveev wrote: > > On Fri, Jun 26, 2020 at 09:12:16PM +0200, Martin Pieuchot wrote: > > > On 26/06/20(Fri) 16:56, Vitaliy Makkoveev wrote: > > > > if_clone_create() has the races caused by context s

Re: fix races in if_clone_create()

2020-06-29 Thread Vitaliy Makkoveev
screenshot

Re: fix races in if_clone_create()

2020-06-29 Thread Vitaliy Makkoveev
On Sat, Jun 27, 2020 at 12:10:24PM +0200, Martin Pieuchot wrote: > On 27/06/20(Sat) 00:35, Vitaliy Makkoveev wrote: > > On Fri, Jun 26, 2020 at 09:12:16PM +0200, Martin Pieuchot wrote: > > > On 26/06/20(Fri) 16:56, Vitaliy Makkoveev wrote: > > > > if_clone_create() has the races caused by context s

Re: fix races in if_clone_create()

2020-06-29 Thread Hrvoje Popovski
On 29.6.2020. 10:59, Vitaliy Makkoveev wrote: > I reworked tool for reproduce. Now I avoided fork()/exec() route and it > takes couple of minutes to take panic on 4 cores. Also some screenshots > attached. > > I hope anyone else will try it. Hi, i'm getting panic quite fast :) i will leave box i

Re: fix races in if_clone_create()

2020-06-27 Thread Vitaliy Makkoveev
On Sat, Jun 27, 2020 at 12:10:24PM +0200, Martin Pieuchot wrote: > On 27/06/20(Sat) 00:35, Vitaliy Makkoveev wrote: > > On Fri, Jun 26, 2020 at 09:12:16PM +0200, Martin Pieuchot wrote: > > > On 26/06/20(Fri) 16:56, Vitaliy Makkoveev wrote: > > > > if_clone_create() has the races caused by context s

Re: fix races in if_clone_create()

2020-06-27 Thread Martin Pieuchot
On 27/06/20(Sat) 00:35, Vitaliy Makkoveev wrote: > On Fri, Jun 26, 2020 at 09:12:16PM +0200, Martin Pieuchot wrote: > > On 26/06/20(Fri) 16:56, Vitaliy Makkoveev wrote: > > > if_clone_create() has the races caused by context switch. > > > > Can you share a backtrace of such race? Where does the k

Re: fix races in if_clone_create()

2020-06-26 Thread Vitaliy Makkoveev
On Fri, Jun 26, 2020 at 09:12:16PM +0200, Martin Pieuchot wrote: > On 26/06/20(Fri) 16:56, Vitaliy Makkoveev wrote: > > if_clone_create() has the races caused by context switch. > > Can you share a backtrace of such race? Where does the kernel panic? > This diff was inspired by thread [1]. As I

Re: fix races in if_clone_create()

2020-06-26 Thread Vitaliy Makkoveev
Sorry, I found a memory leak. Updated diff below. Index: sys/net/if.c === RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.610 diff -u -p -r1.610 if.c --- sys/net/if.c22 Jun 2020 09:45:13 - 1.610 +++ sys/net/if

Re: fix races in if_clone_create()

2020-06-26 Thread Martin Pieuchot
On 26/06/20(Fri) 16:56, Vitaliy Makkoveev wrote: > if_clone_create() has the races caused by context switch. Can you share a backtrace of such race? Where does the kernel panic?

fix races in if_clone_create()

2020-06-26 Thread Vitaliy Makkoveev
if_clone_create() has the races caused by context switch. cut begin if_clone_create(const char *name, int rdomain) { struct if_clone *ifc; struct ifnet *ifp; int unit, ret; ifc = if_clone_lookup(name, &unit); /* [1] */ if (ifc == NULL)