Re: panic when using tun(4) with openvpn on current

2015-04-16 Thread Remi Locherer
On Wed, Apr 15, 2015 at 11:32:56AM +0200, Martin Pieuchot wrote:
 On 14/04/15(Tue) 22:49, Remi Locherer wrote:
  Synopsis:  panic when using tun(4) with openvpn on current
  Category:  kernel
  Environment:
  System  : OpenBSD 5.7
  Details : OpenBSD 5.7-current (GENERIC.MP) #919: Mon Apr 13 
  21:03:43 MDT 2015
   
  dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
  
  Architecture: OpenBSD.amd64
  Machine : amd64
  
  Description:
  
  I use openvpn which sets up a tun(4) interface. As soon as I start
  using the vpn (eg. with Firefox or lynx) the system panics.
 
 Thanks for the report, could you tell me if the fix below fix this
 regression?
 

I can now confirm that this patch fixes the panic.
Thank you for looking into this!

Remi

 
 Index: net/if_tun.c
 ===
 RCS file: /cvs/src/sys/net/if_tun.c,v
 retrieving revision 1.136
 diff -u -p -r1.136 if_tun.c
 --- net/if_tun.c  10 Apr 2015 13:58:20 -  1.136
 +++ net/if_tun.c  15 Apr 2015 09:29:52 -
 @@ -897,7 +897,7 @@ tunwrite(dev_t dev, struct uio *uio, int
   return (EAFNOSUPPORT);
   }
  
 - if (niq_enqueue(ifq, m) != 0) {
 + if (niq_enqueue(ifq, top) != 0) {
   ifp-if_collisions++;
   return (ENOBUFS);
   }
 



Re: panic when using tun(4) with openvpn on current

2015-04-15 Thread Martin Pieuchot
On 14/04/15(Tue) 22:49, Remi Locherer wrote:
 Synopsis:panic when using tun(4) with openvpn on current
 Category:kernel
 Environment:
   System  : OpenBSD 5.7
   Details : OpenBSD 5.7-current (GENERIC.MP) #919: Mon Apr 13 
 21:03:43 MDT 2015

 dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
 
   Architecture: OpenBSD.amd64
   Machine : amd64
 
 Description:
 
   I use openvpn which sets up a tun(4) interface. As soon as I start
   using the vpn (eg. with Firefox or lynx) the system panics.

Thanks for the report, could you tell me if the fix below fix this
regression?


Index: net/if_tun.c
===
RCS file: /cvs/src/sys/net/if_tun.c,v
retrieving revision 1.136
diff -u -p -r1.136 if_tun.c
--- net/if_tun.c10 Apr 2015 13:58:20 -  1.136
+++ net/if_tun.c15 Apr 2015 09:29:52 -
@@ -897,7 +897,7 @@ tunwrite(dev_t dev, struct uio *uio, int
return (EAFNOSUPPORT);
}
 
-   if (niq_enqueue(ifq, m) != 0) {
+   if (niq_enqueue(ifq, top) != 0) {
ifp-if_collisions++;
return (ENOBUFS);
}



panic when using tun(4) with openvpn on current

2015-04-14 Thread Remi Locherer
Synopsis:  panic when using tun(4) with openvpn on current
Category:  kernel
Environment:
System  : OpenBSD 5.7
Details : OpenBSD 5.7-current (GENERIC.MP) #919: Mon Apr 13 
21:03:43 MDT 2015
 
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

Architecture: OpenBSD.amd64
Machine : amd64

Description:

I use openvpn which sets up a tun(4) interface. As soon as I start
using the vpn (eg. with Firefox or lynx) the system panics.

A trace from cpu3 in ddb showed this:

ddb{3} trace
Debugger() at Debugger+0x9
panic() at panic+0xfe
ipintr() at ipintr+0x3f
netintr() at netintr+0x85
softintr_dispatch() at softintr_dispatch+0x7f
Xsoftnet() at Xsoftnet+0x2d
--- interrupt ---
end trace frame: 0x0, count: -6
__ALLIGN_SIZE+0x1801:
ddb{3}

Pictures from ddb:
ps (part 1): https://relo.ch/tun-panic-ps1.jpg
ps (part 2): https://relo.ch/tun-panic-ps2.jpg
trace from all 4 cpus: https://relo.ch/tun-panic-trace.jpg

I first noticed it while running the snapshot from April 11.

After I start openvpn the active network configuration looks
like this:

# ifconfig
lo0: flags=8049UP,LOOPBACK,RUNNING,MULTICAST mtu 32768
priority: 0
groups: lo
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff00
re0: flags=8802BROADCAST,SIMPLEX,MULTICAST mtu 1500
lladdr 18:67:b0:3e:b4:8f
priority: 0
media: Ethernet autoselect (none)
status: no carrier
enc0: flags=0
priority: 0
groups: enc
status: active
urtwn0: flags=208843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF6 mtu 1500
lladdr 80:1f:02:da:13:e3
priority: 4
groups: wlan egress
media: IEEE802.11 autoselect (OFDM54 mode 11g)
status: active
ieee80211: nwid tsunami chan 6 bssid 4c:9e:ff:90:d8:c0 -82dBm wpakey 
not displayed wpaprotos wpa1,wpa2 wpaakms psk wpaciphers tkip,ccmp 
wpagroupcipher tkip
inet6 fe80::821f:2ff:feda:13e3%urtwn0 prefixlen 64 scopeid 0x4
inet6 2001:470:b70c:0:821f:2ff:feda:13e3 prefixlen 64 autoconf pltime 
604778 vltime 2591978
inet6 2001:470:b70c:0:846b:a4cc:8aa:5a1e prefixlen 64 autoconf 
autoconfprivacy pltime 85961 vltime 604590
inet 192.168.201.25 netmask 0xff00 broadcast 192.168.201.255
pflog0: flags=141UP,RUNNING,PROMISC mtu 33144
priority: 0
groups: pflog
tun1: flags=8051UP,POINTOPOINT,RUNNING,MULTICAST mtu 1500
priority: 0
groups: tun
status: active
inet 172.19.3.65 -- 172.19.3.66 netmask 0x

# route -n show

Routing tables

Internet:
DestinationGatewayFlags   Refs  Use   Mtu  Prio Iface
default192.168.201.1  UGS8  586 -12 urtwn0
127/8  127.0.0.1  UGRS   00 32768 8 lo0  
127.0.0.1  127.0.0.1  UHl10 32768 1 lo0  
172.16/16  172.19.3.66UGS00 - 8 tun1 
172.17/16  172.19.3.66UGS00 - 8 tun1 
172.18/16  172.19.3.66UGS00 - 8 tun1 
172.19/16  172.19.3.66UGS00 - 8 tun1 
172.19.3.65172.19.3.65UHl00 - 1 lo0  
172.19.3.66172.19.3.65UH100 - 4 tun1 
172.20/16  172.19.3.66UGS00 - 8 tun1 
192.168.7/24   172.19.3.66UGS00 - 8 tun1 
192.168.26/24  172.19.3.66UGS00 - 8 tun1 
192.168.32/24  172.19.3.66UGS00 - 8 tun1 
192.168.33/24  172.19.3.66UGS00 - 8 tun1 
192.168.101/24 172.19.3.66UGS00 - 8 tun1 
192.168.201/24 link#4 UC 20 - 4 urtwn0
192.168.201.1  00:0d:b9:32:fa:18  UHLc   1   28 - 4 urtwn0
192.168.201.20 84:7a:88:07:3f:30  UHLc   0 2295 - 4 urtwn0
192.168.201.25 80:1f:02:da:13:e3  UHLl   00 - 1 lo0  
192.168.201.255link#4 UHLb   00 - 1 urtwn0
224/4  127.0.0.1  URS00 32768 8 lo0  

Internet6:
DestinationGatewayFlags   Refs  
Use   Mtu  Prio Iface
::/104 ::1UGRS   0  
  0 32768 8 lo0  
::/96  ::1UGRS   0  
  0 32768 8 lo0  
defaultfe80::20d:b9ff:fe32:fa18%urtwn0 UG 0