libpldm: Backport CLOCK_MONOTONIC overflow fixes
On 32-bit ARM BMCs (such as AST2600-based systems, where LONG_MAX is
2^31 - 1), pldm_transport_send_recv_msg() permanently fails with
PLDM_REQUESTER_POLL_FAIL once uptime crosses 24.855 days
(2,147,478.8s).
timeval_is_valid() checks whether the absolute CLOCK_MONOTONIC deadline
(now + 4.8s) can be converted to milliseconds in a signed long, even
though timeval_to_msec() is only called on the relative remaining
interval (<= 4.8s). Once uptime crosses 24.855 days, every pldmtool
invocation and pldm-script fails until the BMC reboots, breaking MSV
firmware activation checks and OOB firmware updates.
Backport the two upstream libpldm v0.14.0 fixes to meta-phosphor's
libpldm (pinned to 64764fd6):
- 0013-transport-Improve-time-validation-in-pldm_transport_.patch
(69b5a9cde88b): validate the relative `remaining` interval instead of
the absolute `end` timestamp (CHANGELOG.md and send_recv_one.cpp
omitted because 64764fd6 predates environ/time.h and tests are
disabled).
- 0014-transport-Fix-msec-overflow-test.patch (9f6b9b3aca29): fix the
parenthesization in timeval_validate_for_msec().
Tested:
- Full bitbake obmc-phosphor-image build for a 32-bit ARM AST2600 gBMC
platform succeeded (7766/7766 tasks, 0 libpldm/pldmd-google warnings).
Verified both patches applied cleanly with zero fuzz/offset and
libpldm0 is present in the deployed image manifest.
- Low-uptime regression test on a physical AST2600 gBMC (~6h 46m uptime,
no LD_PRELOAD): staged the freshly built libpldm.so.0.7.0 under
/tmp/patched_lib, verified via LD_DEBUG=libs that stock pldmtool
loaded /tmp/patched_lib/libpldm.so.0 directly and across all
wrapper-script child invocations, and compared stock vs.
LD_LIBRARY_PATH=/tmp/patched_lib across all 5 active MCTP endpoints:
- pldm_list_fw_version.sh: exit 0, 0 diff vs. stock.
- pldm_dump_fw_status.sh: exit 0, 0 diff vs. stock.
- Direct pldmtool (base GetPLDMTypes, fw_update GetStatus,
fw_update GetFwParams, fw_update QueryDeviceIdentifiers): exit 0,
0 diff vs. stock.
- High-uptime repro on the same AST2600 gBMC using a per-process
LD_PRELOAD shim shifting CLOCK_MONOTONIC (verified via
LD_DEBUG=bindings that both stock and patched libpldm bound
__clock_gettime64 to the shim; pldmd untouched and active throughout):
- ~2,147,460s (~19s below 24.855d cliff): stock and patched pldmtool
both pass (valid JSON).
- ~2,147,500s (~21s above cliff): stock fails with
"pldm_send_recv error rc -12" (PLDM_REQUESTER_POLL_FAIL); patched
passes.
- ~25.7d (+2,200,000s), ~100.3d (+8,640,000s), and ~365.3d
(+31,536,000s): stock fails with rc -12 (pldm_list_fw_version.sh
reports "N/A (PLDM failed)" on all 5 endpoints); patched
pldm_list_fw_version.sh, pldm_dump_fw_status.sh, and direct pldmtool
all pass with 0 diff vs. the real low-uptime baseline.
Fusion-Link: fusion2 n/a
Google-Bug-Id: 590183011
Change-Id: I4bb382720f5b905b87ee92c65b1da8f2364d509c
Signed-off-by: Luka Strizic <lstrz@google.com>
1 file changed