Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-08 Thread Vitaliy Makkoveev
On Wed, Apr 08, 2020 at 11:35:06AM +0200, Martin Pieuchot wrote: > On 08/04/20(Wed) 12:11, Vitaliy Makkoveev wrote: > > On Wed, Apr 08, 2020 at 09:51:45AM +0200, Martin Pieuchot wrote: > > [...] > > As I see (pseudo code): > > [...] > > So, I fixed this issue :) > > We fix what we see. Bugs are

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-08 Thread Martin Pieuchot
On 08/04/20(Wed) 12:11, Vitaliy Makkoveev wrote: > On Wed, Apr 08, 2020 at 09:51:45AM +0200, Martin Pieuchot wrote: > [...] > As I see (pseudo code): > [...] > So, I fixed this issue :) We fix what we see. Bugs are always in the unseen :) This mess is clearly complicated. Mixing 3 different l

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-08 Thread Vitaliy Makkoveev
On Wed, Apr 08, 2020 at 09:51:45AM +0200, Martin Pieuchot wrote: > On 07/04/20(Tue) 19:58, Vitaliy Makkoveev wrote: > > > > > > > On 7 Apr 2020, at 17:43, Martin Pieuchot wrote: > > > > > > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > > >> As Claudio Jeker noticed, NET_LOCK() can release

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-08 Thread Martin Pieuchot
On 07/04/20(Tue) 19:58, Vitaliy Makkoveev wrote: > > > > On 7 Apr 2020, at 17:43, Martin Pieuchot wrote: > > > > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > >> As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) > >> code has some NET_LOCK() dances which make it unsaf

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
> On 7 Apr 2020, at 17:43, Martin Pieuchot wrote: > > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: >> As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) >> code has some NET_LOCK() dances which make it unsafe. [...] > > The easiest way to fix that is to move if_detach

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
On Tue, Apr 07, 2020 at 06:38:11PM +0300, Vitaliy Makkoveev wrote: > On Tue, Apr 07, 2020 at 04:43:55PM +0200, Martin Pieuchot wrote: > > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > > > As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) > > > code has some NET_LOCK() dan

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
On Tue, Apr 07, 2020 at 04:43:55PM +0200, Martin Pieuchot wrote: > On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > > As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) > > code has some NET_LOCK() dances which make it unsafe. [...] > > The easiest way to fix that is to move

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
Forgot to release lock in pppx_del_session() error case... Index: sys/net/if_pppx.c === RCS file: /cvs/src/sys/net/if_pppx.c,v retrieving revision 1.81 diff -u -p -r1.81 if_pppx.c --- sys/net/if_pppx.c 7 Apr 2020 07:11:22 -

Re: pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Martin Pieuchot
On 07/04/20(Tue) 17:14, Vitaliy Makkoveev wrote: > As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) > code has some NET_LOCK() dances which make it unsafe. [...] The easiest way to fix that is to move if_detach() out of pppx_if_destroy(). It generally makes sense to call if

pppx(4): prevent concurency with pppx_if_destroy()

2020-04-07 Thread Vitaliy Makkoveev
As Claudio Jeker noticed, NET_LOCK() can release KERNEL_LOCK(). pppx(4) code has some NET_LOCK() dances which make it unsafe. Concurent thread can receive CPU and enter to pppx_if_destroy() while we dance with NET_LOCK(). The idea is to deny access to pxi at destruction stage. If pxi_if is removed