Bug 93095 - crash due to assert in dbus_g_connection_register_g_object
Summary: crash due to assert in dbus_g_connection_register_g_object
Status: RESOLVED FIXED
Alias: None
Product: upower
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-24 21:07 UTC by oleid
Modified: 2017-09-08 16:01 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch to handle '@' sign in device path. (509 bytes, patch)
2015-11-24 21:07 UTC, oleid
Details | Splinter Review
daemon: Fix crash when '@' is present in the device name (769 bytes, patch)
2017-09-08 16:00 UTC, Bastien Nocera
Details | Splinter Review
linux: Add test for crash when battery has funky name (1.47 KB, patch)
2017-09-08 16:00 UTC, Bastien Nocera
Details | Splinter Review

Description oleid 2015-11-24 21:07:32 UTC
Created attachment 120093 [details] [review]
Patch to handle '@' sign in device path.

Dear developers,

I'm running a regular (gentoo) Linux on my Acer Chromebook 13 (nyan-big). It's a Tegra K1 device. Using upower-0.99.x upowerd crashes on start:

-----------------
TI:19:40:32     Starting upowerd version 0.99.3
TI:19:40:32     cannot find a keyboard backlight
TI:19:40:32     daemon now coldplug
TI:19:40:32     registering subsystem : power_supply
TI:19:40:32     taking a guess for power supply scope
TI:19:40:32     added native-path: bq24735@5-0009

TI:19:40:32     object path = /org/freedesktop/UPower/devices/line_power_bq24735@5_0009

** (upowerd:16902): CRITICAL **: dbus_g_connection_register_g_object: assertion 'g_variant_is_object_path (at_path)' failed

Program received signal SIGTRAP, Trace/breakpoint trap.

-----------------

As you can see, the @ in the object path is the problem. Looking at the code, I found the path generation routine doesn't handle '@' in the path. The attached patch replaces '@' with an 'a' in spirit of the other sanitation cases.

FYI, the corresponding device folder is:

/sys/devices/soc0/7000d400.spi/spi_master/spi32766/spi32766.0/cros-ec-i2c-tunnel.2/i2c-5/5-0009/power_supply/bq24735@5-0009

And contains:
$ find
.
./type
./power
./power/control
./power/runtime_active_time
./power/autosuspend_delay_ms
./power/runtime_status
./power/runtime_suspended_time
./device
./subsystem
./online
./uevent
Comment 1 Bastien Nocera 2017-09-08 16:00:07 UTC
Created attachment 134091 [details] [review]
daemon: Fix crash when '@' is present in the device name

GDBus doesn't like '@' in the object path, so escape it.
Comment 2 Bastien Nocera 2017-09-08 16:00:11 UTC
Created attachment 134092 [details] [review]
linux: Add test for crash when battery has funky name
Comment 3 Bastien Nocera 2017-09-08 16:01:57 UTC
Attachment 134091 [details] pushed as fa38e1c - daemon: Fix crash when '@' is present in the device name
Attachment 134092 [details] pushed as fb9f19c - linux: Add test for crash when battery has funky name


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.