bmcweb: Log throw-site stack on std::terminate Uncaught exceptions in gbmcweb reach std::terminate only after asio's io_context and the sdbusplus posted-rethrow loop have already unwound the stack, so the default terminate handler prints a backtrace that no longer contains the original throw site. This makes fleet crashes from stray exceptions very hard to triage. Interpose __cxa_throw (the folly exception_tracer technique, reduced to a single self-contained translation unit) to record the throw-site stack of every exception, keyed by the exception object address, and install a std::terminate handler that looks the record up via the in-flight exception_ptr and logs it. The terminate path performs no allocation, takes no locks and cannot re-enter, since it may run under suspected heap corruption. For the interposer to record throws from libstdc++ and other shared objects -- not just the executable's own code -- it must win dynamic symbol resolution against libstdc++'s __cxa_throw. Export it with default visibility plus a linker --dynamic-list, and compile the tracer translation unit directly into the executable so -Wl,--exclude-libs,ALL cannot force it back to a local, non-interposing symbol. Without this the interposer only captures throws whose __cxa_throw call site is compiled into the executable, and misses standard-library and cross-library throws. A runtime kill switch (--exception_stack_tracer=false) disables recording and keeps the default terminate handler. The tracer depends on glibc backtrace(), libgcc unwinding and the Itanium __cxa_throw ABI, so it is built only in the meson/yocto (gcc) image. Every reference to it from webserver_main_setup is guarded by BMCWEB_ENABLE_EXCEPTION_STACK_TRACER, which is defined only by meson, so the google3/blaze build carries no dependency on the tracer. The tracer source, header and test are GoB-only. Tested: - Built gbmcweb and ran the unit tests inside the gbmcweb Gerrit presubmit gcc image (openbmc-ubuntu-unit-test) with the presubmit meson flags; exception_stack_tracer_test passes 4/4. - Verified the guarded references compile out when BMCWEB_ENABLE_EXCEPTION_STACK_TRACER is undefined. - On an emulated BMC image in Mimik (QEMU), using an out-of-tree debug-only endpoint that throws from a separate shared library through asio's inline executor (catch + async rethrow), confirmed the terminate handler logged the throw-site stack and that it symbolized across both modules. Before exporting the interposer the same cross-module throw was not recorded; after, it is. Verified with readelf that __cxa_throw is GLOBAL DEFAULT in the executable's dynamic symbol table. Google-Bug-Id: 553672958 Signed-off-by: Yuli Fiterman <fiterman@google.com> Change-Id: Ib461c25ffd44188707b628fad9d85f08ef516549
This project is Google's version of BMCWeb.
See Readme Google for Google added features. The following is the original README of OpenBMC/BMCWeb.
==============================================================================
This component attempts to be a “do everything” embedded webserver for OpenBMC.
The webserver implements a few distinct interfaces:
bmcweb at a protocol level supports http and https. TLS is supported through OpenSSL.
Bmcweb supports multiple authentication protocols:
Each of these types of authentication is able to be enabled or disabled both via runtime policy changes (through the relevant Redfish APIs) or via configure time options. All authentication mechanisms supporting username/password are routed to libpam, to allow for customization in authentication implementations.
All authorization in bmcweb is determined at routing time, and per route, and conform to the Redfish PrivilegeRegistry.
*Note: Non-Redfish functions are mapped to the closest equivalent Redfish privilege level.
bmcweb is configured per the meson build files. Available options are documented in meson_options.txt
meson builddir ninja -C builddir
If any of the dependencies are not found on the host system during configuration, meson will automatically download them via its wrap dependencies mentioned in bmcweb/subprojects.
bmcweb relies on some on-system data for storage of persistent data that is internal to the process. Details on the exact data stored and when it is read/written can seen from the persistent_data namespace.
When SSL support is enabled and a usable certificate is not found, bmcweb will generate a self-signed a certificate before launching the server. Please see the bmcweb source code for details on the parameters this certificate is built with.
bmcweb is capable of aggregating resources from satellite BMCs. Refer to AGGREGATION.md for more information on how to enable and use this feature.