On Wed, Nov 30, 2022 at 02:02:03AM +0300, Vitaliy Makkoveev wrote:
> On Mon, Nov 28, 2022 at 08:38:02PM +0300, Vitaliy Makkoveev wrote:
> > Subj.
> > 
> > At sockets layer we touch only per-socket data, which is solock()
> > protected().
> > 
> > At protocol layer, unix(4) and key management sockets have no
> > (*pr_ctloutput)() handlers. route_ctloutput() touches only per socket
> > data, which is solock() protected. inet{,6} globals are protected by
> > netlock, which is solock() backend for corresponding sockets.
> > 
> 
> Since getsockopt(2) and setsockopt(2) both follow the same
> (*pr_ctloutput)() handlers, it makes sense to unlock them both.

The scariest part is multicast forwarding.  ip_mforward() is called
with shared netlock and kernel lock from ip_input().  The kernel
lock is needed as multicast is not MP safe yet and forwarding changes
multicast data.

As long setsockopt(2) runs with exlusive netlock, kernel lock is
not necessary.

OK bluhm@

Reply via email to