diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor')
17 files changed, 830 insertions, 39 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/certificate/phosphor-certificate-manager/0001-Verify-that-certificate-is-loadable-in-SSL-context.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/certificate/phosphor-certificate-manager/0001-Verify-that-certificate-is-loadable-in-SSL-context.patch new file mode 100644 index 000000000..b0bbd1080 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/certificate/phosphor-certificate-manager/0001-Verify-that-certificate-is-loadable-in-SSL-context.patch @@ -0,0 +1,53 @@ +From 811a29e1941db0157f49d2e05491be945f7b2f07 Mon Sep 17 00:00:00 2001 +From: Nidhin MS <nidhin.ms@intel.com> +Date: Thu, 13 May 2021 12:54:32 +0530 +Subject: [PATCH] Verify that certificate is loadable in SSL context + +Openssl requires private keys to have a minimum keylength specified by +openssl security level 1. As a result RSA keys shorter +than 1024 bits and ECC keys shorter than 160 bits are prohibited. Add a +validation step to create an SSL context and try to load the +certificate. + +Tested: +Tested RSA with length 512 756 and 1024 + +Change-Id: Idac4dea6279964bfd8e3d996d91cd278678c73f9 +Signed-off-by: Nidhin MS <nidhin.ms@intel.com> +--- + certificate.cpp | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/certificate.cpp b/certificate.cpp +index 6bfd4af..7b902bd 100644 +--- a/certificate.cpp ++++ b/certificate.cpp +@@ -9,6 +9,7 @@ + #include <openssl/err.h> + #include <openssl/evp.h> + #include <openssl/pem.h> ++#include <openssl/ssl.h> + #include <openssl/x509v3.h> + + #include <fstream> +@@ -351,6 +352,17 @@ void Certificate::install(const std::string& certSrcFilePath) + + validateCertificateExpiryDate(cert); + ++ // Verify that the certificate can be used in a TLS context ++ const SSL_METHOD* method = TLS_method(); ++ std::unique_ptr<SSL_CTX, decltype(&::SSL_CTX_free)> ctx(SSL_CTX_new(method), ++ SSL_CTX_free); ++ if (SSL_CTX_use_certificate(ctx.get(), cert.get()) != 1) ++ { ++ log<level::ERR>("Certificate is not usable", ++ entry("ERRCODE=%x", ERR_get_error())); ++ elog<InvalidCertificate>(Reason("Certificate is not usable")); ++ } ++ + // Invoke type specific append private key function. + auto appendIter = appendKeyMap.find(certType); + if (appendIter == appendKeyMap.end()) +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/certificate/phosphor-certificate-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/certificate/phosphor-certificate-manager_%.bbappend new file mode 100644 index 000000000..f46e1b596 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/certificate/phosphor-certificate-manager_%.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" + +SRCREV = "c4522d2ea747e139dc97238b58c9609ac9d11776" +SRC_URI += "file://0001-Verify-that-certificate-is-loadable-in-SSL-context.patch" + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Klocwork-fix-fruDevice.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Klocwork-fix-fruDevice.patch new file mode 100644 index 000000000..c2faddce2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Klocwork-fix-fruDevice.patch @@ -0,0 +1,41 @@ +From c3286fb24b5d10557dbe2f91e03db6230e1d3b9a Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Tue, 15 Jun 2021 10:02:07 -0700 +Subject: [PATCH] Klocwork fix - fruDevice + +Fix for Klocwork issues. + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + src/FruDevice.cpp | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp +index e1e95f8..a2078a1 100644 +--- a/src/FruDevice.cpp ++++ b/src/FruDevice.cpp +@@ -903,7 +903,7 @@ static std::pair<DecodeState, std::string> + + case FRUDataEncoding::sixBitASCII: + { +- unsigned int accum; ++ unsigned int accum = 0; + unsigned int accumBitLen = 0; + value = std::string(); + for (i = 0; i < len; i++, iter++) +@@ -982,7 +982,11 @@ bool formatFru(const std::vector<char>& fruBytes, + std::tm fruTime = intelEpoch(); + std::time_t timeValue = std::mktime(&fruTime); + timeValue += minutes * 60; +- fruTime = *std::gmtime(&timeValue); ++ std::tm* realTime = std::gmtime(&timeValue); ++ if (realTime != NULL) ++ { ++ fruTime = *realTime; ++ } + + // Tue Nov 20 23:08:00 2018 + char timeString[32] = {0}; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend index 212797329..7b84000dc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -4,4 +4,5 @@ SRCREV = "e18edb5badc2e16181cfc464a6ccd0ef51dc4548" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0001-Add-retries-to-mapper-calls.patch \ - file://0002-Improve-initialization-of-I2C-sensors.patch" + file://0002-Improve-initialization-of-I2C-sensors.patch \ + file://0003-Klocwork-fix-fruDevice.patch" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch index 54efbee8c..c10dadea4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch @@ -1,13 +1,13 @@ -From f2dd5e13a0774d8683542798dd96979f9d7a6691 Mon Sep 17 00:00:00 2001 +From f268c4679e391e213c36d2046f0d95b858f41054 Mon Sep 17 00:00:00 2001 From: Vernon Mauery <vernon.mauery@intel.com> Date: Tue, 29 Sep 2020 13:38:35 -0700 Subject: [PATCH] Fix delete image by ID and inhibit removal of bmc_active Delete image by ID was broken because when hitting the delete dbus interface, it recalculated the ID from the parent version, which then -does not match because of the random number addition that was added to -the ID when the parent interface was created. This saves away the parent -interface ID and recalls it rather than recalculating it. +does not match because of the random number addition that was added +to the ID when the parent interface was created. This saves away the +parent interface ID and recalls it rather than recalculating it. Also, there was a logic error in deleting images that would delete the active BMC image. This fixes up that error. @@ -17,6 +17,7 @@ Tested: run multiple back-to back updates and see that when the fwupd deleted and that the bmc_active interface is not deleted. Signed-off-by: Vernon Mauery <vernon.mauery@intel.com> +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- item_updater.cpp | 17 +++++++++++------ pfr_image_manager.cpp | 2 +- @@ -25,10 +26,10 @@ Signed-off-by: Vernon Mauery <vernon.mauery@intel.com> 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/item_updater.cpp b/item_updater.cpp -index db255d6..90970d3 100644 +index 8d7bb82..5bf8b87 100644 --- a/item_updater.cpp +++ b/item_updater.cpp -@@ -133,7 +133,7 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) +@@ -132,7 +132,7 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) activationState, associations))); auto versionPtr = std::make_unique<VersionClass>( @@ -37,7 +38,7 @@ index db255d6..90970d3 100644 std::bind(&ItemUpdater::erase, this, std::placeholders::_1)); versionPtr->deleteObject = std::make_unique<phosphor::software::manager::Delete>(bus, path, -@@ -247,7 +247,7 @@ void ItemUpdater::processBMCImage() +@@ -224,7 +224,7 @@ void ItemUpdater::processBMCImage() // Create Version instance for this version. auto versionPtr = std::make_unique<VersionClass>( @@ -46,7 +47,7 @@ index db255d6..90970d3 100644 std::bind(&ItemUpdater::erase, this, std::placeholders::_1)); auto isVersionFunctional = versionPtr->isFunctional(); if (!isVersionFunctional) -@@ -322,11 +322,11 @@ void ItemUpdater::erase(std::string entryId) +@@ -298,11 +298,11 @@ void ItemUpdater::erase(std::string entryId) auto it = versions.find(entryId); if (it != versions.end()) { @@ -61,8 +62,8 @@ index db255d6..90970d3 100644 + entry("VERSIONID=%s", entryId.c_str())); return; } - } -@@ -669,6 +669,11 @@ void ItemUpdater::freeSpace(Activation& caller) + +@@ -633,6 +633,11 @@ void ItemUpdater::freeSpace(Activation& caller) std::size_t count = 0; for (const auto& iter : activations) { @@ -75,10 +76,10 @@ index db255d6..90970d3 100644 server::Activation::Activations::Active) || (iter.second.get()->activation() == diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp -index 145237e..0c6c3d8 100644 +index ba73cc1..36f0a62 100644 --- a/pfr_image_manager.cpp +++ b/pfr_image_manager.cpp -@@ -308,7 +308,7 @@ int Manager::processImage(const std::string& imgFilePath) +@@ -265,7 +265,7 @@ int Manager::processImage(const std::string& imgFilePath) std::string objPath = std::string{SOFTWARE_OBJPATH} + '/' + id; auto versionPtr = std::make_unique<Version>( @@ -88,10 +89,10 @@ index 145237e..0c6c3d8 100644 versionPtr->deleteObject = std::make_unique<phosphor::software::manager::Delete>(bus, objPath, diff --git a/version.cpp b/version.cpp -index 18f3f4f..e6fd481 100644 +index f50500a..1471233 100644 --- a/version.cpp +++ b/version.cpp -@@ -182,7 +182,7 @@ void Delete::delete_() +@@ -181,7 +181,7 @@ void Delete::delete_() { if (parent.eraseCallback) { @@ -101,10 +102,10 @@ index 18f3f4f..e6fd481 100644 } diff --git a/version.hpp b/version.hpp -index 9cf76da..ae70ea8 100644 +index 5827c8a..ad1170a 100644 --- a/version.hpp +++ b/version.hpp -@@ -74,14 +74,15 @@ class Version : public VersionInherit +@@ -73,14 +73,15 @@ class Version : public VersionInherit * @param[in] callback - The eraseFunc callback */ Version(sdbusplus::bus::bus& bus, const std::string& objPath, @@ -115,16 +116,16 @@ index 9cf76da..ae70ea8 100644 + eraseFunc callback) : VersionInherit(bus, (objPath).c_str(), true), - eraseCallback(callback), versionStr(versionString) -+ eraseCallback(callback), extId(extId), versionStr(versionString) ++ eraseCallback(callback), versionStr(versionString), extId(extId) { // Set properties. purpose(versionPurpose); - version(versionString); -+ version(extId); ++ version(versionStr); path(filePath); // Emit deferred signal. emit_object_added(); -@@ -134,6 +135,15 @@ class Version : public VersionInherit +@@ -133,6 +134,15 @@ class Version : public VersionInherit */ bool isFunctional(); @@ -140,7 +141,7 @@ index 9cf76da..ae70ea8 100644 /** @brief Persistent Delete D-Bus object */ std::unique_ptr<Delete> deleteObject; -@@ -143,6 +153,7 @@ class Version : public VersionInherit +@@ -142,6 +152,7 @@ class Version : public VersionInherit private: /** @brief This Version's version string */ const std::string versionStr; @@ -149,5 +150,5 @@ index 9cf76da..ae70ea8 100644 } // namespace manager -- -2.17.1 +2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend index 623c4f77e..0b1bdf1e4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend @@ -20,6 +20,7 @@ SRC_URI += "file://0001-Add-more-error-types.patch \ SRC_URI_PFR = "file://0007-PFR-images-support.patch \ file://0008-PFR-image-HASH-verification.patch \ file://0010-Add-error-reporting-to-pfr_image_manager.patch \ + file://0015-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', SRC_URI_PFR, '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0042-Fix-nlohmann-json-dump-calls.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0042-Fix-nlohmann-json-dump-calls.patch new file mode 100644 index 000000000..c72f36d28 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0042-Fix-nlohmann-json-dump-calls.patch @@ -0,0 +1,451 @@ +From 7c93f19e80d6d6fb11710e112a7aa449c77924f6 Mon Sep 17 00:00:00 2001 +From: Ed Tanous <edtanous@google.com> +Date: Fri, 19 Feb 2021 08:51:17 -0800 +Subject: [PATCH] Fix nlohmann::json::dump calls + +The nlohmann::json::dump call needs to be called with specific arguments +to avoid throwing in failure cases. http connection already does this +properly, but a bunch of code has snuck in (mostly in redfish) that +ignores this, and calls it incorrectly. This can potentially lead to a +crash if the wrong thing throws on invalid UTF8 characters. + +This audits the whole codebase, and replaces every dump() call with the +correct dump(2, ' ', true, nlohmann::json::error_handler_t::replace) +call. For correct output, the callers should expect no change, and in +practice, this would require injecting non-utf8 characters into the +BMC. + +Tested: +Ran several of the endpoints/error conditions in question, including +some of the error cases. Observed correct responses. I don't know of a +security issue that would allow injecting invalid utf8 into the BMC, but +in theory if it were possible, this would prevent a crash. + +Signed-off-by: Ed Tanous <edtanous@google.com> +Change-Id: I4a15b8e260e3db129bc20484ade4ed5449f75ad0 +Signed-off-by: Terry S. Duncan <terry.s.duncan@linux.intel.com> +--- + http/http_connection.h | 3 +- + include/dbus_monitor.hpp | 3 +- + include/openbmc_dbus_rest.hpp | 6 ++- + .../include/event_service_manager.hpp | 12 +++-- + redfish-core/include/utils/json_utils.hpp | 30 ++++++++++-- + redfish-core/lib/account_service.hpp | 4 +- + redfish-core/lib/ethernet.hpp | 48 +++++++++++------- + redfish-core/lib/event_service.hpp | 4 +- + redfish-core/lib/hypervisor_ethernet.hpp | 7 ++- + redfish-core/lib/managers.hpp | 49 +++++++++++++------ + 10 files changed, 115 insertions(+), 51 deletions(-) + +diff --git a/http/http_connection.h b/http/http_connection.h +index 59a134f..4fb2d85 100644 +--- a/http/http_connection.h ++++ b/http/http_connection.h +@@ -660,7 +660,8 @@ class Connection : + else + { + res.jsonMode(); +- res.body() = res.jsonValue.dump(2, ' ', true); ++ res.body() = res.jsonValue.dump( ++ 2, ' ', true, nlohmann::json::error_handler_t::replace); + } + } + +diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp +index 9e22b9c..db0d07b 100644 +--- a/include/dbus_monitor.hpp ++++ b/include/dbus_monitor.hpp +@@ -110,7 +110,8 @@ inline int onPropertyUpdate(sd_bus_message* m, void* userdata, + return 0; + } + +- connection->sendText(j.dump()); ++ connection->sendText( ++ j.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); + return 0; + } + +diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp +index c41a568..00d849a 100644 +--- a/include/openbmc_dbus_rest.hpp ++++ b/include/openbmc_dbus_rest.hpp +@@ -508,7 +508,9 @@ int convertJsonToDbus(sd_bus_message* m, const std::string& arg_type, + const nlohmann::json& input_json) + { + int r = 0; +- BMCWEB_LOG_DEBUG << "Converting " << input_json.dump() ++ BMCWEB_LOG_DEBUG << "Converting " ++ << input_json.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace) + << " to type: " << arg_type; + const std::vector<std::string> argTypes = dbusArgSplit(arg_type); + +@@ -917,7 +919,7 @@ int readDictEntryFromMessage(const std::string& typeCode, + { + // json doesn't support non-string keys. If we hit this condition, + // convert the result to a string so we can proceed +- key = key.dump(); ++ key = key.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + keyPtr = key.get_ptr<const std::string*>(); + // in theory this can't fail now, but lets be paranoid about it + // anyway +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 470636f..633e096 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -462,7 +462,8 @@ class Subscription + {"Name", "Event Log"}, + {"Events", logEntryArray}}; + +- this->sendEvent(msg.dump()); ++ this->sendEvent( ++ msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); + this->eventSeqNum++; + } + +@@ -526,7 +527,8 @@ class Subscription + {"Name", "Event Log"}, + {"Events", logEntryArray}}; + +- this->sendEvent(msg.dump()); ++ this->sendEvent( ++ msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); + this->eventSeqNum++; + } + #endif +@@ -573,7 +575,8 @@ class Subscription + {"MetricReportDefinition", {{"@odata.id", metricReportDef}}}, + {"MetricValues", metricValuesArray}}; + +- this->sendEvent(msg.dump()); ++ this->sendEvent( ++ msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); + } + + void updateRetryConfig(const uint32_t retryAttempts, +@@ -826,7 +829,8 @@ class EventServiceManager + + const std::string tmpFile(std::string(eventServiceFile) + "_tmp"); + std::ofstream ofs(tmpFile, std::ios::out); +- const auto& writeData = jsonData.dump(); ++ const auto& writeData = jsonData.dump( ++ 2, ' ', true, nlohmann::json::error_handler_t::replace); + ofs << writeData; + ofs.close(); + +diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp +index fbb259d..1252746 100644 +--- a/redfish-core/include/utils/json_utils.hpp ++++ b/redfish-core/include/utils/json_utils.hpp +@@ -222,12 +222,20 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, + { + if (!jsonValue.is_array()) + { +- messages::propertyValueTypeError(res, res.jsonValue.dump(), key); ++ messages::propertyValueTypeError( ++ res, ++ res.jsonValue.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ key); + return false; + } + if (jsonValue.size() != value.size()) + { +- messages::propertyValueTypeError(res, res.jsonValue.dump(), key); ++ messages::propertyValueTypeError( ++ res, ++ res.jsonValue.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ key); + return false; + } + size_t index = 0; +@@ -242,7 +250,11 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, + { + if (!jsonValue.is_array()) + { +- messages::propertyValueTypeError(res, res.jsonValue.dump(), key); ++ messages::propertyValueTypeError( ++ res, ++ res.jsonValue.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ key); + return false; + } + +@@ -261,11 +273,19 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, + { + if (ec == UnpackErrorCode::invalidType) + { +- messages::propertyValueTypeError(res, jsonValue.dump(), key); ++ messages::propertyValueTypeError( ++ res, ++ jsonValue.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ key); + } + else if (ec == UnpackErrorCode::outOfRange) + { +- messages::propertyValueNotInList(res, jsonValue.dump(), key); ++ messages::propertyValueNotInList( ++ res, ++ jsonValue.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ key); + } + return false; + } +diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp +index 8ef1434..1619a3e 100644 +--- a/redfish-core/lib/account_service.hpp ++++ b/redfish-core/lib/account_service.hpp +@@ -240,7 +240,9 @@ static void handleRoleMapPatch( + { + BMCWEB_LOG_ERROR << "Can't delete the object"; + messages::propertyValueTypeError( +- asyncResp->res, thisJson.dump(), ++ asyncResp->res, ++ thisJson.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), + "RemoteRoleMapping/" + std::to_string(index)); + return; + } +diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp +index b1a9f69..fc909ce 100644 +--- a/redfish-core/lib/ethernet.hpp ++++ b/redfish-core/lib/ethernet.hpp +@@ -1421,8 +1421,11 @@ class EthernetInterface : public Node + { + if ((!input.is_array()) || input.empty()) + { +- messages::propertyValueTypeError(asyncResp->res, input.dump(), +- "IPv4StaticAddresses"); ++ messages::propertyValueTypeError( ++ asyncResp->res, ++ input.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ "IPv4StaticAddresses"); + return; + } + +@@ -1450,7 +1453,10 @@ class EthernetInterface : public Node + "Gateway", gateway)) + { + messages::propertyValueFormatError( +- asyncResp->res, thisJson.dump(), pathString); ++ asyncResp->res, ++ thisJson.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ pathString); + return; + } + +@@ -1569,12 +1575,12 @@ class EthernetInterface : public Node + messages::resourceCannotBeDeleted(asyncResp->res); + return; + } +- else +- { +- messages::propertyValueFormatError( +- asyncResp->res, thisJson.dump(), pathString); +- return; +- } ++ messages::propertyValueFormatError( ++ asyncResp->res, ++ thisJson.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ pathString); ++ return; + } + + if (thisJson.is_null()) +@@ -1619,8 +1625,11 @@ class EthernetInterface : public Node + { + if (!input.is_array() || input.empty()) + { +- messages::propertyValueTypeError(asyncResp->res, input.dump(), +- "IPv6StaticAddresses"); ++ messages::propertyValueTypeError( ++ asyncResp->res, ++ input.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ "IPv6StaticAddresses"); + return; + } + size_t entryIdx = 1; +@@ -1640,7 +1649,10 @@ class EthernetInterface : public Node + address, "PrefixLength", prefixLength)) + { + messages::propertyValueFormatError( +- asyncResp->res, thisJson.dump(), pathString); ++ asyncResp->res, ++ thisJson.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ pathString); + return; + } + +@@ -1706,12 +1718,12 @@ class EthernetInterface : public Node + messages::resourceCannotBeDeleted(asyncResp->res); + return; + } +- else +- { +- messages::propertyValueFormatError( +- asyncResp->res, thisJson.dump(), pathString); +- return; +- } ++ messages::propertyValueFormatError( ++ asyncResp->res, ++ thisJson.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ pathString); ++ return; + } + + if (thisJson.is_null()) +diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp +index 7a29af5..dd5cf32 100644 +--- a/redfish-core/lib/event_service.hpp ++++ b/redfish-core/lib/event_service.hpp +@@ -472,7 +472,9 @@ class EventDestinationCollection : public Node + else + { + messages::propertyValueFormatError( +- asyncResp->res, mrdObj.dump(), ++ asyncResp->res, ++ mrdObj.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), + "MetricReportDefinitions"); + return; + } +diff --git a/redfish-core/lib/hypervisor_ethernet.hpp b/redfish-core/lib/hypervisor_ethernet.hpp +index 7b64c20..6fb301f 100644 +--- a/redfish-core/lib/hypervisor_ethernet.hpp ++++ b/redfish-core/lib/hypervisor_ethernet.hpp +@@ -521,8 +521,11 @@ class HypervisorInterface : public Node + address, "SubnetMask", subnetMask, + "Gateway", gateway)) + { +- messages::propertyValueFormatError(asyncResp->res, +- thisJson.dump(), pathString); ++ messages::propertyValueFormatError( ++ asyncResp->res, ++ thisJson.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace), ++ pathString); + return; + } + +diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp +index 7832e81..176d146 100644 +--- a/redfish-core/lib/managers.hpp ++++ b/redfish-core/lib/managers.hpp +@@ -865,8 +865,10 @@ static CreatePIDRet createPidInterface( + "PositiveHysteresis", doubles["PositiveHysteresis"], + "NegativeHysteresis", doubles["NegativeHysteresis"])) + { +- BMCWEB_LOG_ERROR << "Line:" << __LINE__ << ", Illegal Property " +- << it.value().dump(); ++ BMCWEB_LOG_ERROR << "Line:" << __LINE__ ++ << "Illegal Property " ++ << it.value().dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return CreatePIDRet::fail; + } + if (zones) +@@ -972,8 +974,10 @@ static CreatePIDRet createPidInterface( + failSafePercent, "MinThermalOutput", + minThermalOutput)) + { +- BMCWEB_LOG_ERROR << "Line:" << __LINE__ << ", Illegal Property " +- << it.value().dump(); ++ BMCWEB_LOG_ERROR << "Line:" << __LINE__ ++ << "Illegal Property " ++ << it.value().dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return CreatePIDRet::fail; + } + +@@ -984,8 +988,11 @@ static CreatePIDRet createPidInterface( + if (!redfish::json_util::readJson(*chassisContainer, response->res, + "@odata.id", chassisId)) + { +- BMCWEB_LOG_ERROR << "Line:" << __LINE__ << ", Illegal Property " +- << chassisContainer->dump(); ++ BMCWEB_LOG_ERROR << "Line:" << __LINE__ ++ << "Illegal Property " ++ << chassisContainer->dump( ++ 2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return CreatePIDRet::fail; + } + +@@ -1022,8 +1029,10 @@ static CreatePIDRet createPidInterface( + "NegativeHysteresis", negativeHysteresis, "Direction", + direction)) + { +- BMCWEB_LOG_ERROR << "Line:" << __LINE__ << ", Illegal Property " +- << it.value().dump(); ++ BMCWEB_LOG_ERROR << "Line:" << __LINE__ ++ << "Illegal Property " ++ << it.value().dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return CreatePIDRet::fail; + } + +@@ -1057,8 +1066,10 @@ static CreatePIDRet createPidInterface( + target, "Output", output)) + { + BMCWEB_LOG_ERROR << "Line:" << __LINE__ +- << ", Illegal Property " +- << it.value().dump(); ++ << "Illegal Property " ++ << it.value().dump( ++ 2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return CreatePIDRet::fail; + } + readings.emplace_back(target); +@@ -1299,8 +1310,10 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues> + "FanControllers", fanControllers, "FanZones", fanZones, + "StepwiseControllers", stepwiseControllers, "Profile", profile)) + { +- BMCWEB_LOG_ERROR << "Line:" << __LINE__ << ", Illegal Property " +- << data.dump(); ++ BMCWEB_LOG_ERROR << "Line:" << __LINE__ ++ << "Illegal Property " ++ << data.dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return; + } + configuration.emplace_back("PidControllers", std::move(pidControllers)); +@@ -1822,8 +1835,10 @@ class Manager : public Node + std::optional<nlohmann::json> openbmc; + if (!redfish::json_util::readJson(*oem, res, "OpenBmc", openbmc)) + { +- BMCWEB_LOG_ERROR << "Line:" << __LINE__ << ", Illegal Property " +- << oem->dump(); ++ BMCWEB_LOG_ERROR << "Line:" << __LINE__ ++ << "Illegal Property " ++ << oem->dump(2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return; + } + if (openbmc) +@@ -1832,8 +1847,10 @@ class Manager : public Node + if (!redfish::json_util::readJson(*openbmc, res, "Fan", fan)) + { + BMCWEB_LOG_ERROR << "Line:" << __LINE__ +- << ", Illegal Property " +- << openbmc->dump(); ++ << "Illegal Property " ++ << openbmc->dump( ++ 2, ' ', true, ++ nlohmann::json::error_handler_t::replace); + return; + } + if (fan) +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0043-account_service-Fix-incorrect-pointer-dereference.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0043-account_service-Fix-incorrect-pointer-dereference.patch new file mode 100644 index 000000000..263a7412d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0043-account_service-Fix-incorrect-pointer-dereference.patch @@ -0,0 +1,40 @@ +From 2cfacab5512cdf9802b267138d06d955989c8593 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Tue, 15 Jun 2021 01:38:43 +0530 +Subject: [PATCH] account_service: Fix incorrect pointer dereference flow + +The pointer is being dereferenced before checking for null. +Moved dereferencing of pointer to occur after null check. + +Tested: + -Built Successfully + -No regressions observed. + +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + redfish-core/lib/account_service.hpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp +index 1619a3e..9263090 100644 +--- a/redfish-core/lib/account_service.hpp ++++ b/redfish-core/lib/account_service.hpp +@@ -122,13 +122,14 @@ void userErrorMessageHandler(const sd_bus_error* e, + const std::string& newUser, + const std::string& username) + { +- const char* errorMessage = e->name; + if (e == nullptr) + { + messages::internalError(asyncResp->res); + return; + } + ++ const char* errorMessage = e->name; ++ + if (strcmp(errorMessage, + "xyz.openbmc_project.User.Common.Error.UserNameExists") == 0) + { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend index b409243a4..3f4eb3f72 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -56,6 +56,8 @@ SRC_URI += "file://0001-Firmware-update-support-for-StandBySpare.patch \ file://0039-Return-InternalError-on-DBus-error.patch \ file://0040-Add-boundary-check-to-avoid-crash.patch \ file://0041-Revamp-Redfish-Event-Log-Unique-ID-Generation.patch \ + file://0042-Fix-nlohmann-json-dump-calls.patch \ + file://0043-account_service-Fix-incorrect-pointer-dereference.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch index 3f01cd2c8..d119b4d4f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch @@ -1,4 +1,4 @@ -From 644165bf32fd6e757c261881987d127a865cbf2b Mon Sep 17 00:00:00 2001 +From b0baf051a2b56e87d63d047c4a09a00d6d4bb955 Mon Sep 17 00:00:00 2001 From: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com> Date: Mon, 23 Mar 2020 22:19:07 +0530 Subject: [PATCH] Add dbus method SlotIpmbRequest @@ -33,8 +33,7 @@ ipmitool raw 0x3e 0x51 0 0x01 0xb0 0x6 1 Note: Tested for all possible negative test cases and it works fine. Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@intel.com> - -%% original patch: 0001-Add-dbus-method-SlotIpmbRequest.patch +Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> --- CMakeLists.txt | 2 +- include/linux/i2c.h | 159 ++++++++++++++++++++++++++++++++ @@ -240,7 +239,7 @@ index 0876db7..ff570c6 100644 ] } diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp -index e0eadfc..72ede8c 100644 +index e0eadfc..6e998bf 100644 --- a/ipmbbridged.cpp +++ b/ipmbbridged.cpp @@ -18,6 +18,11 @@ @@ -362,7 +361,6 @@ index e0eadfc..72ede8c 100644 + std::shared_ptr<IpmbRequest> request, + const uint8_t pcieSlot) +{ -+ makeRequestValid(request); + std::filesystem::path p = + "/dev/i2c-mux/PCIE_Mux/Pcie_Slot_" + std::to_string(pcieSlot); + @@ -386,6 +384,7 @@ index e0eadfc..72ede8c 100644 + return returnStatus(ipmbResponseStatus::error); + } + ++ makeRequestValid(request); + uint8_t size = buffer.size(); + + const uint8_t slaveAddrIndex = 1; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs/0001-Add-WA-for-host-OS-not-retrying-when-BMC-times-out.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs/0001-Add-WA-for-host-OS-not-retrying-when-BMC-times-out.patch new file mode 100644 index 000000000..5b9ba9820 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs/0001-Add-WA-for-host-OS-not-retrying-when-BMC-times-out.patch @@ -0,0 +1,61 @@ +From b8ab6980db2132276b0b74335710fe43a7a0c5b0 Mon Sep 17 00:00:00 2001 +From: "Terry S. Duncan" <terry.s.duncan@linux.intel.com> +Date: Tue, 23 Feb 2021 14:55:02 -0800 +Subject: [PATCH] Add WA for host OS not retrying when BMC times out + +Patch was submitted upstream to add return codes to list being retried. +This work around changes the completion code to one that the OS will +retry. + +Signed-off-by: Terry S. Duncan <terry.s.duncan@linux.intel.com> +--- + kcsbridged.cpp | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/kcsbridged.cpp b/kcsbridged.cpp +index 38911fa..b72cede 100644 +--- a/kcsbridged.cpp ++++ b/kcsbridged.cpp +@@ -191,16 +191,21 @@ class SmsChannel + if (ec) + { + log<level::ERR>( +- "kcs<->ipmid bus error:", entry("NETFN=0x%02x", netfn), +- entry("LUN=0x%02x", lun), entry("CMD=0x%02x", cmd), ++ "kcs<->ipmid DBus error:", ++ entry("NETFN=0x%02x", netfnCap), ++ entry("LUN=0x%02x", lunCap), ++ entry("CMD=0x%02x", cmdCap), + entry("ERROR=%s", ec.message().c_str())); +- // send unspecified error for a D-Bus error +- constexpr uint8_t ccResponseNotAvailable = 0xce; +- rsp.resize(sizeof(netfn) + sizeof(cmd) + sizeof(cc)); ++ // Send cannot-execute error for a D-Bus error. ++ // This CC gets retried by the host driver. ++ constexpr uint8_t ccCannotExecute = 0xd5; ++ rsp.resize(sizeof(netfnCap) + sizeof(cmdCap) + sizeof(cc)); ++ ++ // DBUS fail response will have zeros; copy values from req. + rsp[0] = + ((netfnCap + 1) << netFnShift) | (lunCap & lunMask); + rsp[1] = cmdCap; +- rsp[2] = ccResponseNotAvailable; ++ rsp[2] = ccCannotExecute; + } + else + { +@@ -233,8 +238,9 @@ class SmsChannel + "Failed to send rsp msg", entry("SIZE=%d", wlen), + entry("EXPECT=%d", rsp.size()), + entry("ERROR=%s", ecWr.message().c_str()), +- entry("NETFN=0x%02x", netfn), entry("LUN=0x%02x", lun), +- entry("CMD=0x%02x", cmd), entry("CC=0x%02x", cc)); ++ entry("NETFN=0x%02x", netfnCap), ++ entry("LUN=0x%02x", lunCap), ++ entry("CMD=0x%02x", cmdCap), entry("CC=0x%02x", cc)); + } + }, + ipmiQueueService, ipmiQueuePath, ipmiQueueIntf, ipmiQueueMethod, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend index a3dceb01e..d19fe8014 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -13,7 +13,9 @@ SYSTEMD_SERVICE_${PN}_append = " ${PN}@${SMM_DEVICE}.service " SRC_URI = "git://github.com/openbmc/kcsbridge.git" SRCREV = "d8594e9a62feb8b2fac789159966b4782b4aa31e" -SRC_URI += "file://99-ipmi-kcs.rules" +SRC_URI += "file://99-ipmi-kcs.rules \ + file://0001-Add-WA-for-host-OS-not-retrying-when-BMC-times-out.patch \ +" do_install_append() { install -d ${D}${base_libdir}/udev/rules.d diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch new file mode 100644 index 000000000..d4c6a3847 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch @@ -0,0 +1,47 @@ +From 0b1184586b34ae40976e307d30fc44c3ed71dc11 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Fri, 25 Jun 2021 20:23:26 +0530 +Subject: [PATCH] crypt_algo: Null check on Cipher context + +There is no Null check performed while creating a new +Cipher contex. OPENSSL_zalloc can return NULL. + +Tested: No regression observed + +Change-Id: Ibc135adf9a20783c72116587ed3c45e3d457b3ad +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + crypt_algo.cpp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/crypt_algo.cpp b/crypt_algo.cpp +index c51465f..d5be1cb 100644 +--- a/crypt_algo.cpp ++++ b/crypt_algo.cpp +@@ -103,6 +103,11 @@ std::vector<uint8_t> AlgoAES128::decryptData(const uint8_t* iv, + // Initializes Cipher context + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + ++ if (!ctx) ++ { ++ throw std::runtime_error("EVP_CIPHER_CTX failed"); ++ } ++ + auto cleanupFunc = [](EVP_CIPHER_CTX* ctx) { EVP_CIPHER_CTX_free(ctx); }; + + std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(ctx, +@@ -164,6 +169,11 @@ std::vector<uint8_t> AlgoAES128::encryptData(const uint8_t* input, + // Initializes Cipher context + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + ++ if (!ctx) ++ { ++ throw std::runtime_error("EVP_CIPHER_CTX failed"); ++ } ++ + auto cleanupFunc = [](EVP_CIPHER_CTX* ctx) { EVP_CIPHER_CTX_free(ctx); }; + + std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(ctx, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend index fcf8df18d..f10bb6ef4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -23,6 +23,7 @@ SRC_URI += " file://10-nice-rules.conf \ file://0006-Modify-dbus-namespace-of-chassis-control-for-guid.patch \ file://0009-Add-dbus-interface-for-sol-commands.patch \ file://0011-Remove-Get-SOL-Config-Command-from-Netipmid.patch \ + file://0012-crypt_algo-Null-check-on-Cipher-context.patch \ " do_install_append() { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Add-check-for-min-max-received-from-hwmon-files.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Add-check-for-min-max-received-from-hwmon-files.patch new file mode 100644 index 000000000..2abfcbd41 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Add-check-for-min-max-received-from-hwmon-files.patch @@ -0,0 +1,95 @@ +From 540b694667c659e2e811ddbb86a73d3356cc1885 Mon Sep 17 00:00:00 2001 +From: Zbigniew Lukwinski <zbigniew.lukwinski@linux.intel.com> +Date: Wed, 21 Apr 2021 15:01:18 +0200 +Subject: [PATCH] Add check for min/max received from hwmon files + + When hwmon reports incorrect min/max values or CPU Sensor cannot access + readings, it shall keep the last known good readings and not update + DBus with incorrect values. + This patch adds min < max verification check for the values received + from hwmon and removes check for power on/off in the case of a read + failure. + + Tested manually on a physical platform, test cases cover incorrect + max/min values and failing access to hwmon files. + SDR over IPMI can be fully received in the case of error. + +Signed-off-by: Wojciech Dembinski <wojciech.dembinski@intel.com> +Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@linux.intel.com> +--- + src/CPUSensor.cpp | 40 ++++++++++++++++++++++------------------ + 1 file changed, 22 insertions(+), 18 deletions(-) + +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index f96b178..a17d5db 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -156,16 +156,21 @@ void CPUSensor::setupRead(void) + + void CPUSensor::updateMinMaxValues(void) + { ++ double newMin = std::numeric_limits<double>::quiet_NaN(); ++ double newMax = std::numeric_limits<double>::quiet_NaN(); ++ + const boost::container::flat_map< + std::string, + std::vector<std::tuple<const char*, std::reference_wrapper<double>, +- const char*>>> ++ const char*, std::reference_wrapper<double>>>> + map = { + { + "cap", + { +- std::make_tuple("cap_max", std::ref(maxValue), "MaxValue"), +- std::make_tuple("cap_min", std::ref(minValue), "MinValue"), ++ std::make_tuple("cap_max", std::ref(maxValue), "MaxValue", ++ std::ref(newMax)), ++ std::make_tuple("cap_min", std::ref(minValue), "MinValue", ++ std::ref(newMin)), + }, + }, + }; +@@ -178,26 +183,25 @@ void CPUSensor::updateMinMaxValues(void) + { + for (const auto& vectorItem : mapIt->second) + { +- auto [suffix, oldValue, dbusName] = vectorItem; ++ auto [suffix, oldValue, dbusName, newValue] = vectorItem; + auto attrPath = boost::replace_all_copy(path, fileItem, suffix); +- if (auto newVal = +- readFile(attrPath, CPUSensor::sensorScaleFactor)) ++ if (auto tmp = readFile(attrPath, CPUSensor::sensorScaleFactor)) + { +- updateProperty(sensorInterface, oldValue, *newVal, +- dbusName); ++ newValue.get() = *tmp; + } + else + { +- if (isPowerOn()) +- { +- updateProperty(sensorInterface, oldValue, 0, dbusName); +- } +- else +- { +- updateProperty(sensorInterface, oldValue, +- std::numeric_limits<double>::quiet_NaN(), +- dbusName); +- } ++ newValue.get() = std::numeric_limits<double>::quiet_NaN(); ++ } ++ } ++ if (std::isfinite(newMin) && std::isfinite(newMax) && ++ (newMin < newMax)) ++ { ++ for (const auto& vectorItem : mapIt->second) ++ { ++ auto& [suffix, oldValue, dbusName, newValue] = vectorItem; ++ updateProperty(sensorInterface, oldValue, newValue, ++ dbusName); + } + } + } +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend index 5cdb6c525..ab5fdac56 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -7,6 +7,7 @@ SRCREV = "8aeffd91ff3434f7812e9fdb6b0b03c6119921dd" SRC_URI += "\ file://intrusionsensor-depend-on-networkd.conf \ file://0001-Fix-for-intrusionsensor-service-crash.patch \ + file://0003-Add-check-for-min-max-received-from-hwmon-files.patch \ " DEPENDS_append = " libgpiod libmctp" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend index a0141f2b7..36b155fe9 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend @@ -1,14 +1,4 @@ SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2" FILESEXTRAPATHS_prepend_intel := "${THISDIR}/${PN}:" -SRCREV = "6313c9df615fd85a8617c46444f964b972abdebd" - -# Adding the code below as a workaround as -# favicon gets corrupted during emit due to issue with html-webpack-plugin. -# This workaround needs to be removed once this issue is fixed in the -# newer version of html-webpack-plugin -do_compile_append() { - rm -rf ${S}/dist/favicon.ico.gz - mv ${S}/dist/favicon.gz ${S}/dist/favicon.ico.gz - rm -rf ${S}/dist/app.bundle.js.LICENSE.txt.gz -} +SRCREV = "2397c142c0d75c7705757a52848945b00928232d" |