Other lock order bug in 14.0-ALPHA1 while pppoe

I make the FreeBSD 14.0-ALPHA1 box act as the nat gateway for my ADSL at home.
It seems a lock order bug cause the network interface down and up ?

ppp.conf
Code:
default:
 set log Phase Chat LCP IPCP CCP tun command
 set device PPPoE:igb0
 set authname username
 set authkey passwd
 add default HISADDR
 enable lqr
 enable dns
 set mru 1492

rc.conf
Code:
ppp_enable="YES"
ppp_program="/usr/sbin/ppp"     # Path to user-ppp program.
ppp_mode="auto"         # Choice of "auto", "ddial", "direct" or "dedicated".
ppp_nat="YES"           # Use PPP's internal network address translation or NO.
ppp_profile="default"   # Which profile to use from /etc/ppp/ppp.conf.
log
Code:
root@FBSD14 /root # dmesg
tun0: link state changed to DOWN
tun0: link state changed to UP
lock order reversal: (sleepable after non-sleepable)
 1st 0xfffff8000c25c088 tun_mtx (tun_mtx, sleep mutex) @ /usr/src/sys/net/if_tuntap.c:1602
 2nd 0xffffffff81a940d8 tun_ioctl (tun_ioctl, sx) @ /usr/src/sys/net/if_tuntap.c:1300
lock order tun_ioctl -> tun_mtx established at:
#0 0xffffffff80bbfd9a at witness_checkorder+0x30a
#1 0xffffffff80b27885 at __mtx_lock_flags+0x95
#2 0xffffffff80c8df48 at tuninit+0x48
#3 0xffffffff80c8d640 at tunifioctl+0x70
#4 0xffffffff80d6bed6 at in6_update_ifa+0x816
#5 0xffffffff80d6b01f at in6_addifaddr+0x2f
#6 0xffffffff80d6af00 at in6_control_ioctl+0x8f0
#7 0xffffffff80c7ec70 at ifioctl+0x940
#8 0xffffffff80bc6366 at kern_ioctl+0x286
#9 0xffffffff80bc6072 at sys_ioctl+0x152
#10 0xffffffff8104a398 at amd64_syscall+0x138
#11 0xffffffff8101c35b at fast_syscall_common+0xf8
lock order tun_mtx -> tun_ioctl attempted at:
#0 0xffffffff80bc064e at witness_checkorder+0xbbe
#1 0xffffffff80b58440 at _sx_xlock+0x60
#2 0xffffffff80c8d601 at tunifioctl+0x31
#3 0xffffffff80c7cb9f at ifhwioctl+0x80f
#4 0xffffffff80c8c476 at tunioctl+0x616
#5 0xffffffff809d6de2 at devfs_ioctl+0xd2
#6 0xffffffff80c59182 at vn_ioctl+0xc2
#7 0xffffffff809d74be at devfs_ioctl_f+0x1e
#8 0xffffffff80bc6366 at kern_ioctl+0x286
#9 0xffffffff80bc6072 at sys_ioctl+0x152
#10 0xffffffff8104a398 at amd64_syscall+0x138
#11 0xffffffff8101c35b at fast_syscall_common+0xf8
tun1: link state changed to UP
igb1: link state changed to DOWN
igb1: link state changed to UP
igb1: link state changed to DOWN
igb1: link state changed to UP

/usr/src/sys/net/if_tuntap.c:1602
Code:
1592         switch (cmd) {
1593         case TUNGIFNAME:
1594                 ifrp = (struct ifreq *)data;
1595                 strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ);
1596 
1597                 return (0);
1598         case TUNSIFINFO:
1599                 tunp = (struct tuninfo *)data;
1600                 if (TUN2IFP(tp)->if_type != tunp->type)
1601                         return (EPROTOTYPE);
1602                 TUN_LOCK(tp);
1603                 if (TUN2IFP(tp)->if_mtu != tunp->mtu) {
1604                         strlcpy(ifr.ifr_name, if_name(TUN2IFP(tp)), IFNAMSIZ);
1605                         ifr.ifr_mtu = tunp->mtu;
1606                         CURVNET_SET(TUN2IFP(tp)->if_vnet);
1607                         error = ifhwioctl(SIOCSIFMTU, TUN2IFP(tp),
1608                             (caddr_t)&ifr, td);
1609                         CURVNET_RESTORE();
1610                         if (error) {
1611                                 TUN_UNLOCK(tp);
1612                                 return (error);
1613                         }
1614                 }
1615                 TUN2IFP(tp)->if_baudrate = tunp->baudrate;
1616                 TUN_UNLOCK(tp);
1617                 break;


/usr/src/sys/net/if_tuntap.c:1300
Code:
1286 /*         
1287  * Process an ioctl request.
1288  */
1289 static int
1290 tunifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
1291 {  
1292         struct ifreq *ifr = (struct ifreq *)data;
1293         struct tuntap_softc *tp;
1294         struct ifstat *ifs;
1295         struct ifmediareq       *ifmr;
1296         int             dummy, error = 0;
1297         bool            l2tun;
1298            
1299         ifmr = NULL;
1300         sx_xlock(&tun_ioctl_sx);
1301         tp = ifp->if_softc;
1302         if (tp == NULL) {
1303                 error = ENXIO;
1304                 goto bad;
1305         }          
1306         l2tun = (tp->tun_flags & TUN_L2) != 0;
1307         switch(cmd) {
1308         case SIOCGIFSTATUS:
1309                 ifs = (struct ifstat *)data;
1310                 TUN_LOCK(tp);
1311                 if (tp->tun_pid)
1312                         snprintf(ifs->ascii, sizeof(ifs->ascii),
1313                             "\tOpened by PID %d\n", tp->tun_pid);
1314                 else
1315                         ifs->ascii[0] = '\0';
1316                 TUN_UNLOCK(tp);
1317                 break;
 
FreeBSD 14.0-ALPHA1
I know I may sound pedantic but this is still the main (aka -CURRENT) branch and thus not supported here. When the stable/14 branch is created, closely followed by the releng/14.0 branch, is it considered a supported version.

Report your issues on the current mailinglist. Or submit a PR. So it be can fixed before the actual release.
 
I was able to see the error when I used this FreeBSD 14 Snapshot on Rock64 eMMC.
Nice to see the error I knew was there. Witness helps so much.

usr/src/sys/dev/mmc/host/dwmmc.c:360
 
Back
Top