Connman crashing after reading empty file

Jukka Rissanen jukka.rissanen at linux.intel.com
Wed Nov 7 00:13:26 PST 2012


Hi Felipe,

On 07.11.2012 04:56, Felipe Tonello wrote:
> Guys,
>
> I'm having this problem very often, I don't know why a wifi setup file
> is been created empty and the next time I boot my device (run connman)
> connman crashes.
> I tested with 1.8 and 1.9, still crashing.

I tried to reproduce this but my connman did not crash if I made the 
settings file empty, perhaps this depends on version of glib.
Anyway, the fix is very easy so I will send a patch for this one.

Cheers,
Jukka


>
> Here is some output from valgrind:
>
> ==2116== Memcheck, a memory error detector
> ==2116== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
> ==2116== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
> ==2116== Command: connmand -n -I eth0 -d
> ==2116==
> connmand[2116]: Connection Manager version 1.8
> connmand[2116]: src/dbus.c:__connman_dbus_init()
> connmand[2116]: src/main.c:parse_config() parsing main.conf
> connmand[2116]: src/storage.c:storage_load() Loading /var/lib/connman/settings
> connmand[2116]: src/technology.c:__connman_technology_init()
> connmand[2116]: src/storage.c:storage_load() Loading /var/lib/connman/settings
> connmand[2116]: src/storage.c:storage_load() Loading /var/lib/connman/settings
> connmand[2116]: src/notifier.c:__connman_notifier_init()
> connmand[2116]: src/service.c:__connman_service_init()
> connmand[2116]: src/storage.c:storage_load() Loading
> /var/lib/connman/wifi_001234a58f4e_70726f6e746f37_managed_psk/settings
> connmand[2116]: src/storage.c:storage_load() Loading
> /var/lib/connman/wifi_001234a34052_74656d70_managed_none/settings
> connmand[2116]: src/storage.c:storage_load() Loading
> /var/lib/connman/wifi_0012348f1c9c_4732_managed_psk/settings
> connmand[2116]: src/storage.c:storage_load() Unable to load
> /var/lib/connman/wifi_0012348f1c9c_4732_managed_psk/settings: File is
> empty
> connmand[2116]: src/storage.c:storage_load() Loading
> /var/lib/connman/wifi_0012346cbc8e_444c494e4b2d5037_managed_none/settings
> connmand[2116]: src/provider.c:__connman_provider_init()
> connmand[2116]: src/notifier.c:connman_notifier_register() notifier
> 0x7ec10 name provider
> connmand[2116]: src/network.c:__connman_network_init()
> connmand[2116]: src/device.c:__connman_device_init()
> connmand[2116]: src/agent.c:__connman_agent_init()
> connmand[2116]: src/ippool.c:__connman_ippool_init()
> connmand[2116]: src/iptables.c:__connman_iptables_init()
> connmand[2116]: src/nat.c:__connman_nat_init()
> connmand[2116]: src/notifier.c:connman_notifier_register() notifier
> 0x7eeb0 name nat
> connmand[2116]: src/iptables.c:__connman_iptables_command() command -t
> nat -F POSTROUTING argc 5
> connmand[2116]: src/iptables.c:iptables_init() nat
> connmand[2116]: src/nat.c:flush_nat() Flushing the nat table failed
> connmand[2116]: src/tethering.c:__connman_tethering_init()
> connmand[2116]: src/counter.c:__connman_counter_init()
> connmand[2116]: src/manager.c:__connman_manager_init()
> connmand[2116]: src/notifier.c:connman_notifier_register() notifier
> 0x7e9a4 name manager
> connmand[2116]: src/config.c:__connman_config_init()
> connmand[2116]: src/config.c:read_configs()
> connmand[2116]: src/stats.c:__connman_stats_init()
> connmand[2116]: src/clock.c:__connman_clock_init()
> connmand[2116]: src/timezone.c:__connman_timezone_init()
> connmand[2116]: src/timezone.c:__connman_timezone_lookup() sysconfig zone (null)
> connmand[2116]: src/resolver.c:__connman_resolver_init() dnsproxy 1
> connmand[2116]: src/dnsproxy.c:__connman_dnsproxy_init()
> connmand[2116]: src/dnsproxy.c:__connman_dnsproxy_add_listener() interface lo
> connmand[2116]: src/dnsproxy.c:create_dns_listener() interface lo
> connmand[2116]: No IPv6 support; DNS proxy listening only on Legacy IP
> connmand[2116]: src/dnsproxy.c:create_dns_listener() interface lo
> connmand[2116]: No IPv6 support; DNS proxy listening only on Legacy IP
> connmand[2116]: src/resolver.c:__connman_resolvfile_append() interface
> lo server 127.0.0.1
> connmand[2116]: src/notifier.c:connman_notifier_register() notifier
> 0x7ee84 name dnsproxy
> connmand[2116]: src/ipconfig.c:__connman_ipconfig_init()
> connmand[2116]: src/rtnl.c:__connman_rtnl_init()
> connmand[2116]: src/task.c:__connman_task_init()
> connmand[2116]: src/proxy.c:__connman_proxy_init()
> connmand[2116]: src/detect.c:__connman_detect_init()
> connmand[2116]: src/rtnl.c:connman_rtnl_register() rtnl 0x7ec3c name detect
> connmand[2116]: src/session.c:__connman_session_init()
> connmand[2116]: src/notifier.c:connman_notifier_register() notifier
> 0x7ed14 name session
> connmand[2116]: src/timeserver.c:__connman_timeserver_init()
> connmand[2116]: src/notifier.c:connman_notifier_register() notifier
> 0x7ec5c name timeserver
> connmand[2116]: src/connection.c:__connman_connection_init()
> connmand[2116]: src/rtnl.c:connman_rtnl_register() rtnl 0x7e98c name connection
> connmand[2116]: src/plugin.c:__connman_plugin_init()
> connmand[2116]: Checking loopback interface settings
> connmand[2116]: System hostname is g2
> connmand[2116]: src/utsname.c:connman_utsname_driver_register() driver
> 0x7e468 name loopback
> connmand[2116]: src/notifier.c:connman_notifier_register() notifier
> 0x7e7a0 name pacrunner
> connmand[2116]: src/proxy.c:connman_proxy_driver_register() driver
> 0x7e790 name pacrunnerproxy
> connmand[2116]: src/network.c:connman_network_driver_register() driver
> 0x7e754 name network
> connmand[2116]: src/network.c:probe_driver() driver 0x7e754 name network
> connmand[2116]: src/device.c:connman_device_driver_register() driver
> 0x7e730 name dundee
> connmand[2116]: src/device.c:probe_driver() driver 0x7e730 name dundee
> connmand[2116]: src/network.c:connman_network_driver_register() driver
> 0x7e568 name wifi
> connmand[2116]: src/network.c:probe_driver() driver 0x7e568 name wifi
> connmand[2116]: src/technology.c:connman_technology_driver_register()
> Registering wifi driver
> connmand[2116]: src/technology.c:connman_technology_driver_register()
> Registering ethernet driver
> connmand[2116]: src/network.c:connman_network_driver_register() driver
> 0x7e4e4 name cable
> connmand[2116]: src/network.c:probe_driver() driver 0x7e4e4 name cable
> connmand[2116]: src/device.c:connman_device_driver_register() driver
> 0x7e500 name ethernet
> connmand[2116]: src/device.c:probe_driver() driver 0x7e500 name ethernet
> connmand[2116]: src/technology.c:connman_technology_driver_register()
> Registering cdc_ethernet driver
> connmand[2116]: src/rtnl.c:__connman_rtnl_start()
> connmand[2116]: src/rtnl.c:send_getlink()
> connmand[2116]: src/rtnl.c:send_request() GETLINK len 17 type 18 flags
> 0x0301 seq 0
> connmand[2116]: src/rtnl.c:send_getaddr()
> connmand[2116]: src/rtnl.c:send_getroute()
> connmand[2116]: src/dhcp.c:__connman_dhcp_init()
> connmand[2116]: src/dhcpv6.c:__connman_dhcpv6_init()
> connmand[2116]: src/wpad.c:__connman_wpad_init()
> connmand[2116]: src/wispr.c:__connman_wispr_init()
> connmand[2116]: src/rfkill.c:__connman_rfkill_init()
> connmand[2116]: src/rfkill.c:rfkill_process()
> connmand[2116]: src/rfkill.c:rfkill_process() idx 0 type 1 op 0 soft 0 hard 0
> connmand[2116]: src/technology.c:__connman_technology_add_rfkill()
> index 0 type 3 soft 0 hard 0
> connmand[2116]: src/technology.c:technology_get() type 3
> connmand[2116]: src/technology.c:technology_find() type 3
> connmand[2116]: src/technology.c:technology_load() technology 0x4959118
> connmand[2116]: src/storage.c:storage_load() Loading /var/lib/connman/settings
> connmand[2116]: src/technology.c:technology_get() technology 0x4959118
> connmand[2116]: src/technology.c:technology_enable() technology 0x4959118 enable
> connmand[2116]: src/rfkill.c:__connman_rfkill_block() type 3 block 0
> connmand[2116]: src/rfkill.c:rfkill_process()
> connmand[2116]: src/rfkill.c:rfkill_process() idx 0 type 1 op 2 soft 0 hard 0
> connmand[2116]: src/technology.c:__connman_technology_update_rfkill()
> index 0 soft 0 hard 0
> connmand[2116]: src/rfkill.c:rfkill_process()
> connmand[2116]: plugins/wifi.c:system_ready()
> connmand[2116]: src/device.c:connman_device_driver_register() driver
> 0x7e584 name wifi
> connmand[2116]: src/device.c:probe_driver() driver 0x7e584 name wifi
> connmand[2116]: src/rtnl.c:rtnl_message() buf 0xbde9d950 len 1308
> connmand[2116]: src/rtnl.c:rtnl_message() NEWLINK len 428 type 16
> flags 0x0002 seq 0 pid 2116
> connmand[2116]: src/ipconfig.c:__connman_ipconfig_newlink() index 1
> connmand[2116]: lo {newlink} index 1 operstate 0 <UNKNOWN>
> connmand[2116]: src/detect.c:detect_newlink() type 772 index 1
> connmand[2116]: src/rtnl.c:rtnl_message() NEWLINK len 444 type 16
> flags 0x0002 seq 0 pid 2116
> connmand[2116]: src/ipconfig.c:__connman_ipconfig_newlink() index 2
> connmand[2116]: eth0 {create} index 2 type 1 <ETHER>
> connmand[2116]: eth0 {RX} 3900 packets 377037 bytes
> connmand[2116]: eth0 {TX} 2 packets 656 bytes
> connmand[2116]: eth0 {update} flags 102467 <UP,RUNNING,LOWER_UP>
> connmand[2116]: src/ipconfig.c:__connman_ipconfig_lower_up() ipconfig
> ipv4 (nil) ipv6 (nil)
> connmand[2116]: src/device.c:__connman_device_isfiltered() ignoring
> device eth0 (no match)
> connmand[2116]: eth0 {newlink} index 2 address 00:80:00:23:45:67 mtu 1500
> connmand[2116]: eth0 {newlink} index 2 operstate 6 <UP>
> connmand[2116]: src/device.c:__connman_device_isfiltered() ignoring
> device eth0 (no match)
> connmand[2116]: src/detect.c:detect_newlink() type 1 index 2
> connmand[2116]: src/rtnl.c:rtnl_message() NEWLINK len 436 type 16
> flags 0x0002 seq 0 pid 2116
> connmand[2116]: src/ipconfig.c:__connman_ipconfig_newlink() index 3
> connmand[2116]: wlan0 {create} index 3 type 1 <ETHER>
> connmand[2116]: wlan0 {update} flags 4099 <UP>
> connmand[2116]: wlan0 {newlink} index 3 address 00:12:34:2F:1E:99 mtu 1500
> connmand[2116]: wlan0 {newlink} index 3 operstate 2 <DOWN>
> connmand[2116]: Adding interface wlan0 [ wifi ]
> connmand[2116]: src/technology.c:technology_find() type 3
> connmand[2116]: src/detect.c:detect_newlink() type 1 index 3
> connmand[2116]: src/device.c:connman_device_create() node 0012342f1e99 type 2
> connmand[2116]: src/device.c:connman_device_create() device 0x49b2248
> connmand[2116]: src/device.c:connman_device_set_string() device
> 0x49b2248 key Address value 00:12:34:2F:1E:99
> connmand[2116]: src/device.c:connman_device_register() device
> 0x49b2248 name Wireless
> connmand[2116]: src/device.c:connman_device_register() driver 0x7e584 name wifi
> connmand[2116]: plugins/wifi.c:wifi_probe() device 0x49b2248
> connmand[2116]: src/device.c:connman_device_ref_debug() 0x49b2248 ref
> 2 by plugins/wifi.c:182:wifi_probe()
> connmand[2116]: src/rtnl.c:connman_rtnl_add_newlink_watch() id 1
> connmand[2116]: plugins/wifi.c:wifi_newlink() index 3 flags 4099 change 0
> connmand[2116]: plugins/wifi.c:wifi_newlink() interface up
> connmand[2116]: src/technology.c:__connman_technology_add_device()
> device 0x49b2248
> connmand[2116]: src/technology.c:technology_get() type 3
> connmand[2116]: src/technology.c:technology_find() type 3
> connmand[2116]: src/device.c:__connman_device_enable() device 0x49b2248
> connmand[2116]: src/device.c:connman_device_get_string() device
> 0x49b2248 key Interface
> connmand[2116]: plugins/wifi.c:wifi_enable() device 0x49b2248 0x49bd130
> connmand[2116]: plugins/wifi.c:wifi_newlink() index 3 flags 4099 change 0
> connmand[2116]: src/rtnl.c:rtnl_message() buf 0xbde9d950 len 20
> connmand[2116]: src/rtnl.c:rtnl_message() DONE len 20 type 3 flags
> 0x0002 seq 0 pid 2116
> connmand[2116]: src/rtnl.c:process_response() seq 0
> connmand[2116]: src/rtnl.c:send_request() GETADDR len 17 type 22 flags
> 0x0301 seq 1
> connmand[2116]: plugins/wifi.c:interface_state() wifi (nil) interface state 2
> connmand[2116]: plugins/wifi.c:interface_create_callback() result 0
> ifname wlan0, wifi 0x49bd130
> connmand[2116]: plugins/wifi.c:interface_create_callback() interface
> is ready wifi 0x49bd130 tethering 0
> connmand[2116]: src/device.c:connman_device_set_powered() driver
> 0x49b2248 powered 1
> connmand[2116]: src/technology.c:technology_find() type 3
> connmand[2116]: src/device.c:connman_device_set_disconnected() device
> 0x49b2248 disconnected 0
> connmand[2116]: plugins/wifi.c:wifi_scan() device 0x49b2248 wifi
> 0x496f700 hidden ssid (null)
> connmand[2116]: plugins/wifi.c:wifi_scan() max ssids 4
> connmand[2116]: src/storage.c:storage_load() Loading
> /var/lib/connman/wifi_001234a58f4e_70726f6e746f37_managed_psk/settings
> connmand[2116]: src/storage.c:storage_load() Loading
> /var/lib/connman/wifi_001234a34052_74656d70_managed_none/settings
> connmand[2116]: src/storage.c:storage_load() Loading
> /var/lib/connman/wifi_0012348f1c9c_4732_managed_psk/settings
> connmand[2116]: src/storage.c:storage_load() Unable to load
> /var/lib/connman/wifi_0012348f1c9c_4732_managed_psk/settings: File is
> empty
> ==2116== Invalid read of size 4
> ==2116==    at 0x4B8D14D0: g_key_file_get_value (in
> /usr/lib/libglib-2.0.so.0.3000.3)
> ==2116==  Address 0x4 is not stack'd, malloc'd or (recently) free'd
> ==2116==
> connmand[2116]: Aborting (signal 11) [connmand]
> ==2116==
> ==2116== HEAP SUMMARY:
> ==2116==     in use at exit: 44,498 bytes in 401 blocks
> ==2116==   total heap usage: 3,813 allocs, 3,412 frees, 1,656,422
> bytes allocated
> ==2116==
> ==2116== 11 bytes in 2 blocks are possibly lost in loss record 2 of 47
> ==2116==    at 0x483367C: malloc (vg_replace_malloc.c:263)
> ==2116==    by 0x4B75B00B: strdup (in /lib/libc-2.13.so)
> ==2116==
> ==2116== 32 bytes in 2 blocks are possibly lost in loss record 15 of 47
> ==2116==    at 0x483367C: malloc (vg_replace_malloc.c:263)
> ==2116==    by 0x4B8DC62B: g_try_malloc (in /usr/lib/libglib-2.0.so.0.3000.3)
> ==2116==
> ==2116== 264 bytes in 9 blocks are possibly lost in loss record 35 of 47
> ==2116==    at 0x483367C: malloc (vg_replace_malloc.c:263)
> ==2116==    by 0x4B8DC67B: g_try_malloc0 (in /usr/lib/libglib-2.0.so.0.3000.3)
> ==2116==
> ==2116== 537 bytes in 30 blocks are possibly lost in loss record 37 of 47
> ==2116==    at 0x483367C: malloc (vg_replace_malloc.c:263)
> ==2116==    by 0x4B8DC413: g_malloc (in /usr/lib/libglib-2.0.so.0.3000.3)
> ==2116==
> ==2116== 2,460 bytes in 77 blocks are possibly lost in loss record 41 of 47
> ==2116==    at 0x48319D4: calloc (vg_replace_malloc.c:566)
> ==2116==    by 0x4B8DC4A7: g_malloc0 (in /usr/lib/libglib-2.0.so.0.3000.3)
> ==2116==
> ==2116== 7,008 bytes in 20 blocks are possibly lost in loss record 45 of 47
> ==2116==    at 0x483182C: memalign (vg_replace_malloc.c:694)
> ==2116==    by 0x48318CB: posix_memalign (vg_replace_malloc.c:835)
> ==2116==    by 0x4B8B311F: ??? (in /usr/lib/libglib-2.0.so.0.3000.3)
> ==2116==
> ==2116== LEAK SUMMARY:
> ==2116==    definitely lost: 0 bytes in 0 blocks
> ==2116==    indirectly lost: 0 bytes in 0 blocks
> ==2116==      possibly lost: 10,312 bytes in 140 blocks
> ==2116==    still reachable: 34,186 bytes in 261 blocks
> ==2116==         suppressed: 0 bytes in 0 blocks
> ==2116== Reachable blocks (those to which a pointer was found) are not shown.
> ==2116== To see them, rerun with: --leak-check=full --show-reachable=yes
> ==2116==
> ==2116== For counts of detected and suppressed errors, rerun with: -v
> ==2116== ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 25 from 6)
>
> My investigation lead to this:
> inside static GKeyFile *storage_load(const char *pathname), is tested
> if the file is empty and returns a NULL. So probably somewhere someone
> is been trying to access a NULL pointer or something like that.
>
> Valgrind shows that g_key_file_get_value() is the one causing,
> apparently, a SEGFAULT.
> The only place in connman's source that g_key_file_get_value() is
> called is: src/storage.c:485:           value =
> g_key_file_get_value(keyfile_def, services[i],
> But the problem is that I don't know if that call is from connman or
> from inside glib.
>
> Please, does someone with more experience with connman could help me
> finding this bug.
>
> By the way, I'm using ARMv7 architecture.
>
> OBS: It doesn't matter if I run with '-I eth0' or not
>
> Thank you,
> Felipe Tonello
> _______________________________________________
> connman mailing list
> connman at connman.net
> http://lists.connman.net/listinfo/connman
>




More information about the connman mailing list