]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r258574:
authortuexen <tuexen@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 3 Dec 2013 20:55:37 +0000 (20:55 +0000)
committertuexen <tuexen@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 3 Dec 2013 20:55:37 +0000 (20:55 +0000)
commit1cd1ff0d8f369f134641079bc45ca75f0b294f44
tree0d3244857217cbf34086511a8f7d41df47069e83
parentfabf22f90a3f9033d6bb557e1274ed64278d264f
MFC r258574:

Only initialize some mutexes for the default VNET.

In r208160, sctp_it_ctl was made a global variable, across all VNETs.
However, sctp_init() is called for every VNET that is created.  This results
in the same global mutexes which are part of sctp_it_ctl being initialized.  This can result
in crashes if many jails are created.

To reproduce the problem:
  (1)  Take a GENERIC kernel config, and add options for: VIMAGE, WITNESS,
       INVARIANTS.
  (2)  Run this command in a loop:
       jail -l -u root -c path=/ name=foo persist vnet && jexec foo ifconfig lo0 127.0.0.1/8 && jail -r foo

       (see http://lists.freebsd.org/pipermail/freebsd-current/2010-November/021280.html )

Witness will warn about the same mutex being initialized.

Fix the problem by only initializing these mutexes in the default VNET.

MFC r258765:

In
http://svnweb.freebsd.org/changeset/base/258221
I introduced a bug which initialized global locks
whenever the SCTP stack initialized. This was fixed in
http://svnweb.freebsd.org/changeset/base/258574
by rodrigc@. He just initialized the locks for
the default vnet. This fix reverts to the old
behaviour before r258221, which explicitly makes
sure it is only called once, because this works also on
other platforms.

Approved by: re@ (gjb)

git-svn-id: svn://svn.freebsd.org/base/stable/10@258890 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/netinet/sctp_bsd_addr.c
sys/netinet/sctp_pcb.c