Ticket #1834 (closed defect: fixed)

Opened 11 years ago

Last modified 10 years ago

openmoko-dialer2 crashes when no dbus connection could be set (bad error init)

Reported by: LeRoutier Owned by: openmoko-devel
Priority: highest Milestone:
Component: unknown Version:
Severity: normal Keywords: HasPatch
Cc: erin_yueh@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:
Reproducible:

Description

launching phone-kit manually, I had it crashing badly :

root@om-gta02:/var/volatile/tmp# phone-kit

(process:1862): CRITICAL : Failed to connect to the D-BUS daemon: dbus-launch failed to autolaunch D-Bus session: Autolaunch requested, but X11 support not compiled in.
Cannot continue.

Segmentation fault

#0 0x40a58c88 in free () from /lib/libc.so.6
#1 0x4082d564 in dbus_free () from /usr/lib/libdbus-1.so.3
#2 0x4081baac in dbus_error_free () from /usr/lib/libdbus-1.so.3
#3 0x0000f7c4 in main ()

Attached patch fixes this

This happens because DBus error is badly initialized
I didn't check in other places if this programming error is anywhere else

Attachments

openmoko-dialer2_dbus_crash.patch (786 bytes) - added by LeRoutier 11 years ago.
Fix buffer overflow and clean dbus related code a bit

Change History

Changed 11 years ago by LeRoutier

Fix buffer overflow and clean dbus related code a bit

comment:1 Changed 11 years ago by zecke

  • Keywords HasPatch added

comment:2 Changed 11 years ago by erin

did you try to export DBUS_SESSION_BUS_ADDRESS? try below commands:

  1. root@om-gta02:/etc/init.d# export DISPLAY=0:0
  1. root@om-gta02:/etc/init.d# ps aux | grep openmoko-today

root 1861 3.2 10.1 24720 12564 pts/0 S 13:58 0:05 openmoko-today
root 1886 0.0 0.4 2752 596 pts/0 S+ 14:01 0:00 grep openmoko-today

  1. root@om-gta02:/etc/init.d# cat /proc/1861/environ

TSLIB_TSDEVICE=/dev/input/touchscreen0USER=rootUSE_EXA=noOLDPWD=/usr/binHOME=/home/rootHOME_VOLATILE=/home/root/ramdiskPS1=\u@\h:\w\$ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-4AVtZdnBiV,guid=187747d4bf97c390b0907edd48b16916LOGNAME=rootTERM=xtermPATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:DISPLAY=:0SHELL=/bin/shPWD=/etc/init.dTZ=UTCEDITOR=/bin/vi

  1. root@om-gta02:/etc/init.d# export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-4AVtZdnBiV,guid=187747d4bf97c390b0907edd48b16916
  1. then you can manually start phone-kit

comment:3 Changed 10 years ago by LeRoutier

My problem here is that when no DBUS connection could be done, it crashes because of a buffer overflow : the buffer that should contain the error message has a hardcoded 100 bytes length but in my case, the error message length is far longer.

At least, "sprintf( buffer," should be replaced by snprintf or "g_snprintf ( buffer, LENGTH,"

As we use glib functions, g_snprintf should be prefered.

comment:4 Changed 10 years ago by zecke

  • Cc erin_yueh@… added
  • Owner changed from julian_chu to openmoko-devel
  • Component changed from Distro to unknown

@Erin: could you take a look at the patch and if it is good apply or ask it to be redone?

comment:5 Changed 10 years ago by john_lee

  • Status changed from new to closed
  • Resolution set to fixed

looks good. applied in rev 4620. thanks LeRoutier?!

Note: See TracTickets for help on using tickets.