Stefan Sperling <[email protected]> writes:

> On Sun, Apr 16, 2017 at 05:06:20PM +0200, Stefan Sperling wrote:
>> On Sun, Apr 16, 2017 at 04:26:51PM +0200, Stefan Sperling wrote:
>> > An openvpn server running on OpenBSD/sparc64 6.1 crashes when a client
>> > connects and starts doing traffic. Is anyone else seeing this?
>> > 
>> > (gdb) run
>> > Starting program: /usr/local/sbin/openvpn /etc/openvpn/server.conf
>> > (no debugging symbols found)
>> > 
>> > Program received signal SIGBUS, Bus error.
>> > 0x000000a99df82664 in write_tun_header () from /usr/local/sbin/openvpn
>> > (gdb) bt
>> > #0  0x000000a99df82664 in write_tun_header () from /usr/local/sbin/openvpn
>> > #1  0x000000a99df136d4 in process_outgoing_tun () from 
>> > /usr/local/sbin/openvpn
>> > #2  0x000000a99df31094 in tunnel_server_udp () from /usr/local/sbin/openvpn
>> > #3  0x000000a99df3a6ac in main () from /usr/local/sbin/openvpn
>> > 
>> 
>> The happens because of a cast from an unaligned u_int8_t * to struct ip *.
>> The diff below fixes the crash. This fix exploits the fact that this code
>> is just looking for the IP header version, which will always sit in the
>> first nibble of the buffer.
>> 
>> Alternatives would be a memcpy() to a local struct ip (less efficient),
>> or making sure that the buffer pointer is always aligned (more effort
>> and larger diff).
>> 
>> Is this ok as a quick fix?
>  
> Ignore my previous diff. It breaks inet6 across the VPN.
> Obviously I am not smarter than memcpy() so let's just use that.

It seems that other platforms could be affected, so an upstream fix
would probably involve more changes.  ok jca@ for your diff.  I can try
to bring this up upstream next week, unless you want to do so.

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to