commit | 3a17e02873fdf53898a2cfce894dcb36223d76d4 | [log] [tgz] |
---|---|---|
author | Tim Lee <timlee660101@gmail.com> | Tue Oct 13 11:52:58 2020 +0800 |
committer | Gunnar Mills <gmills@us.ibm.com> | Thu Nov 12 15:05:58 2020 +0000 |
tree | f62a5b36748b1302223f99e0bc716a4a2490b6de | |
parent | 83cf8189e5f9d414efb5c5fa73227e977cf5f84d [diff] |
update_service: fix segmentation violation when updating images Symptom: Before repo this issue symptom, we need to enable bmcweb debug option. Due to this issue is relevant to timing about callback function lifecycle. Thus, enable debugging will increae issue repo rate almost 100%. Bmcweb.service was terminated abnormal after updating images via Redfish curl command. According debug log, bmcweb.service exited with status=11/SEGV (Segmentation Violation). That's usually a bug in a program such as pointer, null pointer, arrays and so on. The default action for a program upon receiving SIGSEGV is abnormal termination. Coredump analysis: From the backtrace result that is point to softwareInterfaceAdded() of caller: at/home/tim/git/runbmc/openbmc/olympus-build/tmp/work/armv7a-openbmc-linux-gnueabi/bmcweb/ 1.0+gitAUTOINC+72d566d9eb-r0/recipe-sysroot/usr/include/c++/10.1.0/bits/shared_ptr.h:149 at/home/tim/git/runbmc/openbmc/olympus-build/tmp/work/armv7a-openbmc-linux-gnueabi/bmcweb/ 1.0+gitAUTOINC+72d566d9eb-r0/git/redfish-core/include/../lib/update_service.hpp:315 SEGV happen after executing line 84 in softwareInterfaceAdded() line: 83 // Found our interface, disable callbacks line: 84 fwUpdateMatcher = nullptr; line: 86 // Retrieve service and activate line: 87 crow::connections::systemBus->async_method_call( Root cause: From coredump and backtrace result that segmentation violation issue in softwareInterfaceAdded(). softwareInterfaceAdded() is a callback function will be called by monitorForSoftwareAvailable(). When there is a signal relate to member is InterfacesAdded in object path /xyz/operbmc_project/software. However, this callback function pointer will set to NULL poniter in itself callback function. Thus, there is possible to hit SEGV issue when accessing to NULL function pointer. Solution: Set fwUpdateMatcher as nullptr should remove it from softwareInterfaceAdded(). And that will be set as nullptr by call cleanUp() in monitorForSoftwareAvailable() after got response. Thus, it save to remove this line and avoid this SEGV then cause bmcweb.service terminated abnormal. Tested: Update BMC image using UpdateService POST action: curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/octet-stream" -X POST -T tim/obmc-phosphor-image-olympus-nuvoton-20200921031720.static.mtd.tar https://${bmc}/redfish/v1/UpdateService Update BMC image using UpdateService.SimpleUpdate POST action: curl -k -H "X-Auth-Token: $token" -X POST https://${bmc}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"ImageURI":"tftp://10.103.61.175/obmc-phosphor-image-olympus-nuvoton-20200921031720.static.mtd.tar"}' Signed-off-by: Tim Lee <timlee660101@gmail.com> Change-Id: I01dcf56893b5ca64fe1d45f29f3f858761ccf2a8
This component attempts to be a "do everything" embedded webserver for openbmc.
At this time, the webserver implements a few interfaces:
BMCWeb is configured by setting -D
flags that correspond to options in bmcweb/meson_options.txt
and then compiling. For example, meson <builddir> -Dkvm=disabled ...
followed by ninja
in build directory. The option names become C++ preprocessor symbols that control which code is compiled into the program.
meson builddir ninja -C builddir
meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled ninja -C buildir
If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in bmcweb/subprojects
.
meson builddir -Dwrap_mode=nofallback ninja -C builddir
meson builddir -Db_coverage=true -Dtests=enabled ninja coverage -C builddir test
When BMCWeb starts running, it reads persistent configuration data (such as UUID and session data) from a local file. If this is not usable, it generates a new configuration.
When BMCWeb SSL support is enabled and a usable certificate is not found, it will generate a self-sign a certificate before launching the server. The keys are generated by the secp384r1
algorithm. The certificate
C=US, O=OpenBMC, CN=testhost
,SHA-256
algorithm.