current git segfaults, gdb backtraces included, pl;ease help
Hi,
Quoted 5 lines · Jelle de Jong
When running the bluetoothd daemon it segfaults when a devices tries to connect, please see the debug attachments, what is going wrong here? and how can I provide more useful debug info. I compiled with debug flags please see the attachment for how I compiled and made the Debian packages for testing.
The recent BtIO rework has changed quite alot of bluez code during this week so the code base is inevitably less stable than it used to be. We will try to iron out any outstanding issues during the next few days.
Could you describe in more detail the steps you've taken to make bluetoothd segfault? I have not been able to reproduce this with my own tests (mainly testing HFP, A2DP and Serial functionalities).
Your backtraces also didn't seem to contain much useful info. What I usually do is after a git clone/pull I compile with ./bootstrap-configure && make
and then I can use the src/.libs/bluetoothd binary for debuging (e.g. with valgrind or gdb). The --enable-maintainer-mode switch that bootstrap-configure uses makes the produced bluetoothd binary load the modules from the source tree instead of their usual location (/usr/lib/bluetooth) which helps make sure you're only running code from the latest git.
Johan
Quoted 27 lines · Johan Hedberg
Hi,
Quoted 5 lines · Jelle de Jong
When running the bluetoothd daemon it segfaults when a devices tries to connect, please see the debug attachments, what is going wrong here? and how can I provide more useful debug info. I compiled with debug flags please see the attachment for how I compiled and made the Debian packages for testing.
The recent BtIO rework has changed quite alot of bluez code during this week so the code base is inevitably less stable than it used to be. We will try to iron out any outstanding issues during the next few days.
Could you describe in more detail the steps you've taken to make bluetoothd segfault? I have not been able to reproduce this with my own tests (mainly testing HFP, A2DP and Serial functionalities).
Your backtraces also didn't seem to contain much useful info. What I usually do is after a git clone/pull I compile with ./bootstrap-configure && make
and then I can use the src/.libs/bluetoothd binary for debuging (e.g. with valgrind or gdb). The --enable-maintainer-mode switch that bootstrap-configure uses makes the produced bluetoothd binary load the modules from the source tree instead of their usual location (/usr/lib/bluetooth) which helps make sure you're only running code from the latest git.
Quoted 1 line
Johan
Thanks Johan, for the information and your help on the irc channel,
I sent a few hours more on debugging and even while we thought we found the issue:
http://git.kernel.org/?p=bluetooth/bluez.git;a=commit;h=8fb3fd137f3d108e373df9501915ee9ff6e23f83
The problem is still there and bluetoothd segfauls when i try to let my bluetooth keyboard or mouse connect.
Cheers,
Jelle
sudo aptitude install gtk-doc-tools
cd $HOME
sudo rm --recursive bluez
git clone git://git.kernel.org/pub/scm/bluetooth/bluez.git
cd $HOME
cd bluez
./bootstrap-configure && make
sudo su -
cd /home/jelle/bluez LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/jelle/bluez/lib/"
sudo cp --verbose /home/jelle/bluez/src/bluetooth.conf /etc/dbus-1/system.d/ /etc/init.d/dbus restart
gdb /home/jelle/bluez/src/.libs/bluetoothd
sudo su -
chmod 755 /home/jelle/bluez/src/.libs/bluetoothd
valgrind --trace-children=yes --leak-check=yes --track-origins=yes /home/jelle/bluez/src/.libs/bluetoothd --nodaemon --debug
# Parsing /etc/bluetooth/main.conf failed: No such file or directory # bluetoothd[15922]: Unable to get on D-Bus
sudo cp --verbose /home/jelle/bluez/src/bluetooth.conf /etc/dbus-1/system.d/
------------------------------------------------------------------------
# killall /usr/sbin/bluetoothd
sudo su -
gdb /usr/sbin/bluetoothd
(gdb) set pagination 0
(gdb) thread apply all bt full
(gdb) run --nodaemon --debug
(gdb) backtrace full
(gdb) info registers
(gdb) thread apply all backtrace
(gdb) quit
------------------------------------------------------------------------
# date Sun Feb 22 15:06:48 CET 2009
root@debian-eeepc:~# valgrind --trace-children=yes --leak-check=yes --track-origins=yes /home/jelle/bluez/src/.libs/bluetoothd --nodaemon --debug ==9308== Memcheck, a memory error detector. ==9308== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al. ==9308== Using LibVEX rev 1878, a library for dynamic binary translation. ==9308== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP. ==9308== Using valgrind-3.4.0-Debian, a dynamic binary instrumentation framework. ==9308== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al. ==9308== For more details, rerun with: -v ==9308== bluetoothd[9308]: Bluetooth daemon bluetoothd[9308]: Enabling debug information bluetoothd[9308]: Parsing /etc/bluetooth/main.conf failed: No such file or directory bluetoothd[9308]: Starting SDP server bluetoothd[9308]: Loading plugins /home/jelle/bluez/plugins bluetoothd[9308]: Parsing /etc/bluetooth/input.conf failed: No such file or directory bluetoothd[9308]: Parsing /etc/bluetooth/audio.conf failed: No such file or directory bluetoothd[9308]: Unix socket created: 10 bluetoothd[9308]: Telephony plugin initialized bluetoothd[9308]: HFP AG features: "Ability to reject a call" "Enhanced call status" "Extended Error Result Codes" bluetoothd[9308]: Parsing /etc/bluetooth/network.conf failed: No such file or directory bluetoothd[9308]: Config options: InterfacePrefix=bnep%d, PANU_Script=(null), GN_Script=(null), NAP_Script=(null), GN_Interface=pan0, NAP_Interface=pan1, Security=true ==9308== Warning: noted but unhandled ioctl 0x89a0 with no size/direction hints ==9308== This could cause spurious value errors to appear. ==9308== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. bluetoothd[9308]: Can't create GN bridge bluetoothd[9308]: register_interface: path /org/bluez/9308/any bluetoothd[9308]: Registered interface org.bluez.Service on path /org/bluez/9308/any bluetoothd[9308]: HCI dev 0 registered bluetoothd[9308]: child 9311 forked ==9311== Syscall param ioctl(generic) points to unaddressable byte(s) ==9311== at 0x40007F2: (within /lib/ld-2.7.so) ==9311== by 0x112336: device_devreg_setup (main.c:489) ==9311== by 0x1124E6: init_all_devices (main.c:537) ==9311== by 0x112DBD: main (main.c:781) ==9311== Address 0x0 is not stack'd, malloc'd or (recently) free'd bluetoothd[9308]: HCI dev 0 already up bluetoothd[9308]: Starting security manager 0 ==9311== ==9311== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 98 from 2) ==9311== malloc/free: in use at exit: 29,014 bytes in 326 blocks. ==9311== malloc/free: 605 allocs, 279 frees, 212,921 bytes allocated. ==9311== For counts of detected errors, rerun with: -v ==9311== searching for pointers to 326 not-freed blocks. ==9311== checked 139,648 bytes. ==9311== ==9311== ==9311== 744 bytes in 3 blocks are possibly lost in loss record 12 of 20 ==9311== at 0x4821F3A: memalign (vg_replace_malloc.c:460) ==9311== by 0x4821FEE: posix_memalign (vg_replace_malloc.c:569) ==9311== by 0x488FDCE: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9311== by 0x48915B2: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1800.4) ==9311== by 0x48916B4: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.1800.4) ==9311== by 0x486B8B0: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9311== by 0x486B949: g_key_file_new (in /usr/lib/libglib-2.0.so.0.1800.4) ==9311== by 0x111399: load_config (main.c:80) ==9311== by 0x112C2D: main (main.c:739) ==9311== ==9311== LEAK SUMMARY: ==9311== definitely lost: 0 bytes in 0 blocks. ==9311== possibly lost: 744 bytes in 3 blocks. ==9311== still reachable: 28,270 bytes in 323 blocks. ==9311== suppressed: 0 bytes in 0 blocks. ==9311== Reachable blocks (those to which a pointer was found) are not shown. ==9311== To see them, rerun with: --leak-check=full --show-reachable=yes bluetoothd[9308]: headset_server_probe: path /org/bluez/9308/hci0 bluetoothd[9308]: Adding record with handle 0x10000 bluetoothd[9308]: Record pattern UUID 00000003-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001108-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001112-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001203-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x00010c bluetoothd[9308]: Adding record with handle 0x10001 bluetoothd[9308]: Record pattern UUID 00000003-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000111e-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000111f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001203-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x40010c bluetoothd[9308]: a2dp_server_probe: path /org/bluez/9308/hci0 bluetoothd[9308]: SEP 0x4b3a760 registered: type:0 codec:0 seid:1 bluetoothd[9308]: Adding record with handle 0x10002 bluetoothd[9308]: Record pattern UUID 00000019-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110a-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110d-0000-1000-8000-00805f9 bluetoothd[9308]: avrcp_server_probe: path /org/bluez/9308/hci0 bluetoothd[9308]: Adding record with handle 0x10003 bluetoothd[9308]: Record pattern UUID 00000017-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110c-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110e-0000-1000-8000-00805f9 bluetoothd[9308]: Adding record with handle 0x10004 bluetoothd[9308]: Record pattern UUID 00000017-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110e-0000-1000-8000-00805f9 bluetoothd[9308]: proxy_probe: path /org/bluez/9308/hci0 bluetoothd[9308]: Registered interface org.bluez.SerialProxyManager on path /org/bluez/9308/hci0 bluetoothd[9308]: network_server_probe: path /org/bluez/9308/hci0 bluetoothd[9308]: Adding record with handle 0x10005 bluetoothd[9308]: Record pattern UUID 0000000f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001115-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: register_server_record: got record id 0x10005 bluetoothd[9308]: Registered interface org.bluez.NetworkPeer on path /org/bluez/9308/hci0 bluetoothd[9308]: network_server_probe: path /org/bluez/9308/hci0 bluetoothd[9308]: Adding record with handle 0x10006 bluetoothd[9308]: Record pattern UUID 0000000f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001117-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: register_server_record: got record id 0x10006 bluetoothd[9308]: Registered interface org.bluez.NetworkHub on path /org/bluez/9308/hci0 bluetoothd[9308]: network_server_probe: path /org/bluez/9308/hci0 bluetoothd[9308]: Adding record with handle 0x10007 bluetoothd[9308]: Record pattern UUID 0000000f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001116-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: register_server_record: got record id 0x10007 bluetoothd[9308]: Registered interface org.bluez.NetworkRouter on path /org/bluez/9308/hci0 bluetoothd[9308]: register_interface: path /org/bluez/9308/hci0 bluetoothd[9308]: Registered interface org.bluez.Service on path /org/bluez/9308/hci0 bluetoothd[9308]: Creating device /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: headset_probe: path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: adapter_get_device(00:0C:55:D1:C9:78) bluetoothd[9308]: Found Headset record bluetoothd[9308]: Discovered Headset service on RFCOMM channel 2 bluetoothd[9308]: Registered interface org.bluez.Headset on path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: Found Handsfree record bluetoothd[9308]: Discovered Handsfree service on RFCOMM channel 1 bluetoothd[9308]: Found Audio Sink bluetoothd[9308]: Registered interface org.bluez.AudioSink on path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: Found AV Remote bluetoothd[9308]: Registered interface org.bluez.Control on path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: serial_probe: path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78: 00001108-0000-1000-8000-00805f9b34fb bluetoothd[9308]: Registered interface org.bluez.Serial on path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78 bluetoothd[9308]: serial_probe: path /org/bluez/9308/hci0/dev_00_0C_55_D1_C9_78: 0000111e-0000-1000-8000-00805f9b34fb bluetoothd[9308]: Adapter /org/bluez/9308/hci0 has been enabled bluetoothd[9308]: HCI dev 1 registered bluetoothd[9308]: child 9316 forked ==9316== Syscall param ioctl(generic) points to unaddressable byte(s) ==9316== at 0x40007F2: (within /lib/ld-2.7.so) ==9316== by 0x112336: device_devreg_setup (main.c:489) ==9316== by 0x1124E6: init_all_devices (main.c:537) ==9316== by 0x112DBD: main (main.c:781) ==9316== Address 0x1 is not stack'd, malloc'd or (recently) free'd bluetoothd[9308]: HCI dev 1 already up bluetoothd[9308]: Starting security manager 1 ==9308== Syscall param ioctl(generic) points to unaddressable byte(s) ==9308== at 0x40007F2: (within /lib/ld-2.7.so) ==9308== by 0x11EC4C: manager_start_adapter (manager.c:513) ==9308== by 0x1123B1: device_devup_setup (main.c:505) ==9308== by 0x112518: init_all_devices (main.c:540) ==9308== by 0x112DBD: main (main.c:781) ==9308== Address 0x0 is not stack'd, malloc'd or (recently) free'd bluetoothd[9308]: headset_server_probe: path /org/bluez/9308/hci1 bluetoothd[9308]: Adding record with handle 0x10008 bluetoothd[9308]: Record pattern UUID 00000003-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001108-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001112-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001203-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: Adding record with handle 0x10009 bluetoothd[9308]: Record pattern UUID 00000003-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000111e-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000111f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001203-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: a2dp_server_probe: path /org/bluez/9308/hci1 bluetoothd[9308]: SEP 0x4c19310 registered: type:0 codec:0 seid:1 bluetoothd[9308]: Adding record with handle 0x1000a bluetoothd[9308]: Record pattern UUID 00000019-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110a-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110d-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: avrcp_server_probe: path /org/bluez/9308/hci1 bluetoothd[9308]: Adding record with handle 0x1000b bluetoothd[9308]: Record pattern UUID 00000017-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110c-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110e-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: Adding record with handle 0x1000c bluetoothd[9308]: Record pattern UUID 00000017-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 0000110e-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: proxy_probe: path /org/bluez/9308/hci1 bluetoothd[9308]: Registered interface org.bluez.SerialProxyManager on path /org/bluez/9308/hci1 bluetoothd[9308]: network_server_probe: path /org/bluez/9308/hci1 bluetoothd[9308]: Adding record with handle 0x1000d bluetoothd[9308]: Record pattern UUID 0000000f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001115-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: register_server_record: got record id 0x1000d bluetoothd[9308]: Registered interface org.bluez.NetworkPeer on path /org/bluez/9308/hci1 bluetoothd[9308]: network_server_probe: path /org/bluez/9308/hci1 bluetoothd[9308]: Adding record with handle 0x1000e bluetoothd[9308]: Record pattern UUID 0000000f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001117-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: register_server_record: got record id 0x1000e bluetoothd[9308]: Registered interface org.bluez.NetworkHub on path /org/bluez/9308/hci1 bluetoothd[9308]: network_server_probe: path /org/bluez/9308/hci1 bluetoothd[9308]: Adding record with handle 0x1000f bluetoothd[9308]: Record pattern UUID 0000000f-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[9308]: Record pattern UUID 00001116-0000-1000-8000-00805f9 bluetoothd[9308]: Changing service classes to 0x4a010c bluetoothd[9308]: register_server_record: got record id 0x1000f bluetoothd[9308]: Registered interface org.bluez.NetworkRouter on path /org/bluez/9308/hci1 bluetoothd[9308]: register_interface: path /org/bluez/9308/hci1 bluetoothd[9308]: Registered interface org.bluez.Service on path /org/bluez/9308/hci1 bluetoothd[9308]: Creating device /org/bluez/9308/hci1/dev_11_11_11_11_17_95 ==9316== ==9316== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 98 from 2) ==9316== malloc/free: in use at exit: 42,682 bytes in 810 blocks. ==9316== malloc/free: 2,523 allocs, 1,713 frees, 1,030,176 bytes allocated. ==9316== For counts of detected errors, rerun with: -v ==9316== searching for pointers to 810 not-freed blocks. bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci1/dev_11_11_11_11_17_95 ==9316== checked 152,992 bytes. ==9316== ==9316== ==9316== 744 bytes in 3 blocks are possibly lost in loss record 9 of 21 ==9316== at 0x4821F3A: memalign (vg_replace_malloc.c:460) ==9316== by 0x4821FEE: posix_memalign (vg_replace_malloc.c:569) ==9316== by 0x488FDCE: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9316== by 0x48915B2: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1800.4) ==9316== by 0x48916B4: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.1800.4) ==9316== by 0x486B8B0: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9316== by 0x486B949: g_key_file_new (in /usr/lib/libglib-2.0.so.0.1800.4) ==9316== by 0x111399: load_config (main.c:80) ==9316== by 0x112C2D: main (main.c:739) ==9316== ==9316== LEAK SUMMARY: ==9316== definitely lost: 0 bytes in 0 blocks. ==9316== possibly lost: 744 bytes in 3 blocks. ==9316== still reachable: 41,938 bytes in 807 blocks. ==9316== suppressed: 0 bytes in 0 blocks. ==9316== Reachable blocks (those to which a pointer was found) are not shown. ==9316== To see them, rerun with: --leak-check=full --show-reachable=yes bluetoothd[9308]: hid_device_probe: path /org/bluez/9308/hci1/dev_11_11_11_11_17_95 bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci1/dev_11_11_11_11_17_95 bluetoothd[9308]: Creating device /org/bluez/9308/hci1/dev_00_07_61_8A_42_DF bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci1/dev_00_07_61_8A_42_DF bluetoothd[9308]: hid_device_probe: path /org/bluez/9308/hci1/dev_00_07_61_8A_42_DF bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci1/dev_00_07_61_8A_42_DF bluetoothd[9308]: Creating device /org/bluez/9308/hci1/dev_00_07_61_0F_4A_60 bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci1/dev_00_07_61_0F_4A_60 bluetoothd[9308]: hid_device_probe: path /org/bluez/9308/hci1/dev_00_07_61_0F_4A_60 bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci1/dev_00_07_61_0F_4A_60 bluetoothd[9308]: Creating device /org/bluez/9308/hci1/dev_00_1E_3D_15_0A_4F bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci1/dev_00_1E_3D_15_0A_4F bluetoothd[9308]: hid_device_probe: path /org/bluez/9308/hci1/dev_00_1E_3D_15_0A_4F bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci1/dev_00_1E_3D_15_0A_4F bluetoothd[9308]: Creating device /org/bluez/9308/hci1/dev_B0_13_08_08_06_A8 bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci1/dev_B0_13_08_08_06_A8 bluetoothd[9308]: hid_device_probe: path /org/bluez/9308/hci1/dev_B0_13_08_08_06_A8 bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci1/dev_B0_13_08_08_06_A8 bluetoothd[9308]: Creating device /org/bluez/9308/hci1/dev_00_12_A1_01_04_16 bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci1/dev_00_12_A1_01_04_16 bluetoothd[9308]: hid_device_probe: path /org/bluez/9308/hci1/dev_00_12_A1_01_04_16 bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci1/dev_00_12_A1_01_04_16 bluetoothd[9308]: Creating device /org/bluez/9308/hci1/dev_00_07_61_8A_1A_AA bluetoothd[9308]: Probe drivers for /org/bluez/9308/hci1/dev_00_07_61_8A_1A_AA bluetoothd[9308]: hid_device_probe: path /org/bluez/9308/hci1/dev_00_07_61_8A_1A_AA bluetoothd[9308]: Registered interface org.bluez.Input on path /org/bluez/9308/hci1/dev_00_07_61_8A_1A_AA bluetoothd[9308]: Adapter /org/bluez/9308/hci1 has been enabled bluetoothd[9308]: child 9311 exited bluetoothd[9308]: child 9316 exited bluetoothd[9308]: Computer is classified as laptop bluetoothd[9308]: Current device class is 0x4a010c bluetoothd[9308]: Setting 0x00010c for major/minor device class bluetoothd[9308]: Changing major/minor class to 0x4a010c bluetoothd[9308]: Computer is classified as laptop bluetoothd[9308]: Current device class is 0x4a010c bluetoothd[9308]: Setting 0x00010c for major/minor device class bluetoothd[9308]: Changing major/minor class to 0x4a010c bluetoothd[9308]: link_key_request (sba=00:15:AF:F4:E9:E0, dba=00:07:61:8A:1A:AA) bluetoothd[9308]: kernel auth requirements = 0x00 bluetoothd[9308]: stored link key type = 0x00 bluetoothd[9308]: adapter_get_device(00:07:61:8A:1A:AA) ==9308== ==9308== Conditional jump or move depends on uninitialised value(s) ==9308== at 0x49AEEE0: (within /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A21F5: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== by 0x48A8F2C: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x4872367: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x4875A02: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9308== Uninitialised value was created by a stack allocation ==9308== at 0x483121F: connect_event_cb (server.c:91) ==9308== ==9308== Conditional jump or move depends on uninitialised value(s) ==9308== at 0x49ADBC9: _IO_default_xsputn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A104C: _IO_padn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49819CB: vfprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A220B: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== by 0x48A8F2C: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9308== Uninitialised value was created by a stack allocation ==9308== at 0x483121F: connect_event_cb (server.c:91) ==9308== ==9308== Conditional jump or move depends on uninitialised value(s) ==9308== at 0x49AED70: _IO_str_overflow (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49ADC47: _IO_default_xsputn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A104C: _IO_padn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49819CB: vfprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A220B: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== Uninitialised value was created by a stack allocation ==9308== at 0x483121F: connect_event_cb (server.c:91) ==9308== ==9308== Use of uninitialised value of size 4 ==9308== at 0x49AED7D: _IO_str_overflow (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49ADC47: _IO_default_xsputn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A104C: _IO_padn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49819CB: vfprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A220B: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== Uninitialised value was created by a stack allocation ==9308== at 0x483121F: connect_event_cb (server.c:91) ==9308== ==9308== Invalid write of size 1 ==9308== at 0x49AED7D: _IO_str_overflow (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49ADC47: _IO_default_xsputn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A104C: _IO_padn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49819CB: vfprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A220B: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==9308== ==9308== Process terminating with default action of signal 11 (SIGSEGV) ==9308== Access not within mapped region at address 0x0 ==9308== at 0x49AED7D: _IO_str_overflow (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49ADC47: _IO_default_xsputn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A104C: _IO_padn (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49819CB: vfprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A220B: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== If you believe this happened as a result of a stack overflow in your ==9308== program's main thread (unlikely but possible), you can try to increase ==9308== the size of the main thread stack using the --main-stacksize= flag. ==9308== The main thread stack size used in this run was 8388608. ==9308== ==9308== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 98 from 2) ==9308== malloc/free: in use at exit: 59,783 bytes in 1,367 blocks. ==9308== malloc/free: 7,567 allocs, 6,200 frees, 2,231,857 bytes allocated. ==9308== For counts of detected errors, rerun with: -v ==9308== searching for pointers to 1,367 not-freed blocks. ==9308== checked 170,388 bytes. ==9308== ==9308== ==9308== 744 bytes in 3 blocks are possibly lost in loss record 10 of 22 ==9308== at 0x4821F3A: memalign (vg_replace_malloc.c:460) ==9308== by 0x4821FEE: posix_memalign (vg_replace_malloc.c:569) ==9308== by 0x488FDCE: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x48915B2: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x48916B4: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x486B8B0: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x486B949: g_key_file_new (in /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x111399: load_config (main.c:80) ==9308== by 0x112C2D: main (main.c:739) ==9308== ==9308== LEAK SUMMARY: ==9308== definitely lost: 0 bytes in 0 blocks. ==9308== possibly lost: 744 bytes in 3 blocks. ==9308== still reachable: 59,039 bytes in 1,364 blocks. ==9308== suppressed: 0 bytes in 0 blocks. ==9308== Reachable blocks (those to which a pointer was found) are not shown. ==9308== To see them, rerun with: --leak-check=full --show-reachable=yes Segmentation fault root@debian-eeepc:~#
------------------------------------------------------------------------
Hi Jelle,
Quoted 13 lines · Jelle de Jong
==9308== Conditional jump or move depends on uninitialised value(s)
==9308== at 0x49AEEE0: (within /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A21F5: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== by 0x48A8F2C: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x4872367: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x4875A02: (within /usr/lib/libglib-2.0.so.0.1800.4)
Quoted 2 lines
==9308== Uninitialised value was created by a stack allocation
==9308== at0x483121F:connect_event_cb(server.c:91)
This was actually a pretty stupid thing I should have noticed earlier. The parameter list to bt_io_get should end in BT_IO_OPT_INVALID but it was ending in NULL for this call. I also found two other places with problematic parameters to bt_io_get. All occurences have been fixed in git now.
Johan
Quoted 19 lines · Johan Hedberg
Hi Jelle,
Quoted 13 lines · Jelle de Jong
==9308== Conditional jump or move depends on uninitialised value(s)
==9308== at 0x49AEEE0: (within /lib/i686/cmov/libc-2.7.so) ==9308== by 0x49A21F5: vsprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x498A48A: sprintf (in /lib/i686/cmov/libc-2.7.so) ==9308== by 0x492B922: ba2str (bluetooth.c:88) ==9308== by 0x13262C: l2cap_get (btio.c:731) ==9308== by 0x13312F: get_valist (btio.c:983) ==9308== by 0x133447: bt_io_get (btio.c:1061) ==9308== by 0x48312A2: connect_event_cb (server.c:102) ==9308== by 0x130F37: server_cb (btio.c:180) ==9308== by 0x48A8F2C: (within /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x4872367: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.1800.4) ==9308== by 0x4875A02: (within /usr/lib/libglib-2.0.so.0.1800.4)Quoted 2 lines
==9308== Uninitialised value was created by a stack allocation
==9308== at0x483121F:connect_event_cb(server.c:91)
Quoted 5 lines
This was actually a pretty stupid thing I should have noticed earlier. The parameter list to
bt_io_getshould end inBT_IO_OPT_INVALIDbut it was ending in NULL for this call. I also found two other places with problematic parameters tobt_io_get. All occurences have been fixed in git now.
Make BT_IO_OPT_INVALID be 0 in the enum, and you can use the GCC sentinel feature. Otherwise, it would have to wait for:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28319
Cheers
Hi Bastien,
Quoted 3 lines · Bastien Nocera
Make
BT_IO_OPT_INVALIDbe 0 in the enum, and you can use the GCC sentinel feature. Otherwise, it would have to wait for:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28319
Thanks for the tip! However, there's still the problem that gcc seems to want this parameter be of type char* and with gcc 4 gives the warning "warning: missing sentinel in function call" because it is not. The following page has some info about it:
http://www.linuxonly.nl/docs/2/0_Page_1.html
Johan