Re: splassert: vlan_ioctl: want 2 have 0

2022-08-09 Thread Vitaliy Makkoveev
On Tue, Aug 09, 2022 at 06:58:05PM +0200, Hrvoje Popovski wrote:
> Hi all,
> 
> I've sysupgrade firewall from
> OpenBSD 7.2-beta (GENERIC.MP) #651: Tue Jul 26 23:11:26 MDT 2022
> to
> OpenBSD 7.2-beta (GENERIC.MP) #677: Mon Aug  8 18:58:49 MDT 2022
> 
> and on console there was lot's of spalassert like below. I'm having ix,
> aggr and vlan on that firewall
> 
> 
> splassert: vlan_ioctl: want 2 have 0
> Starting stack trace...
> vlan_ioctl(80d55800,c0406938,800020ccfe20) at vlan_ioctl+0x64
> ifioctl(fd887d7fdc78,c0406938,800020ccfe20,800020cac550) at
> ifioctl+0xc40
> soo_ioctl(fd887c7dd7f8,c0406938,800020ccfe20,800020cac550)
> at soo_ioctl+0x161
> sys_ioctl(800020cac550,800020ccff30,800020ccff90) at
> sys_ioctl+0x2c4
> syscall(800020cd) at syscall+0x384
> Xsyscall() at Xsyscall+0x128
> end of kernel
> end trace frame: 0x7f7c3da0, count: 251
> End of stack trace.
> 

Now (*if_ioctl)() called without netlock for SIOC{G.S}IFMEDIA commands.

So remove the assertion and be like all other pseudo interfaces?

Index: sys/net/if_vlan.c
===
RCS file: /cvs/src/sys/net/if_vlan.c,v
retrieving revision 1.209
diff -u -p -r1.209 if_vlan.c
--- sys/net/if_vlan.c   30 Aug 2021 14:44:39 -  1.209
+++ sys/net/if_vlan.c   9 Aug 2022 17:47:48 -
@@ -676,7 +676,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
uint16_t tag;
int error = 0;
 
-   NET_ASSERT_LOCKED();
if (sc->sc_dead)
return (ENXIO);
 

Or be conservative, and drop it for SIOC{S,G}IFMEDIA only? I
intentionally left SIOCSIFMEDIA case in the original switch(cmd) block.

Index: sys/net/if_vlan.c
===
RCS file: /cvs/src/sys/net/if_vlan.c,v
retrieving revision 1.209
diff -u -p -r1.209 if_vlan.c
--- sys/net/if_vlan.c   30 Aug 2021 14:44:39 -  1.209
+++ sys/net/if_vlan.c   9 Aug 2022 17:40:12 -
@@ -676,7 +676,15 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
uint16_t tag;
int error = 0;
 
-   NET_ASSERT_LOCKED();
+   switch (cmd) {
+   case SIOCGIFMEDIA:
+   case SIOCSIFMEDIA:
+   break;
+   default:
+   NET_ASSERT_LOCKED();
+   break;
+   }
+
if (sc->sc_dead)
return (ENXIO);
 



splassert: vlan_ioctl: want 2 have 0

2022-08-09 Thread Hrvoje Popovski
Hi all,

I've sysupgrade firewall from
OpenBSD 7.2-beta (GENERIC.MP) #651: Tue Jul 26 23:11:26 MDT 2022
to
OpenBSD 7.2-beta (GENERIC.MP) #677: Mon Aug  8 18:58:49 MDT 2022

and on console there was lot's of spalassert like below. I'm having ix,
aggr and vlan on that firewall


splassert: vlan_ioctl: want 2 have 0
Starting stack trace...
vlan_ioctl(80d55800,c0406938,800020ccfe20) at vlan_ioctl+0x64
ifioctl(fd887d7fdc78,c0406938,800020ccfe20,800020cac550) at
ifioctl+0xc40
soo_ioctl(fd887c7dd7f8,c0406938,800020ccfe20,800020cac550)
at soo_ioctl+0x161
sys_ioctl(800020cac550,800020ccff30,800020ccff90) at
sys_ioctl+0x2c4
syscall(800020cd) at syscall+0x384
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7c3da0, count: 251
End of stack trace.