openvswitch / ovs-issues

Issue tracker repo for Open vSwitch
10 stars 3 forks source link

Windows: Adding a bridge causes ovs-vswitchd to crash #121

Closed sairamvg closed 7 years ago

sairamvg commented 7 years ago

On Windows 2012 R2 (64bit), creating a bridge causes vswitchd to crash. The error happens in wcscat_s and wcscpy_s. These functions expect the argument to be numberOfElements. The issue was with using sizeof(wchar_t_word) instead of (sizeof(wchar_t_word)/sizeof(wchar_t). This causes the program to access memory beyond the allocated buffer.

This article explains the problem in detail - http://developer.rhino3d.com/guides/cpp/using-sizeof-with-tchar-wchar-t/

Stack trace: Unhandled exception at 0x00C956CE in ovs-vswitchd.exe: 0xC0000005: Access violation writing location 0x01000000.

ovs-vswitchd.exe!memset(unsigned char dst=0x000000fe, unsigned char value='n', unsigned long count=0) Line 70 Unknown ovs-vswitchd.exe!wcscat_s(unsigned short _Dst=0x00ffe5b0, unsigned int _SizeInWords=4096, const wchar_t _Src=0x011242d0) Line 44 C ovs-vswitchd.exe!create_wmi_port(char name=0x013bdd20) Line 704 C ovs-vswitchd.exe!dpif_netlink_port_add(dpif_netlink dpif=0x014105e0, netdev netdev=0x013bdc78, unsigned int port_nop=0x0107f71c) Line 855 C ovs-vswitchd.exe!dpif_netlink_port_add(dpif dpif_=0x014105e0, netdev netdev=0x013bdc78, unsigned int port_nop=0x0107f71c) Line 937 C ovs-vswitchd.exe!dpif_port_add(dpif dpif=0x014105e0, netdev netdev=0x013bdc78, unsigned int port_nop=0x0107f740) Line 544 C ovs-vswitchd.exe!port_add(ofproto ofproto_=0x0140f610, netdev netdev=0x013bdc78) Line 3397 C ovs-vswitchd.exe!ofproto_port_add(ofproto ofproto=0x0140f610, netdev netdev=0x013bdc78, unsigned int ofp_portp=0x0107f8e8) Line 1988 C ovs-vswitchd.exe!iface_do_create(const bridge br=0x0140f200, const ovsrec_interface iface_cfg=0x0140cf00, unsigned int ofp_portp=0x0107f8e8, netdev netdevp=0x0107f8d4, char errp=0x0107f8ec) Line 1763 C ovs-vswitchd.exe!iface_create(bridge br=0x0140f200, const ovsrec_interface iface_cfg=0x0140cf00, const ovsrec_port port_cfg=0x0140d298) Line 1801 C ovs-vswitchd.exe!bridge_add_ports__(bridge br=0x0140f200, const shash wanted_ports=0x0140f274, bool with_requested_port=false) Line 912 C ovs-vswitchd.exe!bridge_add_ports(bridge br=0x0140f200, const shash wanted_ports=0x0140f274) Line 928 C ovs-vswitchd.exe!bridge_reconfigure(const ovsrec_open_vswitch ovs_cfg=0x0140dc58) Line 644 C ovs-vswitchd.exe!bridge_run() Line 2961 C ovs-vswitchd.exe!main(int argc=5, char * argv=0x013a9d10) Line 112 C ovs-vswitchd.exe!tmainCRTStartup() Line 255 C ovs-vswitchd.exe!mainCRTStartup() Line 165 C kernel32.dll!7572a534() Unknown [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!774a8f8b() Unknown ntdll.dll!774a8f61() Unknown

aserdean commented 7 years ago

Closing this issue, patch applied.