openbmc / smbios-mdr

Apache License 2.0
6 stars 6 forks source link

`cpuinfoapp` will crash when EntityManager XeonCPU properties change #4

Closed jonathan-doman closed 1 year ago

jonathan-doman commented 2 years ago

If cpuinfoapp has already read the CPU details and then XeonCPU property changes it will try to create another CPUInfo D-Bus object with the same path as an already existing object, causing a failure in sd_bus_add_object_vtable. To reproduce, emit a fake signal:

# busctl emit /xyz/openbmc_project/inventory/system/board/<chassis>/CPU_1 org.freedesktop.DBus.Properties PropertiesChanged sa{sv}as xyz.openbmc_project.Configuration.XeonCPU 1 Bus t 0 0

and observe cpuinfoapp crash:

Jun 11 01:58:15 cpuinfoapp[11371]: get cpu configuration match
Jun 11 01:58:25 cpuinfoapp[11371]: property Address
Jun 11 01:58:25 cpuinfoapp[11371]: property Bus
Jun 11 01:58:25 cpuinfoapp[11371]: property CpuID
Jun 11 01:58:25 cpuinfoapp[11371]: property Name
Jun 11 01:58:25 cpuinfoapp[11371]: property PiromI2cAddress
Jun 11 01:58:25 cpuinfoapp[11371]: property PiromI2cBus
Jun 11 01:58:25 cpuinfoapp[11371]: property RequiredTempSensor
Jun 11 01:58:25 cpuinfoapp[11371]: property Type
Jun 11 01:58:25 cpuinfoapp[11371]: terminate called after throwing an instance of 'sdbusplus::exception::SdBusError'
Jun 11 01:58:25 cpuinfoapp[11371]:   what():  sd_bus_add_object_vtable: org.freedesktop.DBus.Error.FileExists: File exists

Solution might be as simple as changing https://github.com/openbmc/smbios-mdr/blob/a30229e13b8f320bdd23442e39b3a43b94b5545b/src/cpuinfo_main.cpp#L543 to delete the old CPUInfo before creating the new one.

jonathan-doman commented 1 year ago

Confirmed fixed with https://gerrit.openbmc.org/c/openbmc/smbios-mdr/+/64285