From cd8549453858d3865e1798566fb2e7f1d2f8ec5e Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Mon, 11 Jan 2021 12:27:14 -0800 Subject: Update to internal 1.00-40 Signed-off-by: Jason M. Bills --- .../files/0053-Disable-SoC-debug-feature.patch | 35 ++ .../recipes-bsp/u-boot/u-boot-aspeed_%.bbappend | 1 + .../configuration/entity-manager/WC-Baseboard.json | 4 +- ...-threshold-de-assert-event-when-threshold.patch | 37 +- ...eshold-hysteresis-to-one-percent-of-criti.patch | 58 +++ ...008-Fix-sensor-lost-issue-on-TEMP-PSU-etc.patch | 35 ++ ...use-available-interface-for-error-handlin.patch | 52 +++ ...rt-log-debug-information-for-sensor-thres.patch | 283 +++++++++++++ ...ngStateGood-before-updating-thresholds-pr.patch | 137 +++++++ ...PSUSensors-Move-to-GetSensorConfiguration.patch | 148 +++++++ .../0013-Fix-ExitAirTempSensor-calculation.patch | 263 ++++++++++++ .../sensors/dbus-sensors_%.bbappend | 10 +- .../classes/obmc-phosphor-image-common.bbclass | 1 - .../meta-common/classes/systemd-watchdog.bbclass | 49 --- ...elist-Allow-set-securitymode-cmd-from-KCS.patch | 49 +++ ...d-sufficient-delay-to-create-smbios2-file.patch | 39 ++ .../recipes-core/ipmi/intel-ipmi-oem_%.bbappend | 2 + .../recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf | 2 + .../recipes-core/nv-sync/nv-sync_git.bb | 6 +- .../recipes-core/systemd/systemd_%.bbappend | 2 +- .../recipes-extended/pam/libpam_%.bbappend | 6 + .../0001-libjpeg-turbo-fix-package_qa-error.patch | 32 ++ .../recipes-graphics/jpeg/libjpeg-turbo_2.0.5.bb | 59 +++ .../libvncserver/libvncserver_%.bbappend | 2 +- .../recipes-intel/smbios/smbios-mdrv2.bb | 6 +- ...0001-Replace-throw-with-log-error-message.patch | 130 ------ ...i2c-aspeed-clear-slave-addresses-in-probe.patch | 33 ++ .../1002-Filter-erroneous-adc-readings.patch | 59 +++ ...-Fix-race-in-the-perf_mmap_close-function.patch | 98 +++++ ...01-block-Fix-use-after-free-in-blkdev_get.patch | 194 +++++++++ ...-fix-null-ptr-deref-in-serial8250_start_t.patch | 90 +++++ ...ix-a-memory-leak-in-perf_event_parse_addr.patch | 92 +++++ ...01-icmp-randomize-the-global-rate-limiter.patch | 51 +++ ...lose-race-between-munmap-and-expand_upwar.patch | 89 ++++ ...m-check-that-mm-is-still-valid-in-madvise.patch | 72 ++++ .../0001-tty-Fix-session-locking.patch | 204 ++++++++++ .../0001-tty-Fix-pgrp-locking-in-tiocspgrp.patch | 46 +++ .../recipes-kernel/linux/linux-aspeed/intel.cfg | 3 + .../recipes-kernel/linux/linux-aspeed_%.bbappend | 59 +++ .../network/static-mac-addr/mac-check | 20 +- ...002-Improve-initialization-of-I2C-sensors.patch | 450 +++++++++++++++++++++ .../configuration/entity-manager_%.bbappend | 3 +- ...re-SIG_QUIT-signal-in-obmc-console-server.patch | 37 ++ .../console/obmc-console_%.bbappend | 1 + ...fficient-delay-to-create-fw-update-object.patch | 7 +- ...-fix-for-duplicate-redfish-event-log-ID-s.patch | 68 ++++ .../0033-Redfish-validator-conformance-fix.patch | 121 ++++++ ...fix-bmcweb-crash-during-sol-communication.patch | 75 ++++ ...-Use-non-throw-version-of-remote_endpoint.patch | 55 +++ ...Severity-for-ServiceFailure-redfish-event.patch | 56 +++ .../recipes-phosphor/interfaces/bmcweb_%.bbappend | 5 + .../intrusionsensor-depend-on-networkd.conf | 3 + .../sensors/dbus-sensors_%.bbappend | 17 +- .../recipes-phosphor/watchdog/system-watchdog.bb | 12 - .../watchdog-clear-failures.service | 10 - .../system-watchdog/watchdog-clear-failures.timer | 8 - .../watchdog/system-watchdog/watchdog-reset.sh | 18 - .../system-watchdog/watchdog-reset@.service | 7 - .../webui/phosphor-webui_%.bbappend | 12 +- ...ory-thermtrip-events-based-on-DIMM-status.patch | 22 +- 60 files changed, 3267 insertions(+), 278 deletions(-) create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/files/0053-Disable-SoC-debug-feature.patch create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0007-Fix-ADC-threshold-hysteresis-to-one-percent-of-criti.patch create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0008-Fix-sensor-lost-issue-on-TEMP-PSU-etc.patch create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0009-NVMeSensor-use-available-interface-for-error-handlin.patch create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0010-revert-revert-log-debug-information-for-sensor-thres.patch create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0011-Check-readingStateGood-before-updating-thresholds-pr.patch create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0012-PSUSensors-Move-to-GetSensorConfiguration.patch create mode 100644 meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0013-Fix-ExitAirTempSensor-calculation.patch delete mode 100644 meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass create mode 100644 meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0007-ipmi-whitelist-Allow-set-securitymode-cmd-from-KCS.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0008-Add-sufficient-delay-to-create-smbios2-file.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf create mode 100644 meta-openbmc-mods/meta-common/recipes-graphics/jpeg/files/0001-libjpeg-turbo-fix-package_qa-error.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-graphics/jpeg/libjpeg-turbo_2.0.5.bb delete mode 100644 meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0125-i2c-aspeed-clear-slave-addresses-in-probe.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1002-Filter-erroneous-adc-readings.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-14351/0001-perf-core-Fix-race-in-the-perf_mmap_close-function.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15436/0001-block-Fix-use-after-free-in-blkdev_get.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15437/0001-serial-8250-fix-null-ptr-deref-in-serial8250_start_t.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25704/0001-perf-core-Fix-a-memory-leak-in-perf_event_parse_addr.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25705/0001-icmp-randomize-the-global-rate-limiter.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29369/0001-mm-mmap.c-close-race-between-munmap-and-expand_upwar.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29372/0001-mm-check-that-mm-is-still-valid-in-madvise.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29660/0001-tty-Fix-session-locking.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29661/0001-tty-Fix-pgrp-locking-in-tiocspgrp.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Improve-initialization-of-I2C-sensors.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/0001-Ignore-SIG_QUIT-signal-in-obmc-console-server.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0032-fix-for-duplicate-redfish-event-log-ID-s.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0033-Redfish-validator-conformance-fix.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0036-fix-bmcweb-crash-during-sol-communication.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Use-non-throw-version-of-remote_endpoint.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Change-Severity-for-ServiceFailure-redfish-event.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/intrusionsensor-depend-on-networkd.conf delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.service delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.timer delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset@.service diff --git a/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/files/0053-Disable-SoC-debug-feature.patch b/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/files/0053-Disable-SoC-debug-feature.patch new file mode 100644 index 000000000..999afedf7 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/files/0053-Disable-SoC-debug-feature.patch @@ -0,0 +1,35 @@ +From 39d80e444fb704e48d0163735ae181117e2e1adf Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Fri, 20 Nov 2020 10:59:10 -0800 +Subject: [PATCH] Disable SoC debug feature + +This commit disables Aspeed SoC debug feature due to security +concerns. + +Signed-off-by: Jae Hyun Yoo +--- + arch/arm/mach-aspeed/platform_g5.S | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/arch/arm/mach-aspeed/platform_g5.S b/arch/arm/mach-aspeed/platform_g5.S +index ef43d5d400c1..2c8bf03b0eff 100644 +--- a/arch/arm/mach-aspeed/platform_g5.S ++++ b/arch/arm/mach-aspeed/platform_g5.S +@@ -582,6 +582,14 @@ espi_early_init_done: + mov r1, #0xAE + str r1, [r0] + ++#if !defined(CONFIG_ASPEED_SOC_DEBUG) ++ /* Disable SoC debug */ ++ ldr r0, =0x1e6e202c ++ ldr r1, [r0] ++ orr r1, r1, #0x400 ++ str r1, [r0] ++#endif ++ + #ifdef CONFIG_HW_WATCHDOG + /* Enable WDT2 to recover u-boot hang */ + ldr r0, =0x1e785024 +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend b/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend index a229bd969..6cc1e960c 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/u-boot-aspeed_%.bbappend @@ -49,6 +49,7 @@ SRC_URI_append_intel-ast2500 = " \ file://0049-Add-WDT-to-u-boot-to-cover-booting-failures.patch \ file://0051-Add-Aspeed-DRAM-stress-test-command.patch \ file://0052-Fix-issue-on-host-console-is-broken-due-to-BMC-reset.patch \ + file://0053-Disable-SoC-debug-feature.patch \ " # CVE-2020-10648 vulnerability fix SRC_URI_append_intel-ast2500 = " \ diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json index 1d2048335..840553183 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/configuration/entity-manager/WC-Baseboard.json @@ -805,7 +805,7 @@ "Type": "IpmbSensor" }, { - "Address": "0xDC", + "Address": "0xE0", "Class": "PxeBridgeTemp", "Name": "CPU1 VR Mem ABCD Temp", "Thresholds": [ @@ -2356,7 +2356,7 @@ "Type": "TMP75" }, { - "Address": "0x48", + "Address": "0x4C", "Bus": 6, "Name": "PCH M.2 Temp", "Thresholds": [ diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0002-Fix-missing-threshold-de-assert-event-when-threshold.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0002-Fix-missing-threshold-de-assert-event-when-threshold.patch index 13f9a157a..419119ee7 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0002-Fix-missing-threshold-de-assert-event-when-threshold.patch +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0002-Fix-missing-threshold-de-assert-event-when-threshold.patch @@ -1,11 +1,11 @@ -From 8990f3d3d3d74c0bed2c0920073e1ecfd4ff422d Mon Sep 17 00:00:00 2001 +From ea4181e323a222909250f641e9153a37c238efdc Mon Sep 17 00:00:00 2001 From: Zhikui Ren Date: Thu, 24 Sep 2020 14:27:32 -0700 Subject: [PATCH] Fix missing threshold de-assert event when threshold changes. Destructor can be called when sensor interface changes -like a new threshold value. Ensure adc sensor hresholds are de-asserted -on destruction. These events can be missed if the new threshold +like a new threshold value. Ensure adc sensor thresholds are de-asserted +dueing re-construction. These events can be missed if the new threshold value fixed the alarm because default state for new threshold interface is de-asserted. @@ -47,33 +47,40 @@ index ca2b0a0..1d1b1b5 100644 { bool used; diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp -index 7afb2ab..701c58e 100644 +index c3980e0..440073e 100644 --- a/src/ADCSensor.cpp +++ b/src/ADCSensor.cpp -@@ -88,6 +88,18 @@ ADCSensor::~ADCSensor() - // close the input dev to cancel async operations - inputDev.close(); - waitTimer.cancel(); +@@ -80,6 +80,17 @@ ADCSensor::ADCSensor(const std::string& path, + association = objectServer.add_interface( + "/xyz/openbmc_project/sensors/voltage/" + name, association::interface); + setInitialProperties(conn); + + // Destructor can be called when sensor interface changes -+ // like a new threshold value. Ensure LOW thresholds are de-asserted -+ // on destruction. These events can be missed if the new threshold -+ // value fixed the alarm because default state for new threshold ++ // like a new threshold value. Ensure thresholds are de-asserted ++ // on construction. These events can be missed if the new threshold ++ // value fixes the alarm because default state for new threshold + // interface is de-asserted. + for (auto& threshold : thresholds) + { + thresholds::forceDeassertThresholds(this, threshold.level, + threshold.direction); + } + } + + ADCSensor::~ADCSensor() +@@ -87,6 +98,7 @@ ADCSensor::~ADCSensor() + // close the input dev to cancel async operations + inputDev.close(); + waitTimer.cancel(); + objServer.remove_interface(thresholdInterfaceWarning); objServer.remove_interface(thresholdInterfaceCritical); objServer.remove_interface(sensorInterface); diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp -index 6aa077c..e480554 100644 +index caab22c..850a295 100644 --- a/src/Thresholds.cpp +++ b/src/Thresholds.cpp -@@ -344,6 +344,7 @@ bool checkThresholds(Sensor* sensor) +@@ -332,6 +332,7 @@ bool checkThresholds(Sensor* sensor) { bool status = true; std::vector changes = checkThresholds(sensor, sensor->value); @@ -81,7 +88,7 @@ index 6aa077c..e480554 100644 for (const auto& change : changes) { assertThresholds(sensor, change.assertValue, change.threshold.level, -@@ -452,6 +453,67 @@ void assertThresholds(Sensor* sensor, double assertValue, +@@ -450,6 +451,67 @@ void assertThresholds(Sensor* sensor, double assertValue, } } @@ -126,7 +133,7 @@ index 6aa077c..e480554 100644 + return; + } + -+ if (interface->set_property(property, false)) ++ if (interface->set_property(property, false)) + { + try + { diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0007-Fix-ADC-threshold-hysteresis-to-one-percent-of-criti.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0007-Fix-ADC-threshold-hysteresis-to-one-percent-of-criti.patch new file mode 100644 index 000000000..c86ec7730 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0007-Fix-ADC-threshold-hysteresis-to-one-percent-of-criti.patch @@ -0,0 +1,58 @@ +From 845e79aefc258780815c07cf0bcf4bb850b8a387 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Thu, 8 Oct 2020 14:40:45 -0700 +Subject: [PATCH] Fix ADC reading max value + +Correct the constant for adc's maxReading. Threshold hysteresis +is calculated as one percent of the ADC range. This fixes the +issue that lower voltage thresholds do not get de-asserted. + +Tested: +Overwrite the sensor to high value and then back to normal reading. +Verified that threshold is asserted and then de-asserted. + +Console output: +busctl set-property xyz.openbmc_project.ADCSensor /xyz/openbmc_project/sensors/voltage/PVDQ_ABC_CPU1 xyz.openbmc_project.Sensor.Value Value d 1.348 +intel-obmc adcsensor[412]: Sensor PVDQ_ABC_CPU1 high threshold 1.301 assert: value 1.348 raw data 1244 +intel-obmc adcsensor[412]: Sensor PVDQ_ABC_CPU1 high threshold 1.263 assert: value 1.348 raw data 1244 +intel-obmc ipmid[242]: thresholdChanged: Assert +intel-obmc ipmid[242]: thresholdChanged: Assert +intel-obmc sel-logger[288]: PVDQ_ABC_CPU1 sensor crossed a critical high threshold going high. Reading=1.348000 Threshold=1.301000. +intel-obmc sel-logger[288]: PVDQ_ABC_CPU1 sensor crossed a warning high threshold going high. Reading=1.348000 Threshold=1.263000. +intel-obmc ipmid[242]: thresholdChanged: deassert +intel-obmc ipmid[242]: thresholdChanged: deassert +intel-obmc sel-logger[288]: PVDQ_ABC_CPU1 sensor crossed a critical high threshold going low. Reading=1.244000 Threshold=1.301000. +intel-obmc sel-logger[288]: PVDQ_ABC_CPU1 sensor crossed a warning high threshold going low. Reading=1.244000 Threshold=1.263000. + +Signed-off-by: Zhikui Ren +--- + src/ADCSensor.cpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp +index ede4dfd..a446030 100644 +--- a/src/ADCSensor.cpp ++++ b/src/ADCSensor.cpp +@@ -42,7 +42,7 @@ static constexpr unsigned int gpioBridgeEnableMs = 20; + static constexpr unsigned int sensorScaleFactor = 1000; + + static constexpr double roundFactor = 10000; // 3 decimal places +-static constexpr double maxReading = 20; ++static constexpr double maxReading = 1.8; // adc reference is 1.8Volt + static constexpr double minReading = 0; + + ADCSensor::ADCSensor(const std::string& path, +@@ -55,8 +55,8 @@ ADCSensor::ADCSensor(const std::string& path, + std::optional&& bridgeGpio) : + Sensor(boost::replace_all_copy(sensorName, " ", "_"), + std::move(_thresholds), sensorConfiguration, +- "xyz.openbmc_project.Configuration.ADC", maxReading, minReading, +- readState), ++ "xyz.openbmc_project.Configuration.ADC", maxReading / scaleFactor, ++ minReading / scaleFactor, readState), + std::enable_shared_from_this(), objServer(objectServer), + inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path), + scaleFactor(scaleFactor), bridgeGpio(std::move(bridgeGpio)), +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0008-Fix-sensor-lost-issue-on-TEMP-PSU-etc.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0008-Fix-sensor-lost-issue-on-TEMP-PSU-etc.patch new file mode 100644 index 000000000..8d8dae230 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0008-Fix-sensor-lost-issue-on-TEMP-PSU-etc.patch @@ -0,0 +1,35 @@ +From dd4ac2200b111ac0215d7a2695137b9b0c382fc7 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Thu, 15 Oct 2020 15:46:48 +0800 +Subject: [PATCH] Fix sensor lost issue on TEMP/PSU/etc. + +When AC cycle or FW update, some sensors like TEMP and PSU +related are lost due to entity manager is not ready before +sensor service creating sensors. +Enable retry by default to make sure entity manager is ready. + +Tested: +All sensors like TEMP and PSU related are working well, +even at AC cycle and FW update. + +Signed-off-by: Kuiying Wang +--- + include/Utils.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/Utils.hpp b/include/Utils.hpp +index 2c6ce9e..7b38bc1 100644 +--- a/include/Utils.hpp ++++ b/include/Utils.hpp +@@ -211,7 +211,7 @@ struct GetSensorConfiguration : + } + + void getConfiguration(const std::vector& interfaces, +- size_t retries = 0) ++ size_t retries = 3) + { + if (retries > 5) + { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0009-NVMeSensor-use-available-interface-for-error-handlin.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0009-NVMeSensor-use-available-interface-for-error-handlin.patch new file mode 100644 index 000000000..e32c4aa9e --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0009-NVMeSensor-use-available-interface-for-error-handlin.patch @@ -0,0 +1,52 @@ +From f9c37dfab29007ce988ddb32293d9c31de0eb042 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Wed, 11 Nov 2020 07:41:03 -0800 +Subject: [PATCH 09/12] NVMeSensor: use available interface for error handling + +Sensor available and functional interfaces are used to +handle sensor not readable and read errors. +Update NVMeSensor to use them. + +Tested +No regression detected in NVMeSensor read value + +Signed-off-by: Zhikui Ren +Change-Id: Iabaf2508d14b3562cfe04992c9558a0114a9665e +--- + src/NVMeSensor.cpp | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp +index cbc88ec..8d6d4b3 100644 +--- a/src/NVMeSensor.cpp ++++ b/src/NVMeSensor.cpp +@@ -265,7 +265,7 @@ static double getTemperatureReading(int8_t reading) + { + // 0x80 = No temperature data or temperature data is more the 5 s + // old 0x81 = Temperature sensor failure +- return maxReading; ++ return std::numeric_limits::quiet_NaN(); + } + + return reading; +@@ -365,7 +365,16 @@ void rxMessage(uint8_t eid, void*, void* msg, size_t len) + << " Celsius for device " << sensorInfo->name << "\n"; + } + +- sensorInfo->updateValue(getTemperatureReading(messageData[5])); ++ double value = getTemperatureReading(messageData[5]); ++ if (!std::isfinite(value)) ++ { ++ sensorInfo->markAvailable(false); ++ sensorInfo->incrementError(); ++ } ++ else ++ { ++ sensorInfo->updateValue(value); ++ } + + if (DEBUG) + { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0010-revert-revert-log-debug-information-for-sensor-thres.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0010-revert-revert-log-debug-information-for-sensor-thres.patch new file mode 100644 index 000000000..9aef0d714 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0010-revert-revert-log-debug-information-for-sensor-thres.patch @@ -0,0 +1,283 @@ +From b52dd2b668fda6cd2e4afb7662a4d2721efe9855 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Fri, 11 Sep 2020 17:02:01 -0700 +Subject: [PATCH 10/12] revert "revert log debug information for sensor + threshold assert events" + +Add back the orignial submit 9bf6804c2d76b92005ad9851cb052d407ea3117f +and includes the fix the bug that crashed ipmbsensor. + +log debug information for sensor threshold assert events + +There are sightings that TCPUx_P12_PVCCIO_VS_Temp Sensor +reports reading of zero and trips the low critical threshold. +Add debug prints to gather data. + +Also add logs for raw value in sensor base class to help +debug threshold assert events for other sensor type. + +Tested: +Verified that log messages show up as expected for threshold +assert events. There is no unwanted log messages on systems that +do not have bad sensor readings. +Verified system stayed up for 30 minutes without crashing. + +Signed-off-by: Zhikui Ren +Change-Id: I73e00e24bbae463dbe0f34e2308ee934588028d1 +--- + include/sensor.hpp | 1 + + src/ADCSensor.cpp | 20 ++++++++++++++++---- + src/CPUSensor.cpp | 4 ++-- + src/HwmonTempSensor.cpp | 21 +++++++++++++++++---- + src/IpmbSensor.cpp | 12 ++++++++++++ + src/PSUSensor.cpp | 4 ++-- + src/TachSensor.cpp | 4 ++-- + src/Thresholds.cpp | 16 ++++++++++++++-- + 8 files changed, 66 insertions(+), 16 deletions(-) + +diff --git a/include/sensor.hpp b/include/sensor.hpp +index a8321fd..7fa9300 100644 +--- a/include/sensor.hpp ++++ b/include/sensor.hpp +@@ -48,6 +48,7 @@ struct Sensor + std::shared_ptr availableInterface; + std::shared_ptr operationalInterface; + double value = std::numeric_limits::quiet_NaN(); ++ double rawValue = std::numeric_limits::quiet_NaN(); + bool overriddenState = false; + bool internalSet = false; + double hysteresisTrigger; +diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp +index a446030..0cdb0ac 100644 +--- a/src/ADCSensor.cpp ++++ b/src/ADCSensor.cpp +@@ -79,6 +79,7 @@ ADCSensor::ADCSensor(const std::string& path, + } + association = objectServer.add_interface( + "/xyz/openbmc_project/sensors/voltage/" + name, association::interface); ++ + setInitialProperties(conn); + } + +@@ -179,11 +180,9 @@ void ADCSensor::handleResponse(const boost::system::error_code& err) + // todo read scaling factors from configuration + try + { +- double nvalue = std::stod(response); +- +- nvalue = (nvalue / sensorScaleFactor) / scaleFactor; ++ rawValue = std::stod(response); ++ double nvalue = (rawValue / sensorScaleFactor) / scaleFactor; + nvalue = std::round(nvalue * roundFactor) / roundFactor; +- + updateValue(nvalue); + } + catch (std::invalid_argument&) +@@ -205,6 +204,7 @@ void ADCSensor::handleResponse(const boost::system::error_code& err) + int fd = open(path.c_str(), O_RDONLY); + if (fd < 0) + { ++ std::cerr << "adcsensor " << name << " failed to open " << path << "\n"; + return; // we're no longer valid + } + inputDev.assign(fd); +@@ -213,6 +213,14 @@ void ADCSensor::handleResponse(const boost::system::error_code& err) + std::shared_ptr self = weakRef.lock(); + if (ec == boost::asio::error::operation_aborted) + { ++ if (self) ++ { ++ std::cerr << "adcsensor " << self->name << " read cancelled\n"; ++ } ++ else ++ { ++ std::cerr << "adcsensor read cancelled no self\n"; ++ } + return; // we're being canceled + } + +@@ -220,6 +228,10 @@ void ADCSensor::handleResponse(const boost::system::error_code& err) + { + self->setupRead(); + } ++ else ++ { ++ std::cerr << "adcsensor weakref no self\n"; ++ } + }); + } + +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 401412f..f368150 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -223,9 +223,9 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + try + { + std::getline(responseStream, response); +- double nvalue = std::stod(response); ++ rawValue = std::stod(response); + responseStream.clear(); +- nvalue /= CPUSensor::sensorScaleFactor; ++ double nvalue = rawValue / CPUSensor::sensorScaleFactor; + + if (show) + { +diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp +index 5514504..8b91804 100644 +--- a/src/HwmonTempSensor.cpp ++++ b/src/HwmonTempSensor.cpp +@@ -106,6 +106,8 @@ void HwmonTempSensor::handleResponse(const boost::system::error_code& err) + if ((err == boost::system::errc::bad_file_descriptor) || + (err == boost::asio::error::misc_errors::not_found)) + { ++ std::cerr << "Hwmon temp sensor " << name << " removed " << path ++ << "\n"; + return; // we're being destroyed + } + std::istream responseStream(&readBuf); +@@ -115,16 +117,16 @@ void HwmonTempSensor::handleResponse(const boost::system::error_code& err) + std::getline(responseStream, response); + try + { +- double nvalue = std::stod(response); +- if (nvalue < 0) ++ rawValue = std::stod(response); ++ if (rawValue < 0) + { + std::cerr << "Hwmon temp sensor " << name +- << ": ignore negative rawValue " << nvalue << "\n"; ++ << ": ignore negative rawValue " << rawValue << "\n"; + incrementError(); + } + else + { +- nvalue /= sensorScaleFactor; ++ double nvalue = rawValue / sensorScaleFactor; + updateValue(nvalue); + } + } +@@ -143,6 +145,8 @@ void HwmonTempSensor::handleResponse(const boost::system::error_code& err) + int fd = open(path.c_str(), O_RDONLY); + if (fd < 0) + { ++ std::cerr << "Hwmon temp sensor " << name << " not valid " << path ++ << "\n"; + return; // we're no longer valid + } + inputDev.assign(fd); +@@ -152,6 +156,15 @@ void HwmonTempSensor::handleResponse(const boost::system::error_code& err) + std::shared_ptr self = weakRef.lock(); + if (ec == boost::asio::error::operation_aborted) + { ++ if (self) ++ { ++ std::cerr << "Hwmon temp sensor " << self->name ++ << " read cancelled " << self->path << "\n"; ++ } ++ else ++ { ++ std::cerr << "Hwmon sensor read cancelled, no self\n"; ++ } + return; // we're being canceled + } + if (self) +diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp +index 1855519..983e6d4 100644 +--- a/src/IpmbSensor.cpp ++++ b/src/IpmbSensor.cpp +@@ -349,6 +349,18 @@ void IpmbSensor::read(void) + read(); + return; + } ++ else ++ { ++ // rawValue only used in debug logging ++ // up to 5th byte in data are used to derive value ++ size_t end = std::min(sizeof(uint64_t), data.size()); ++ uint64_t rawData = 0; ++ for (size_t i = 0; i < end; i++) ++ { ++ reinterpret_cast(&rawData)[i] = data[i]; ++ } ++ rawValue = static_cast(rawData); ++ } + + /* Adjust value as per scale and offset */ + value = (value * scaleVal) + offsetVal; +diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp +index 6b27207..f93846d 100644 +--- a/src/PSUSensor.cpp ++++ b/src/PSUSensor.cpp +@@ -143,9 +143,9 @@ void PSUSensor::handleResponse(const boost::system::error_code& err) + try + { + std::getline(responseStream, response); +- double nvalue = std::stod(response); ++ rawValue = std::stod(response); + responseStream.clear(); +- nvalue /= sensorFactor; ++ double nvalue = rawValue / sensorFactor; + + updateValue(nvalue); + } +diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp +index ba3b0a1..acfe659 100644 +--- a/src/TachSensor.cpp ++++ b/src/TachSensor.cpp +@@ -149,9 +149,9 @@ void TachSensor::handleResponse(const boost::system::error_code& err) + try + { + std::getline(responseStream, response); +- double nvalue = std::stod(response); ++ rawValue = std::stod(response); + responseStream.clear(); +- updateValue(nvalue); ++ updateValue(rawValue); + } + catch (const std::invalid_argument&) + { +diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp +index ce1c759..30f8021 100644 +--- a/src/Thresholds.cpp ++++ b/src/Thresholds.cpp +@@ -244,6 +244,7 @@ static int cLoTrue = 0; + static int cLoFalse = 0; + static int cLoMidstate = 0; + static int cDebugThrottle = 0; ++static constexpr int assertLogCount = 10; + + struct ChangeParam + { +@@ -276,7 +277,12 @@ static std::vector checkThresholds(Sensor* sensor, double value) + if (value >= threshold.value) + { + thresholdChanges.emplace_back(threshold, true, value); +- ++cHiTrue; ++ if (++cHiTrue < assertLogCount) ++ { ++ std::cerr << "Sensor " << sensor->name << " high threshold " ++ << threshold.value << " assert: value " << value ++ << " raw data " << sensor->rawValue << "\n"; ++ } + } + else if (value < (threshold.value - sensor->hysteresisTrigger)) + { +@@ -293,7 +299,13 @@ static std::vector checkThresholds(Sensor* sensor, double value) + if (value <= threshold.value) + { + thresholdChanges.emplace_back(threshold, true, value); +- ++cLoTrue; ++ if (++cLoTrue < assertLogCount) ++ { ++ std::cerr << "Sensor " << sensor->name << " low threshold " ++ << threshold.value << " assert: value " ++ << sensor->value << " raw data " ++ << sensor->rawValue << "\n"; ++ } + } + else if (value > (threshold.value + sensor->hysteresisTrigger)) + { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0011-Check-readingStateGood-before-updating-thresholds-pr.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0011-Check-readingStateGood-before-updating-thresholds-pr.patch new file mode 100644 index 000000000..9fdea10fc --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0011-Check-readingStateGood-before-updating-thresholds-pr.patch @@ -0,0 +1,137 @@ +From 42edd5d855e2b405700fa5e25564d2df3bd171d9 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Thu, 1 Oct 2020 08:54:32 -0700 +Subject: [PATCH 11/12] Check readingStateGood before updating thresholds + property + +Sensor read function checks for readingStateGood before +start. But if host resets while reading is in progress, +incorrect sensor value maybe returned. +Check readingStateGood before changing threshold. + +Update checkThresholdsPowerDelay to start timer for both +high and low thresholds. +Update CPUSensor to use checkThresholdsPowerDelay to filter +out the high events that can happen during host reset. + +Tested: +Run host reset test for 500 cycles, no erronous sensor +events were reported. Before the change, same tests +never run more than 200 cycles. + +Signed-off-by: Zhikui Ren +Change-Id: I6a6645c2842651e07bbcefa295ae331ee036de45 +--- + include/CPUSensor.hpp | 1 + + src/CPUSensor.cpp | 22 ++++++++-------------- + src/Thresholds.cpp | 41 ++++++++++++++++++++--------------------- + 3 files changed, 29 insertions(+), 35 deletions(-) + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index 4a56b21..4f8f52c 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -50,6 +50,7 @@ class CPUSensor : public Sensor + bool loggedInterfaceDown = false; + void setupRead(void); + void handleResponse(const boost::system::error_code& err); ++ thresholds::ThresholdTimer thresholdTimer; + void checkThresholds(void) override; + void updateMinMaxValues(void); + }; +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index f368150..52d2a32 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -47,7 +47,8 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, + minReading, PowerState::on), + objServer(objectServer), busConn(conn), inputDev(io), waitTimer(io), + path(path), privTcontrol(std::numeric_limits::quiet_NaN()), +- dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs) ++ dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs), ++ thresholdTimer(io, this) + { + nameTcontrol = labelTcontrol; + nameTcontrol += " CPU" + std::to_string(cpuId); +@@ -288,18 +289,11 @@ void CPUSensor::checkThresholds(void) + { + if (show) + { +- // give the power match callback to have a chance to run +- // checkThresholds checks for host power state +- auto timer = std::make_shared( +- busConn->get_io_context()); +- timer->expires_after(std::chrono::milliseconds(100)); +- timer->async_wait([this, timer](boost::system::error_code ec) { +- if (ec) +- { +- // log the error but still check the thresholds +- std::cerr << "Cpu sensor threshold timer error!\n"; +- } +- thresholds::checkThresholds(this); +- }); ++ if (!readingStateGood()) ++ { ++ return; ++ } ++ ++ thresholds::checkThresholdsPowerDelay(this, thresholdTimer); + } + } +diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp +index 30f8021..3150faf 100644 +--- a/src/Thresholds.cpp ++++ b/src/Thresholds.cpp +@@ -365,29 +365,28 @@ void checkThresholdsPowerDelay(Sensor* sensor, ThresholdTimer& thresholdTimer) + std::vector changes = checkThresholds(sensor, sensor->value); + for (const auto& change : changes) + { +- // When CPU is powered off, some volatges are expected to +- // go below low thresholds. Filter these events with thresholdTimer. +- // 1. always delay the assertion of low events to see if they are +- // caused by power off event. +- // 2. conditional delay the de-assertion of low events if there is +- // an existing timer for assertion. +- // 3. no delays for de-assert of low events if there is an existing +- // de-assert for low event. This means 2nd de-assert would happen +- // first and when timer expires for the previous one, no additional +- // signal will be logged. +- // 4. no delays for all high events. +- if (change.threshold.direction == thresholds::Direction::LOW) ++ // When CPU is powered off, some voltages are expected to ++ // go below low thresholds. ++ // Some CPU sensors may appear to be high during the CPU reset. ++ // Delay the threshold check to let CPU power status gets updated first. ++ // 1. If there is already a timer for the same event, ++ // but not the opposite event, do nothing. ++ // 2. Add a delay timer for this event when ++ // a) There is already a timer for the same event and a timer for ++ // opposite event ++ // b) There is a timer for the opposite event only ++ // c) There is no timer for this threshold ++ // This would ensure that any "pulse" event is logged and ++ // last log represents the latest reading ++ ++ if (thresholdTimer.hasActiveTimer(change.threshold, change.asserted) && ++ !thresholdTimer.hasActiveTimer(change.threshold, !change.asserted)) + { +- if (change.asserted || thresholdTimer.hasActiveTimer( +- change.threshold, !change.asserted)) +- { +- thresholdTimer.startTimer(change.threshold, change.asserted, +- change.assertValue); +- continue; +- } ++ continue; // case 1 + } +- assertThresholds(sensor, change.assertValue, change.threshold.level, +- change.threshold.direction, change.asserted); ++ ++ thresholdTimer.startTimer(change.threshold, change.asserted, ++ change.assertValue); + } + } + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0012-PSUSensors-Move-to-GetSensorConfiguration.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0012-PSUSensors-Move-to-GetSensorConfiguration.patch new file mode 100644 index 000000000..b71956523 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0012-PSUSensors-Move-to-GetSensorConfiguration.patch @@ -0,0 +1,148 @@ +From 867d1a00e330e2490184794f2c3913694ad36f09 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Thu, 5 Nov 2020 22:32:28 -0800 +Subject: [PATCH 12/12] PSUSensors: Move to GetSensorConfiguration + +GetSensorConfiguration has improved to have retries +and avoid more expensive GetManagedOjects calls. Use +it. + +Tested +PSU sensors are created consistently ac_cycle test + +Signed-off-by: Zhikui Ren +Change-Id: Id6b374ff415cc7c6c0d83b55f12551556838f2b7 +--- + src/PSUSensorMain.cpp | 69 +++++++++++++++++++++++++++++-------------- + 1 file changed, 47 insertions(+), 22 deletions(-) + +diff --git a/src/PSUSensorMain.cpp b/src/PSUSensorMain.cpp +index be55089..86bf393 100644 +--- a/src/PSUSensorMain.cpp ++++ b/src/PSUSensorMain.cpp +@@ -216,27 +216,15 @@ static void + } + } + +-void createSensors(boost::asio::io_service& io, +- sdbusplus::asio::object_server& objectServer, +- std::shared_ptr& dbusConnection) ++static void createSensorsCallback( ++ boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr& dbusConnection, ++ const ManagedObjectType& sensorConfigs, ++ const std::shared_ptr>& ++ sensorsChanged) + { +- +- ManagedObjectType sensorConfigs; + int numCreated = 0; +- bool useCache = false; +- +- // TODO may need only modify the ones that need to be changed. +- sensors.clear(); +- for (const char* type : sensorTypes) +- { +- if (!getSensorConfiguration(type, dbusConnection, sensorConfigs, +- useCache)) +- { +- std::cerr << "error get sensor config from entity manager\n"; +- return; +- } +- useCache = true; +- } ++ bool firstScan = sensorsChanged == nullptr; + + std::vector pmbusPaths; + if (!findFiles(fs::path("/sys/class/hwmon"), "name", pmbusPaths)) +@@ -400,6 +388,23 @@ void createSensors(boost::asio::io_service& io, + std::cerr << "Cannot find psu name, invalid configuration\n"; + continue; + } ++ ++ // on rescans, only update sensors we were signaled by ++ if (!firstScan) ++ { ++ std::string psuNameStr = "/" + *psuName; ++ auto it = ++ std::find_if(sensorsChanged->begin(), sensorsChanged->end(), ++ [psuNameStr](std::string& s) { ++ return boost::ends_with(s, psuNameStr); ++ }); ++ ++ if (it == sensorsChanged->end()) ++ { ++ continue; ++ } ++ sensorsChanged->erase(it); ++ } + checkEvent(directory.string(), eventMatch, eventPathList); + checkGroupEvent(directory.string(), groupEventMatch, + groupEventPathList); +@@ -779,7 +784,8 @@ void createSensors(boost::asio::io_service& io, + << sensorPathStr << "\" type \"" << sensorType + << "\"\n"; + } +- ++ // destruct existing one first if already created ++ sensors[sensorName] = nullptr; + sensors[sensorName] = std::make_shared( + sensorPathStr, sensorType, objectServer, dbusConnection, io, + sensorName, std::move(sensorThresholds), *interfacePath, +@@ -808,6 +814,22 @@ void createSensors(boost::asio::io_service& io, + return; + } + ++void createSensors( ++ boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr& dbusConnection, ++ const std::shared_ptr>& ++ sensorsChanged) ++{ ++ auto getter = std::make_shared( ++ dbusConnection, [&io, &objectServer, &dbusConnection, sensorsChanged]( ++ const ManagedObjectType& sensorConfigs) { ++ createSensorsCallback(io, objectServer, dbusConnection, ++ sensorConfigs, sensorsChanged); ++ }); ++ getter->getConfiguration( ++ std::vector(sensorTypes.begin(), sensorTypes.end())); ++} ++ + void propertyInitialize(void) + { + sensorTable = {{"power", "power/"}, +@@ -891,10 +913,12 @@ int main() + systemBus->request_name("xyz.openbmc_project.PSUSensor"); + sdbusplus::asio::object_server objectServer(systemBus); + std::vector> matches; ++ auto sensorsChanged = ++ std::make_shared>(); + + propertyInitialize(); + +- io.post([&]() { createSensors(io, objectServer, systemBus); }); ++ io.post([&]() { createSensors(io, objectServer, systemBus, nullptr); }); + boost::asio::deadline_timer filterTimer(io); + std::function eventHandler = + [&](sdbusplus::message::message& message) { +@@ -903,6 +927,7 @@ int main() + std::cerr << "callback method error\n"; + return; + } ++ sensorsChanged->insert(message.get_path()); + filterTimer.expires_from_now(boost::posix_time::seconds(3)); + filterTimer.async_wait([&](const boost::system::error_code& ec) { + if (ec == boost::asio::error::operation_aborted) +@@ -913,7 +938,7 @@ int main() + { + std::cerr << "timer error\n"; + } +- createSensors(io, objectServer, systemBus); ++ createSensors(io, objectServer, systemBus, sensorsChanged); + }); + }; + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0013-Fix-ExitAirTempSensor-calculation.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0013-Fix-ExitAirTempSensor-calculation.patch new file mode 100644 index 000000000..8410083a6 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0013-Fix-ExitAirTempSensor-calculation.patch @@ -0,0 +1,263 @@ +From beab088e948956abd3d940c9cdc673e869f70e7c Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Thu, 3 Dec 2020 15:14:49 -0800 +Subject: [PATCH] Fix ExitAirTempSensor calculation + +Correct the scaling for tachMaxReading and tachMinReading + +Tested: +Use debug prints to verify that the scaling factor is calculated correctly. + +Signed-off-by: Zhikui Ren +Change-Id: Idf9c2aa916ac741ff047c5baea51a664c101c33d +--- + include/ExitAirTempSensor.hpp | 9 +- + src/ExitAirTempSensor.cpp | 151 ++++++++++++++++++++++++---------- + 2 files changed, 112 insertions(+), 48 deletions(-) + +diff --git a/include/ExitAirTempSensor.hpp b/include/ExitAirTempSensor.hpp +index e3c2ef5..a56eba5 100644 +--- a/include/ExitAirTempSensor.hpp ++++ b/include/ExitAirTempSensor.hpp +@@ -61,9 +61,6 @@ struct ExitAirTempSensor : + double alphaF; + double pOffset = 0; + +- // todo: make this private once we don't have to hack in a reading +- boost::container::flat_map powerReadings; +- + ExitAirTempSensor(std::shared_ptr& conn, + const std::string& name, + const std::string& sensorConfiguration, +@@ -74,13 +71,17 @@ struct ExitAirTempSensor : + void checkThresholds(void) override; + void updateReading(void); + void setupMatches(void); ++ void addPowerRanges(const std::string& serviceName, ++ const std::string& path); + + private: + double lastReading; + + std::vector matches; + double inletTemp = std::numeric_limits::quiet_NaN(); +- ++ boost::container::flat_map powerReadings; ++ boost::container::flat_map> ++ powerRanges; + std::shared_ptr dbusConnection; + sdbusplus::asio::object_server& objServer; + std::chrono::time_point lastTime; +diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp +index 94bfe5d..d27aa06 100644 +--- a/src/ExitAirTempSensor.cpp ++++ b/src/ExitAirTempSensor.cpp +@@ -207,22 +207,21 @@ void CFMSensor::setupMatches() + { + + std::shared_ptr self = shared_from_this(); +- setupSensorMatch(matches, *dbusConnection, "fan_tach", +- std::move([self](const double& value, +- sdbusplus::message::message& message) { +- self->tachReadings[message.get_path()] = value; +- if (self->tachRanges.find(message.get_path()) == +- self->tachRanges.end()) +- { +- // calls update reading after updating ranges +- self->addTachRanges(message.get_sender(), +- message.get_path()); +- } +- else +- { +- self->updateReading(); +- } +- })); ++ setupSensorMatch( ++ matches, *dbusConnection, "fan_tach", ++ [self](const double& value, sdbusplus::message::message& message) { ++ self->tachReadings[message.get_path()] = value; ++ if (self->tachRanges.find(message.get_path()) == ++ self->tachRanges.end()) ++ { ++ // calls update reading after updating ranges ++ self->addTachRanges(message.get_sender(), message.get_path()); ++ } ++ else ++ { ++ self->updateReading(); ++ } ++ }); + + dbusConnection->async_method_call( + [self](const boost::system::error_code ec, +@@ -539,25 +538,36 @@ void ExitAirTempSensor::setupMatches(void) + std::shared_ptr self = shared_from_this(); + for (const std::string& type : matchTypes) + { +- setupSensorMatch(matches, *dbusConnection, type, +- [self, type](const double& value, +- sdbusplus::message::message& message) { +- if (type == "power") +- { +- std::string path = message.get_path(); +- if (path.find("PS") != std::string::npos && +- boost::ends_with(path, "Input_Power")) +- { +- self->powerReadings[message.get_path()] = +- value; +- } +- } +- else if (type == inletTemperatureSensor) +- { +- self->inletTemp = value; +- } +- self->updateReading(); +- }); ++ setupSensorMatch( ++ matches, *dbusConnection, type, ++ [self, type](const double& value, ++ sdbusplus::message::message& message) { ++ if (type == "power") ++ { ++ std::string path = message.get_path(); ++ if (path.find("PS") != std::string::npos && ++ boost::ends_with(path, "Input_Power")) ++ { ++ self->powerReadings[message.get_path()] = value; ++ if (self->powerRanges.find(message.get_path()) == ++ self->powerRanges.end()) ++ { ++ // calls update reading after updating ranges ++ self->addPowerRanges(message.get_sender(), ++ message.get_path()); ++ } ++ else ++ { ++ self->updateReading(); ++ } ++ } ++ } ++ else if (type == inletTemperatureSensor) ++ { ++ self->inletTemp = value; ++ self->updateReading(); ++ } ++ }); + } + dbusConnection->async_method_call( + [self](boost::system::error_code ec, +@@ -620,6 +630,28 @@ void ExitAirTempSensor::setupMatches(void) + "/xyz/openbmc_project/sensors/power", 0, + std::array{sensorValueInterface}); + } ++void ExitAirTempSensor::addPowerRanges(const std::string& serviceName, ++ const std::string& path) ++{ ++ std::shared_ptr self = shared_from_this(); ++ dbusConnection->async_method_call( ++ [self, path](const boost::system::error_code ec, ++ const boost::container::flat_map& data) { ++ if (ec) ++ { ++ std::cerr << "Error getting properties from " << path << "\n"; ++ return; ++ } ++ ++ double max = loadVariant(data, "MaxValue"); ++ double min = loadVariant(data, "MinValue"); ++ self->powerRanges[path] = std::make_pair(min, max); ++ self->updateReading(); ++ }, ++ serviceName, path, "org.freedesktop.DBus.Properties", "GetAll", ++ "xyz.openbmc_project.Sensor.Value"); ++} + + void ExitAirTempSensor::updateReading(void) + { +@@ -654,14 +686,19 @@ double ExitAirTempSensor::getTotalCFM(void) + + bool ExitAirTempSensor::calculate(double& val) + { +- constexpr size_t maxErrorPrint = 1; ++ constexpr size_t maxErrorPrint = 5; + static bool firstRead = false; + static size_t errorPrint = maxErrorPrint; + + double cfm = getTotalCFM(); +- if (cfm <= 0) ++ if (cfm <= 0 || cfm > cfmMaxReading) + { +- std::cerr << "Error getting cfm\n"; ++ if (errorPrint > 0) ++ { ++ errorPrint--; ++ std::cerr << "Error getting cfm " << cfm << "\n"; ++ } ++ val = 0; + return false; + } + +@@ -691,6 +728,35 @@ bool ExitAirTempSensor::calculate(double& val) + { + continue; + } ++ ++ auto findRange = std::find_if( ++ powerRanges.begin(), powerRanges.end(), [&](const auto& item) { ++ return boost::ends_with(item.first, reading.first); ++ }); ++ ++ if (findRange == powerRanges.end()) ++ { ++ if (errorPrint > 0) ++ { ++ errorPrint--; ++ std::cerr << "Can't find ranges for " << reading.first ++ << " in ranges\n"; ++ } ++ continue; // haven't gotten a max / min ++ } ++ ++ if (reading.second > findRange->second.second) ++ { ++ if (errorPrint > 0) ++ { ++ errorPrint--; ++ std::cerr << "power reading " << reading.second ++ << " exceeded max " << findRange->second.second ++ << "\n"; ++ } ++ continue; ++ } ++ + totalPower += reading.second; + } + +@@ -836,6 +902,7 @@ void createSensor(sdbusplus::asio::object_server& objectServer, + std::move([&objectServer, &dbusConnection, + &exitAirSensor](const ManagedObjectType& resp) { + cfmSensors.clear(); ++ exitAirSensor = nullptr; + for (const auto& pathPair : resp) + { + for (const auto& entry : pathPair.second) +@@ -889,13 +956,9 @@ void createSensor(sdbusplus::asio::object_server& objectServer, + sensor->c2 = + loadVariant(entry.second, "C2") / 100; + sensor->tachMinPercent = +- loadVariant(entry.second, +- "TachMinPercent") / +- 100; ++ loadVariant(entry.second, "TachMinPercent"); + sensor->tachMaxPercent = +- loadVariant(entry.second, +- "TachMaxPercent") / +- 100; ++ loadVariant(entry.second, "TachMaxPercent"); + sensor->createMaxCFMIface(); + sensor->setupMatches(); + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors_%.bbappend index a265f04df..c9dcae795 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -5,4 +5,12 @@ SRC_URI += "file://0001-Only-allow-drive-sensors-on-bus-2-for-ast2500.patch \ file://0003-Fix-PSU-PWM-fan-control.patch \ file://0004-Check-readingStateGood-before-updating-thresholds-pr.patch \ file://0005-ExitAir-Move-to-GetSensorConfiguration.patch \ - file://0006-Treat-negative-temperatures-as-errors.patch" + file://0006-Treat-negative-temperatures-as-errors.patch \ + file://0007-Fix-ADC-threshold-hysteresis-to-one-percent-of-criti.patch \ + file://0008-Fix-sensor-lost-issue-on-TEMP-PSU-etc.patch \ + file://0009-NVMeSensor-use-available-interface-for-error-handlin.patch \ + file://0010-revert-revert-log-debug-information-for-sensor-thres.patch \ + file://0011-Check-readingStateGood-before-updating-thresholds-pr.patch \ + file://0012-PSUSensors-Move-to-GetSensorConfiguration.patch \ + file://0013-Fix-ExitAirTempSensor-calculation.patch \ + " diff --git a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass index 1caf28239..3d1d2ec2d 100644 --- a/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass +++ b/meta-openbmc-mods/meta-common/classes/obmc-phosphor-image-common.bbclass @@ -1,5 +1,4 @@ inherit obmc-phosphor-image -inherit systemd-watchdog IMAGE_INSTALL_append = " \ bmcweb \ diff --git a/meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass b/meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass deleted file mode 100644 index ec5209029..000000000 --- a/meta-openbmc-mods/meta-common/classes/systemd-watchdog.bbclass +++ /dev/null @@ -1,49 +0,0 @@ -add_watchdog_confs() { - - interval=10 # minutes - count=5 # allowed reboots - - for service in $(ls $D/lib/systemd/system | grep -o ".*service"); do - if [[ "$service" == *"mapper-wait"* ]]; then - continue - fi - - if [ "$service" = "system-watchdog.service" ]; then - continue - fi - - if [ "$service" = "systemd-coredump@.service" ]; then - continue - fi - - if [ "$service" = "systemd-timesyncd.service" ]; then - continue - fi - - if [ "$service" = "nv-sync.service" ]; then - continue - fi - - if cat $D/lib/systemd/system/${service} | grep oneshot > /dev/null; then - continue - fi - - folder="$D/etc/systemd/system/${service}.d" - mkdir -p "${folder}" - fname="${folder}/watchdog.conf" - echo "[Unit]" > ${fname} - echo "OnFailure=watchdog-reset@${service}.service" >> ${fname} - echo "[Service]" >> "${fname}" - echo "StartLimitInterval=${interval}min" >> "${fname}" - echo "StartLimitBurst=${count}" >> "${fname}" - echo "RestartSec=60" >> "${fname}" - - if cat $D/lib/systemd/system/${service} | grep Restart > /dev/null; then - continue - fi - echo "Restart=on-failure" >> "${fname}" - done - -} - -ROOTFS_POSTINSTALL_COMMAND += "add_watchdog_confs" diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0007-ipmi-whitelist-Allow-set-securitymode-cmd-from-KCS.patch b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0007-ipmi-whitelist-Allow-set-securitymode-cmd-from-KCS.patch new file mode 100644 index 000000000..9519ee651 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0007-ipmi-whitelist-Allow-set-securitymode-cmd-from-KCS.patch @@ -0,0 +1,49 @@ +From 5bdf25daa1c1857e5e24f8c7e593c303eff4285a Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Mon, 23 Nov 2020 01:01:24 +0000 +Subject: [PATCH] ipmi-whitelist:Allow set securitymode cmd from KCS + +Issue: Issuing set security mode for Provisioned Host Disabled command + is restricted from KCS channel. + +Fix: Allow set security mode command execution from KCS interface by + adding channel mask in ipmi-whitelist.conf + +Tested: +Verified using ipmitool raw command from Linux OS +1. Set restriction mode as ProvisionedHostWhitelist +Command: busctl set-property xyz.openbmc_project.RestrictionMode.Manager + /xyz/openbmc_project/control/security/restriction_mode + xyz.openbmc_project.Control.Security.RestrictionMode + RestrictionMode s + "xyz.openbmc_project.Control.Security.RestrictionMode.Modes. + ProvisionedHostWhitelist" +Response: //Success +2. Check the restriction mode +Command: ipmitool raw 0x30 0xb3 +Response: 04 00 +3. Execute set security mode for Provisioned Host Disabled command from Linux OS terminal +Command: ipmitool raw 0x30 0xb4 0x5 +Response: //Success + +Signed-off-by: Jayaprakash Mutyala +--- + ipmi-whitelist.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ipmi-whitelist.conf b/ipmi-whitelist.conf +index 6557b27..b7a3a8e 100644 +--- a/ipmi-whitelist.conf ++++ b/ipmi-whitelist.conf +@@ -273,7 +273,7 @@ + 0x30:0xb1:0x7f7f //: + 0x30:0xb2:0xff7f //: + 0x30:0xb3:0xff7f //: +-0x30:0xb4:0x7f7f //: ++0x30:0xb4:0xff7f //: + 0x30:0xb5:0x7f7f //: + 0x30:0xbb:0xff7f //: + 0x30:0xc2:0xff7f //: +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0008-Add-sufficient-delay-to-create-smbios2-file.patch b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0008-Add-sufficient-delay-to-create-smbios2-file.patch new file mode 100644 index 000000000..d918ae04c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem/0008-Add-sufficient-delay-to-create-smbios2-file.patch @@ -0,0 +1,39 @@ +From d935f43696149aeb047ff5adf15e22707903c215 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Wed, 2 Dec 2020 19:42:14 +0000 +Subject: [PATCH] Add sufficient delay to create smbios2 file + +Issue: Sometimes with existing defaultTimeout & sysClock delay, BIOS is +not responding with required information to create smbios2 file which +contains DIMM info. + +Fixed: Increase defaultTimeout & sysClock time to provide required delay +to get response from SMBIOS in order to populate DIMM information. + +Tested: +1. Verified for 100 DC cycles. +2. smbios2 file is generated for each cycle with proper DIMM information + +Signed-off-by: Jayaprakash Mutyala +--- + include/smbiosmdrv2handler.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/smbiosmdrv2handler.hpp b/include/smbiosmdrv2handler.hpp +index 8356d26..6a1f850 100644 +--- a/include/smbiosmdrv2handler.hpp ++++ b/include/smbiosmdrv2handler.hpp +@@ -57,8 +57,8 @@ static constexpr const size_t smbiosSMMemorySize = + 1024 * 1024; // Total size of VGA share memory + static constexpr const size_t smbiosTableStorageSize = + 64 * 1024; // Total size of smbios table +-static constexpr const uint32_t defaultTimeout = 200; +-static constexpr const uint8_t sysClock = 100; ++static constexpr const uint32_t defaultTimeout = 4000; ++static constexpr const uint16_t sysClock = 1000; + static constexpr const int lastAgentIndex = -1; + static constexpr const uint16_t lastAgentId = 0xFFFF; + constexpr const uint32_t invalidChecksum = 0xffffffff; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index 5bbf35e70..96830529f 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -13,4 +13,6 @@ SRC_URI += "file://0001-Fix-cold-redundancy-is-not-runing-as-user-configurat.pat file://0004-firmware-update-Add-Support-to-get-fwSecurityVer.patch \ file://0005-oemcommands-Fix-for-set-security-mode-to-mfg-mode.patch \ file://0006-Update-Product-ID-for-EEPROM-FRU-platforms.patch \ + file://0007-ipmi-whitelist-Allow-set-securitymode-cmd-from-KCS.patch \ + file://0008-Add-sufficient-delay-to-create-smbios2-file.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf new file mode 100644 index 000000000..e73e47129 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync-tmp.conf @@ -0,0 +1,2 @@ +x /tmp/.rwfs - - - - +x /tmp/.overlay - - - - diff --git a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb index 420fc258b..fa74149d4 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync_git.bb @@ -4,6 +4,7 @@ DESCRIPTION = "Script to periodically sync the overlay to NV storage" S = "${WORKDIR}" SRC_URI = "file://nv-sync.service \ file://nv-syncd \ + file://nv-sync-tmp.conf \ " LICENSE = "Apache-2.0" @@ -13,13 +14,16 @@ inherit systemd RDEPENDS_${PN} += "bash" -FILES_${PN} += "${systemd_system_unitdir}/nv-sync.service" +FILES_${PN} += "${systemd_system_unitdir}/nv-sync.service \ + ${libdir}/tmpfiles.d/nv-sync-tmp.conf" do_install() { install -d ${D}${systemd_system_unitdir} install -m 0644 ${WORKDIR}/nv-sync.service ${D}${systemd_system_unitdir} install -d ${D}${bindir} install -m 0755 ${WORKDIR}/nv-syncd ${D}${bindir}/nv-syncd + install -d ${D}${libdir}/tmpfiles.d + install -m 0644 ${WORKDIR}/nv-sync-tmp.conf ${D}${libdir}/tmpfiles.d/ } SYSTEMD_SERVICE_${PN} += " nv-sync.service" diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend index 985a9e5ba..e6df605aa 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend @@ -1,4 +1,4 @@ -# add some configuration overrides for systemd default /usr/lib/tmpfiles.d/ +# add some configuration overrides for systemd defaults LICENSE = "GPL-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-extended/pam/libpam_%.bbappend b/meta-openbmc-mods/meta-common/recipes-extended/pam/libpam_%.bbappend index 3c1c501ee..9dcc98dc4 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/pam/libpam_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-extended/pam/libpam_%.bbappend @@ -1 +1,7 @@ RDEPENDS_${PN}-runtime += "${MLPREFIX}pam-plugin-localuser-${libpam_suffix}" + +# Default settings: lockout duration to 300 seconds and threshold value to 10. +do_install_append() { + sed -i 's/deny=0/deny=10/' ${D}${sysconfdir}/pam.d/common-auth + sed -i 's/unlock_time=0/unlock_time=300/' ${D}${sysconfdir}/pam.d/common-auth +} diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/jpeg/files/0001-libjpeg-turbo-fix-package_qa-error.patch b/meta-openbmc-mods/meta-common/recipes-graphics/jpeg/files/0001-libjpeg-turbo-fix-package_qa-error.patch new file mode 100644 index 000000000..82fffe1e6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-graphics/jpeg/files/0001-libjpeg-turbo-fix-package_qa-error.patch @@ -0,0 +1,32 @@ +From 5cf847b5bef8dc3f9f89bd09dd5af4e6603f393c Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Mon, 27 Aug 2018 16:10:55 +0800 +Subject: [PATCH] libjpeg-turbo: fix package_qa error + +Fix package qa errors like below: +libjpeg.so.62.3.0 contains probably-redundant RPATH /usr/lib [useless-rpaths] +usr/bin/cjpeg contains probably-redundant RPATH /usr/lib + +Upstream-Status: Inappropriate[oe-specific] + +Signed-off-by: Changqing Li +Signed-off-by: Anuj Mittal +--- + CMakeLists.txt | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2bc3458..ea3041e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -189,10 +189,6 @@ endif() + report_option(ENABLE_SHARED "Shared libraries") + report_option(ENABLE_STATIC "Static libraries") + +-if(ENABLE_SHARED) +- set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) +-endif() +- + if(WITH_12BIT) + set(WITH_ARITH_DEC 0) + set(WITH_ARITH_ENC 0) diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/jpeg/libjpeg-turbo_2.0.5.bb b/meta-openbmc-mods/meta-common/recipes-graphics/jpeg/libjpeg-turbo_2.0.5.bb new file mode 100644 index 000000000..9729fb5dd --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-graphics/jpeg/libjpeg-turbo_2.0.5.bb @@ -0,0 +1,59 @@ +SUMMARY = "Hardware accelerated JPEG compression/decompression library" +DESCRIPTION = "libjpeg-turbo is a derivative of libjpeg that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression" +HOMEPAGE = "http://libjpeg-turbo.org/" + +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://cdjpeg.h;endline=13;md5=8184bcc7c4ac7b9edc6a7bc00f231d0b \ + file://jpeglib.h;endline=16;md5=7ea97dc83b0f59052ee837e61ef0e08f \ + file://djpeg.c;endline=11;md5=c59e19811c006cb38f82d6477134d314 \ +" +DEPENDS_append_x86-64_class-target = " nasm-native" +DEPENDS_append_x86_class-target = " nasm-native" + +SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \ + file://0001-libjpeg-turbo-fix-package_qa-error.patch \ + " + +SRC_URI[md5sum] = "3a7dc293918775fc933f81e2bce36464" +SRC_URI[sha256sum] = "16f8f6f2715b3a38ab562a84357c793dd56ae9899ce130563c72cd93d8357b5d" +UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/libjpeg-turbo/files/" +UPSTREAM_CHECK_REGEX = "/libjpeg-turbo/files/(?P(\d+[\.\-_]*)+)/" + +PE = "1" + +# Drop-in replacement for jpeg +PROVIDES = "jpeg" +RPROVIDES_${PN} += "jpeg" +RREPLACES_${PN} += "jpeg" +RCONFLICTS_${PN} += "jpeg" + +inherit cmake pkgconfig + +export NASMENV = "--debug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" + +# Add nasm-native dependency consistently for all build arches is hard +EXTRA_OECMAKE_append_class-native = " -DWITH_SIMD=False" +EXTRA_OECMAKE_append_class-nativesdk = " -DWITH_SIMD=False" + +# Work around missing x32 ABI support +EXTRA_OECMAKE_append_class-target = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", "-DWITH_SIMD=False", "", d)}" + +# Work around missing non-floating point ABI support in MIPS +EXTRA_OECMAKE_append_class-target = " ${@bb.utils.contains("MIPSPKGSFX_FPU", "-nf", "-DWITH_SIMD=False", "", d)}" + +# Provide a workaround if Altivec unit is not present in PPC +EXTRA_OECMAKE_append_class-target_powerpc = " ${@bb.utils.contains("TUNE_FEATURES", "altivec", "", "-DWITH_SIMD=False", d)}" +EXTRA_OECMAKE_append_class-target_powerpc64 = " ${@bb.utils.contains("TUNE_FEATURES", "altivec", "", "-DWITH_SIMD=False", d)}" + +DEBUG_OPTIMIZATION_append_armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" +DEBUG_OPTIMIZATION_append_armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" + +PACKAGES =+ "jpeg-tools libturbojpeg" + +DESCRIPTION_jpeg-tools = "The jpeg-tools package includes client programs to access libjpeg functionality. These tools allow for the compression, decompression, transformation and display of JPEG files and benchmarking of the libjpeg library." +FILES_jpeg-tools = "${bindir}/*" + +DESCRIPTION_libturbojpeg = "A SIMD-accelerated JPEG codec which provides only TurboJPEG APIs" +FILES_libturbojpeg = "${libdir}/libturbojpeg.so.*" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend index 6df8f5a89..8255fddbf 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend @@ -2,4 +2,4 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" # Use the latest to support obmc-ikvm properly SRC_URI = "git://github.com/LibVNC/libvncserver" -SRCREV = "b7195ce95c27255c14382bdc270b2972a7f9347b" +SRCREV = "2aa20dad4c23c18948d3f63b33f9dfec1f837729" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb index b56098722..df38debfa 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb @@ -2,7 +2,7 @@ SUMMARY = "SMBIOS MDR version 2 service for Intel based platform" DESCRIPTION = "SMBIOS MDR version 2 service for Intel based platfrom" SRC_URI = "git://github.com/Intel-BMC/mdrv2.git;protocol=ssh" -SRCREV = "095102dfb5e2374834e33d1ec1a5e61388208a9e" +SRCREV = "1573995f8949bbd76a17fb34bb6de056e81f391c" S = "${WORKDIR}/git" @@ -17,10 +17,6 @@ inherit obmc-phosphor-systemd SYSTEMD_SERVICE_${PN} += "smbios-mdrv2.service" SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.cpuinfo.service" - -SRC_URI += "file://0001-Replace-throw-with-log-error-message.patch \ -" - DEPENDS += " \ autoconf-archive-native \ boost \ diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch deleted file mode 100644 index 9cf75563e..000000000 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch +++ /dev/null @@ -1,130 +0,0 @@ -From b84c3bd333a7b67d7b7ff73e12c382aa529f3e5c Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Tue, 20 Oct 2020 15:44:41 +0800 -Subject: [PATCH] Replace throw with log error message. - -Replace throw with log error message and return. -When run into error, log error message but not crash -smbios service as throw did. - -Tested: -smbiosmdrv2app is working well. - -Change-Id: Ia2d40997987a0c84a613568d65f93006043459d0 -Signed-off-by: Kuiying Wang ---- - src/mdrv2.cpp | 37 ++++++++++++++++++++----------------- - 1 file changed, 20 insertions(+), 17 deletions(-) - -diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp -index 9a73c65..c1bc09d 100644 ---- a/src/mdrv2.cpp -+++ b/src/mdrv2.cpp -@@ -35,8 +35,9 @@ std::vector MDR_V2::getDirectoryInformation(uint8_t dirIndex) - if (dirIndex > smbiosDir.dirEntries) - { - responseDir.push_back(0); -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: -- InvalidParameter(); -+ phosphor::logging::log( -+ "getDirectoryInformation: Invalid Parameter"); -+ return responseDir; - } - responseDir.push_back(mdr2Version); - responseDir.push_back(smbiosDir.dirVersion); -@@ -117,8 +118,6 @@ std::vector MDR_V2::getDataOffer() - { - phosphor::logging::log( - "smbios is not ready for update"); -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: -- UpdateInProgress(); - } - return offer; - } -@@ -173,8 +172,9 @@ std::vector MDR_V2::getDataInformation(uint8_t idIndex) - - if (idIndex >= maxDirEntries) - { -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: -- InvalidParameter(); -+ phosphor::logging::log( -+ "getDataInformation: Invalid Parameter"); -+ return responseInfo; - } - - for (uint8_t index = 0; index < sizeof(DataIdStruct); index++) -@@ -253,15 +253,13 @@ bool MDR_V2::sendDirectoryInformation(uint8_t dirVersion, uint8_t dirIndex, - { - phosphor::logging::log( - "Send Dir info failed - input parameter invalid"); -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: -- InvalidParameter(); -+ return teminate; - } - if (dirEntry.size() < sizeof(Mdr2DirEntry)) - { - phosphor::logging::log( - "Directory size invalid"); -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: -- InvalidParameter(); -+ return teminate; - } - if (dirVersion == smbiosDir.dirVersion) - { -@@ -307,8 +305,9 @@ bool MDR_V2::sendDataInformation(uint8_t idIndex, uint8_t flag, - { - if (idIndex >= maxDirEntries) - { -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: -- InvalidParameter(); -+ phosphor::logging::log( -+ "sendDataInformation: Invalid Parameter"); -+ return false; - } - int entryChanged = 0; - if (smbiosDir.dir[idIndex].common.dataSetSize != dataLen) -@@ -341,8 +340,7 @@ int MDR_V2::findIdIndex(std::vector dataInfo) - { - phosphor::logging::log( - "Length of dataInfo invalid"); -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: -- InvalidParameter(); -+ return -1; - } - std::array arrayDataInfo; - -@@ -364,7 +362,9 @@ int MDR_V2::findIdIndex(std::vector dataInfo) - return index; - } - } -- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error::InvalidId(); -+ phosphor::logging::log( -+ "findIdIndex: Invalid ID"); -+ return -1; - } - - uint8_t MDR_V2::directoryEntries(uint8_t value) -@@ -546,7 +546,9 @@ std::vector> - - if (dataIn == nullptr) - { -- throw std::runtime_error("Data not populated"); -+ phosphor::logging::log( -+ "Data not populated"); -+ return ret; - } - - do -@@ -617,7 +619,8 @@ std::vector> - return ret; - } - -- throw std::invalid_argument("Invalid record type"); -+ phosphor::logging::log( -+ "Invalid record type"); - return ret; - } - --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0125-i2c-aspeed-clear-slave-addresses-in-probe.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0125-i2c-aspeed-clear-slave-addresses-in-probe.patch new file mode 100644 index 000000000..cd5fe4deb --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0125-i2c-aspeed-clear-slave-addresses-in-probe.patch @@ -0,0 +1,33 @@ +From 40af0a280cad30194c5ced83f6462c304d2f8c92 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Wed, 16 Dec 2020 12:49:16 -0800 +Subject: [PATCH] i2c: aspeed: clear slave addresses in probe + +Initial value of I2CD18 is undefined according to the datasheet +so this commit adds the I2CD18 register clearing code into bus +initialization function to prevent any unexpected slave match +events. + +Signed-off-by: Jae Hyun Yoo +Change-Id: I6c6cadeaf6fefcf74eba0d96c49986a810ccbb51 +--- + drivers/i2c/busses/i2c-aspeed.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c +index d622ca14eb2a..d48489c803a8 100644 +--- a/drivers/i2c/busses/i2c-aspeed.c ++++ b/drivers/i2c/busses/i2c-aspeed.c +@@ -1610,6 +1610,9 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) + writel(0, bus->base + ASPEED_I2C_INTR_CTRL_REG); + writel(0xffffffff, bus->base + ASPEED_I2C_INTR_STS_REG); + ++ /* Clear slave addresses. */ ++ writel(0, bus->base + ASPEED_I2C_DEV_ADDR_REG); ++ + parent_clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(parent_clk)) + return PTR_ERR(parent_clk); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1002-Filter-erroneous-adc-readings.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1002-Filter-erroneous-adc-readings.patch new file mode 100644 index 000000000..9306ca9e2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1002-Filter-erroneous-adc-readings.patch @@ -0,0 +1,59 @@ +From 8188c4d5deda1d747801bfafb750fd61d0292ba5 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Tue, 13 Oct 2020 12:23:29 -0700 +Subject: [PATCH] Filter erroneous adc readings + +There has been cases that ast2500 ADC appears to return an incorrect +reading. Re-read the ADC data once if the ADC valuse jumped more than +80 counts comparing the previous value. + +This is a workaround to filter out these erroneous readings recorded +from user space application polling every second: +PVNN_PCH_AUX history dump: + 0.9,0.9,0.9,0.9,1.351,0.9,0.9,0.9,0.901,0.898 +PVDQ_DEF_CPU1 history dump: + 1.235,1.237,1.237,1.235,1.348,1.237,1.237,1.235,1.237,1.235 +ADC raw reading is 1000 times above numbers. + +This approach works if there is a silicon bug in adc register read +with minimal risk. It will not work if the bad readings come from noise +in the sensing circuitry. This patch may be removed if that is proven +to be the case. + +Tested: +Build and verified no regression in voltage reading on my WC. + +Signed-off-by: Zhikui Ren +--- + drivers/iio/adc/aspeed_adc.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c +index c115797c4cc5..c1e775e764ca 100644 +--- a/drivers/iio/adc/aspeed_adc.c ++++ b/drivers/iio/adc/aspeed_adc.c +@@ -55,6 +55,7 @@ + + #define ASPEED_ADC_CHANNELS_MAX 16 + #define ASPEED_ADC_RAW_VALUE_MAX 0x3ff ++#define ASPEED_ADC_RAW_VALUE_DELTA_THRESHOLD 80 + + struct aspeed_adc_model_data { + const char *model_name; +@@ -133,6 +134,13 @@ static int aspeed_adc_read_raw(struct iio_dev *indio_dev, + pr_err("aspeed_adc: channel %d drop invalid raw reading 0x3FF %d\n", + chan->channel, ASPEED_ADC_RAW_VALUE_MAX); + } else { ++ if (*val > (data->channel_raw_value[chan->channel] + ++ ASPEED_ADC_RAW_VALUE_DELTA_THRESHOLD)) { ++ pr_err("aspeed_adc: Warning-channel %d prev=%d, curr=%d, retry.\n", ++ chan->channel, ++ data->channel_raw_value[chan->channel], *val); ++ *val = readw(data->base + chan->address); ++ } + data->channel_raw_value[chan->channel] = *val; + } + return IIO_VAL_INT; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-14351/0001-perf-core-Fix-race-in-the-perf_mmap_close-function.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-14351/0001-perf-core-Fix-race-in-the-perf_mmap_close-function.patch new file mode 100644 index 000000000..c5114ac32 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-14351/0001-perf-core-Fix-race-in-the-perf_mmap_close-function.patch @@ -0,0 +1,98 @@ +From 4ef4d084d9e38fbf31d40ff0a91bd621720421d9 Mon Sep 17 00:00:00 2001 +From: Jiri Olsa +Date: Wed, 16 Sep 2020 13:53:11 +0200 +Subject: [PATCH] perf/core: Fix race in the perf_mmap_close() function + +There's a possible race in perf_mmap_close() when checking ring buffer's +mmap_count refcount value. The problem is that the mmap_count check is +not atomic because we call atomic_dec() and atomic_read() separately. + + perf_mmap_close: + ... + atomic_dec(&rb->mmap_count); + ... + if (atomic_read(&rb->mmap_count)) + goto out_put; + + + free_uid + +out_put: + ring_buffer_put(rb); /* could be last */ + +The race can happen when we have two (or more) events sharing same ring +buffer and they go through atomic_dec() and then they both see 0 as refcount +value later in atomic_read(). Then both will go on and execute code which +is meant to be run just once. + +The code that detaches ring buffer is probably fine to be executed more +than once, but the problem is in calling free_uid(), which will later on +demonstrate in related crashes and refcount warnings, like: + + refcount_t: addition on 0; use-after-free. + ... + RIP: 0010:refcount_warn_saturate+0x6d/0xf + ... + Call Trace: + prepare_creds+0x190/0x1e0 + copy_creds+0x35/0x172 + copy_process+0x471/0x1a80 + _do_fork+0x83/0x3a0 + __do_sys_wait4+0x83/0x90 + __do_sys_clone+0x85/0xa0 + do_syscall_64+0x5b/0x1e0 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + +Using atomic decrease and check instead of separated calls. + +Tested-by: Michael Petlan +Signed-off-by: Jiri Olsa +Signed-off-by: Ingo Molnar +Acked-by: Peter Zijlstra +Acked-by: Namhyung Kim +Acked-by: Wade Mealing +Fixes: 9bb5d40cd93c ("perf: Fix mmap() accounting hole"); +Link: https://lore.kernel.org/r/20200916115311.GE2301783@krava +--- + kernel/events/core.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 956d5ab46db9..1d5f2806c65e 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -5587,11 +5587,11 @@ static void perf_pmu_output_stop(struct perf_event *event); + static void perf_mmap_close(struct vm_area_struct *vma) + { + struct perf_event *event = vma->vm_file->private_data; +- + struct ring_buffer *rb = ring_buffer_get(event); + struct user_struct *mmap_user = rb->mmap_user; + int mmap_locked = rb->mmap_locked; + unsigned long size = perf_data_size(rb); ++ bool detach_rest = false; + + if (event->pmu->event_unmapped) + event->pmu->event_unmapped(event, vma->vm_mm); +@@ -5622,7 +5622,8 @@ static void perf_mmap_close(struct vm_area_struct *vma) + mutex_unlock(&event->mmap_mutex); + } + +- atomic_dec(&rb->mmap_count); ++ if (atomic_dec_and_test(&rb->mmap_count)) ++ detach_rest = true; + + if (!atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) + goto out_put; +@@ -5631,7 +5632,7 @@ static void perf_mmap_close(struct vm_area_struct *vma) + mutex_unlock(&event->mmap_mutex); + + /* If there's still other mmap()s of this buffer, we're done. */ +- if (atomic_read(&rb->mmap_count)) ++ if (!detach_rest) + goto out_put; + + /* +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15436/0001-block-Fix-use-after-free-in-blkdev_get.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15436/0001-block-Fix-use-after-free-in-blkdev_get.patch new file mode 100644 index 000000000..958fb1967 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15436/0001-block-Fix-use-after-free-in-blkdev_get.patch @@ -0,0 +1,194 @@ +From 2d3a8e2deddea6c89961c422ec0c5b851e648c14 Mon Sep 17 00:00:00 2001 +From: Jason Yan +Date: Tue, 16 Jun 2020 20:16:55 +0800 +Subject: [PATCH] block: Fix use-after-free in blkdev_get() + +In blkdev_get() we call __blkdev_get() to do some internal jobs and if +there is some errors in __blkdev_get(), the bdput() is called which +means we have released the refcount of the bdev (actually the refcount of +the bdev inode). This means we cannot access bdev after that point. But +acctually bdev is still accessed in blkdev_get() after calling +__blkdev_get(). This results in use-after-free if the refcount is the +last one we released in __blkdev_get(). Let's take a look at the +following scenerio: + + CPU0 CPU1 CPU2 +blkdev_open blkdev_open Remove disk + bd_acquire + blkdev_get + __blkdev_get del_gendisk + bdev_unhash_inode + bd_acquire bdev_get_gendisk + bd_forget failed because of unhashed + bdput + bdput (the last one) + bdev_evict_inode + + access bdev => use after free + +[ 459.350216] BUG: KASAN: use-after-free in __lock_acquire+0x24c1/0x31b0 +[ 459.351190] Read of size 8 at addr ffff88806c815a80 by task syz-executor.0/20132 +[ 459.352347] +[ 459.352594] CPU: 0 PID: 20132 Comm: syz-executor.0 Not tainted 4.19.90 #2 +[ 459.353628] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 +[ 459.354947] Call Trace: +[ 459.355337] dump_stack+0x111/0x19e +[ 459.355879] ? __lock_acquire+0x24c1/0x31b0 +[ 459.356523] print_address_description+0x60/0x223 +[ 459.357248] ? __lock_acquire+0x24c1/0x31b0 +[ 459.357887] kasan_report.cold+0xae/0x2d8 +[ 459.358503] __lock_acquire+0x24c1/0x31b0 +[ 459.359120] ? _raw_spin_unlock_irq+0x24/0x40 +[ 459.359784] ? lockdep_hardirqs_on+0x37b/0x580 +[ 459.360465] ? _raw_spin_unlock_irq+0x24/0x40 +[ 459.361123] ? finish_task_switch+0x125/0x600 +[ 459.361812] ? finish_task_switch+0xee/0x600 +[ 459.362471] ? mark_held_locks+0xf0/0xf0 +[ 459.363108] ? __schedule+0x96f/0x21d0 +[ 459.363716] lock_acquire+0x111/0x320 +[ 459.364285] ? blkdev_get+0xce/0xbe0 +[ 459.364846] ? blkdev_get+0xce/0xbe0 +[ 459.365390] __mutex_lock+0xf9/0x12a0 +[ 459.365948] ? blkdev_get+0xce/0xbe0 +[ 459.366493] ? bdev_evict_inode+0x1f0/0x1f0 +[ 459.367130] ? blkdev_get+0xce/0xbe0 +[ 459.367678] ? destroy_inode+0xbc/0x110 +[ 459.368261] ? mutex_trylock+0x1a0/0x1a0 +[ 459.368867] ? __blkdev_get+0x3e6/0x1280 +[ 459.369463] ? bdev_disk_changed+0x1d0/0x1d0 +[ 459.370114] ? blkdev_get+0xce/0xbe0 +[ 459.370656] blkdev_get+0xce/0xbe0 +[ 459.371178] ? find_held_lock+0x2c/0x110 +[ 459.371774] ? __blkdev_get+0x1280/0x1280 +[ 459.372383] ? lock_downgrade+0x680/0x680 +[ 459.373002] ? lock_acquire+0x111/0x320 +[ 459.373587] ? bd_acquire+0x21/0x2c0 +[ 459.374134] ? do_raw_spin_unlock+0x4f/0x250 +[ 459.374780] blkdev_open+0x202/0x290 +[ 459.375325] do_dentry_open+0x49e/0x1050 +[ 459.375924] ? blkdev_get_by_dev+0x70/0x70 +[ 459.376543] ? __x64_sys_fchdir+0x1f0/0x1f0 +[ 459.377192] ? inode_permission+0xbe/0x3a0 +[ 459.377818] path_openat+0x148c/0x3f50 +[ 459.378392] ? kmem_cache_alloc+0xd5/0x280 +[ 459.379016] ? entry_SYSCALL_64_after_hwframe+0x49/0xbe +[ 459.379802] ? path_lookupat.isra.0+0x900/0x900 +[ 459.380489] ? __lock_is_held+0xad/0x140 +[ 459.381093] do_filp_open+0x1a1/0x280 +[ 459.381654] ? may_open_dev+0xf0/0xf0 +[ 459.382214] ? find_held_lock+0x2c/0x110 +[ 459.382816] ? lock_downgrade+0x680/0x680 +[ 459.383425] ? __lock_is_held+0xad/0x140 +[ 459.384024] ? do_raw_spin_unlock+0x4f/0x250 +[ 459.384668] ? _raw_spin_unlock+0x1f/0x30 +[ 459.385280] ? __alloc_fd+0x448/0x560 +[ 459.385841] do_sys_open+0x3c3/0x500 +[ 459.386386] ? filp_open+0x70/0x70 +[ 459.386911] ? trace_hardirqs_on_thunk+0x1a/0x1c +[ 459.387610] ? trace_hardirqs_off_caller+0x55/0x1c0 +[ 459.388342] ? do_syscall_64+0x1a/0x520 +[ 459.388930] do_syscall_64+0xc3/0x520 +[ 459.389490] entry_SYSCALL_64_after_hwframe+0x49/0xbe +[ 459.390248] RIP: 0033:0x416211 +[ 459.390720] Code: 75 14 b8 02 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 +04 19 00 00 c3 48 83 ec 08 e8 0a fa ff ff 48 89 04 24 b8 02 00 00 00 0f + 05 <48> 8b 3c 24 48 89 c2 e8 53 fa ff ff 48 89 d0 48 83 c4 08 48 3d + 01 +[ 459.393483] RSP: 002b:00007fe45dfe9a60 EFLAGS: 00000293 ORIG_RAX: 0000000000000002 +[ 459.394610] RAX: ffffffffffffffda RBX: 00007fe45dfea6d4 RCX: 0000000000416211 +[ 459.395678] RDX: 00007fe45dfe9b0a RSI: 0000000000000002 RDI: 00007fe45dfe9b00 +[ 459.396758] RBP: 000000000076bf20 R08: 0000000000000000 R09: 000000000000000a +[ 459.397930] R10: 0000000000000075 R11: 0000000000000293 R12: 00000000ffffffff +[ 459.399022] R13: 0000000000000bd9 R14: 00000000004cdb80 R15: 000000000076bf2c +[ 459.400168] +[ 459.400430] Allocated by task 20132: +[ 459.401038] kasan_kmalloc+0xbf/0xe0 +[ 459.401652] kmem_cache_alloc+0xd5/0x280 +[ 459.402330] bdev_alloc_inode+0x18/0x40 +[ 459.402970] alloc_inode+0x5f/0x180 +[ 459.403510] iget5_locked+0x57/0xd0 +[ 459.404095] bdget+0x94/0x4e0 +[ 459.404607] bd_acquire+0xfa/0x2c0 +[ 459.405113] blkdev_open+0x110/0x290 +[ 459.405702] do_dentry_open+0x49e/0x1050 +[ 459.406340] path_openat+0x148c/0x3f50 +[ 459.406926] do_filp_open+0x1a1/0x280 +[ 459.407471] do_sys_open+0x3c3/0x500 +[ 459.408010] do_syscall_64+0xc3/0x520 +[ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe +[ 459.409415] +[ 459.409679] Freed by task 1262: +[ 459.410212] __kasan_slab_free+0x129/0x170 +[ 459.410919] kmem_cache_free+0xb2/0x2a0 +[ 459.411564] rcu_process_callbacks+0xbb2/0x2320 +[ 459.412318] __do_softirq+0x225/0x8ac + +Fix this by delaying bdput() to the end of blkdev_get() which means we +have finished accessing bdev. + +Fixes: 77ea887e433a ("implement in-kernel gendisk events handling") +Reported-by: Hulk Robot +Signed-off-by: Jason Yan +Tested-by: Sedat Dilek +Reviewed-by: Jan Kara +Reviewed-by: Christoph Hellwig +Reviewed-by: Dan Carpenter +Cc: Christoph Hellwig +Cc: Jens Axboe +Cc: Ming Lei +Cc: Jan Kara +Cc: Dan Carpenter +Signed-off-by: Jens Axboe +--- + fs/block_dev.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/fs/block_dev.c b/fs/block_dev.c +index 47860e589388..08c87db3a92b 100644 +--- a/fs/block_dev.c ++++ b/fs/block_dev.c +@@ -1565,10 +1565,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) + */ + if (!for_part) { + ret = devcgroup_inode_permission(bdev->bd_inode, perm); +- if (ret != 0) { +- bdput(bdev); ++ if (ret != 0) + return ret; +- } + } + + restart: +@@ -1637,8 +1635,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) + goto out_clear; + BUG_ON(for_part); + ret = __blkdev_get(whole, mode, 1); +- if (ret) ++ if (ret) { ++ bdput(whole); + goto out_clear; ++ } + bdev->bd_contains = whole; + bdev->bd_part = disk_get_part(disk, partno); + if (!(disk->flags & GENHD_FL_UP) || +@@ -1688,7 +1688,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) + disk_unblock_events(disk); + put_disk_and_module(disk); + out: +- bdput(bdev); + + return ret; + } +@@ -1755,6 +1754,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) + bdput(whole); + } + ++ if (res) ++ bdput(bdev); ++ + return res; + } + EXPORT_SYMBOL(blkdev_get); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15437/0001-serial-8250-fix-null-ptr-deref-in-serial8250_start_t.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15437/0001-serial-8250-fix-null-ptr-deref-in-serial8250_start_t.patch new file mode 100644 index 000000000..c10d98f76 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-15437/0001-serial-8250-fix-null-ptr-deref-in-serial8250_start_t.patch @@ -0,0 +1,90 @@ +From f4c23a140d80ef5e6d3d1f8f57007649014b60fa Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Tue, 21 Jul 2020 14:38:52 +0000 +Subject: [PATCH] serial: 8250: fix null-ptr-deref in serial8250_start_tx() + +I got null-ptr-deref in serial8250_start_tx(): + +[ 78.114630] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 +[ 78.123778] Mem abort info: +[ 78.126560] ESR = 0x86000007 +[ 78.129603] EC = 0x21: IABT (current EL), IL = 32 bits +[ 78.134891] SET = 0, FnV = 0 +[ 78.137933] EA = 0, S1PTW = 0 +[ 78.141064] user pgtable: 64k pages, 48-bit VAs, pgdp=00000027d41a8600 +[ 78.147562] [0000000000000000] pgd=00000027893f0003, p4d=00000027893f0003, pud=00000027893f0003, pmd=00000027c9a20003, pte=0000000000000000 +[ 78.160029] Internal error: Oops: 86000007 [#1] SMP +[ 78.164886] Modules linked in: sunrpc vfat fat aes_ce_blk crypto_simd cryptd aes_ce_cipher crct10dif_ce ghash_ce sha2_ce sha256_arm64 sha1_ce ses enclosure sg sbsa_gwdt ipmi_ssif spi_dw_mmio sch_fq_codel vhost_net tun vhost vhost_iotlb tap ip_tables ext4 mbcache jbd2 ahci hisi_sas_v3_hw libahci hisi_sas_main libsas hns3 scsi_transport_sas hclge libata megaraid_sas ipmi_si hnae3 ipmi_devintf ipmi_msghandler br_netfilter bridge stp llc nvme nvme_core xt_sctp sctp libcrc32c dm_mod nbd +[ 78.207383] CPU: 11 PID: 23258 Comm: null-ptr Not tainted 5.8.0-rc6+ #48 +[ 78.214056] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B210.01 03/12/2020 +[ 78.222888] pstate: 80400089 (Nzcv daIf +PAN -UAO BTYPE=--) +[ 78.228435] pc : 0x0 +[ 78.230618] lr : serial8250_start_tx+0x160/0x260 +[ 78.235215] sp : ffff800062eefb80 +[ 78.238517] x29: ffff800062eefb80 x28: 0000000000000fff +[ 78.243807] x27: ffff800062eefd80 x26: ffff202fd83b3000 +[ 78.249098] x25: ffff800062eefd80 x24: ffff202fd83b3000 +[ 78.254388] x23: ffff002fc5e50be8 x22: 0000000000000002 +[ 78.259679] x21: 0000000000000001 x20: 0000000000000000 +[ 78.264969] x19: ffffa688827eecc8 x18: 0000000000000000 +[ 78.270259] x17: 0000000000000000 x16: 0000000000000000 +[ 78.275550] x15: ffffa68881bc67a8 x14: 00000000000002e6 +[ 78.280841] x13: ffffa68881bc67a8 x12: 000000000000c539 +[ 78.286131] x11: d37a6f4de9bd37a7 x10: ffffa68881cccff0 +[ 78.291421] x9 : ffffa68881bc6000 x8 : ffffa688819daa88 +[ 78.296711] x7 : ffffa688822a0f20 x6 : ffffa688819e0000 +[ 78.302002] x5 : ffff800062eef9d0 x4 : ffffa68881e707a8 +[ 78.307292] x3 : 0000000000000000 x2 : 0000000000000002 +[ 78.312582] x1 : 0000000000000001 x0 : ffffa688827eecc8 +[ 78.317873] Call trace: +[ 78.320312] 0x0 +[ 78.322147] __uart_start.isra.9+0x64/0x78 +[ 78.326229] uart_start+0xb8/0x1c8 +[ 78.329620] uart_flush_chars+0x24/0x30 +[ 78.333442] n_tty_receive_buf_common+0x7b0/0xc30 +[ 78.338128] n_tty_receive_buf+0x44/0x2c8 +[ 78.342122] tty_ioctl+0x348/0x11f8 +[ 78.345599] ksys_ioctl+0xd8/0xf8 +[ 78.348903] __arm64_sys_ioctl+0x2c/0xc8 +[ 78.352812] el0_svc_common.constprop.2+0x88/0x1b0 +[ 78.357583] do_el0_svc+0x44/0xd0 +[ 78.360887] el0_sync_handler+0x14c/0x1d0 +[ 78.364880] el0_sync+0x140/0x180 +[ 78.368185] Code: bad PC value + +SERIAL_PORT_DFNS is not defined on each arch, if it's not defined, +serial8250_set_defaults() won't be called in serial8250_isa_init_ports(), +so the p->serial_in pointer won't be initialized, and it leads a null-ptr-deref. +Fix this problem by calling serial8250_set_defaults() after init uart port. + +Signed-off-by: Yang Yingliang +Cc: stable +Link: https://lore.kernel.org/r/20200721143852.4058352-1-yangyingliang@huawei.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c +index fc118f649887..cae61d1ebec5 100644 +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -524,6 +524,7 @@ static void __init serial8250_isa_init_ports(void) + */ + up->mcr_mask = ~ALPHA_KLUDGE_MCR; + up->mcr_force = ALPHA_KLUDGE_MCR; ++ serial8250_set_defaults(up); + } + + /* chain base port ops to support Remote Supervisor Adapter */ +@@ -547,7 +548,6 @@ static void __init serial8250_isa_init_ports(void) + port->membase = old_serial_port[i].iomem_base; + port->iotype = old_serial_port[i].io_type; + port->regshift = old_serial_port[i].iomem_reg_shift; +- serial8250_set_defaults(up); + + port->irqflags |= irqflag; + if (serial8250_isa_config != NULL) +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25704/0001-perf-core-Fix-a-memory-leak-in-perf_event_parse_addr.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25704/0001-perf-core-Fix-a-memory-leak-in-perf_event_parse_addr.patch new file mode 100644 index 000000000..e51593af2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25704/0001-perf-core-Fix-a-memory-leak-in-perf_event_parse_addr.patch @@ -0,0 +1,92 @@ +From 7bdb157cdebbf95a1cd94ed2e01b338714075d00 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?kiyin=28=E5=B0=B9=E4=BA=AE=29?= +Date: Wed, 4 Nov 2020 08:23:22 +0300 +Subject: [PATCH] perf/core: Fix a memory leak in + perf_event_parse_addr_filter() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +As shown through runtime testing, the "filename" allocation is not +always freed in perf_event_parse_addr_filter(). + +There are three possible ways that this could happen: + + - It could be allocated twice on subsequent iterations through the loop, + - or leaked on the success path, + - or on the failure path. + +Clean up the code flow to make it obvious that 'filename' is always +freed in the reallocation path and in the two return paths as well. + +We rely on the fact that kfree(NULL) is NOP and filename is initialized +with NULL. + +This fixes the leak. No other side effects expected. + +[ Dan Carpenter: cleaned up the code flow & added a changelog. ] +[ Ingo Molnar: updated the changelog some more. ] + +Fixes: 375637bc5249 ("perf/core: Introduce address range filtering") +Signed-off-by: "kiyin(尹亮)" +Signed-off-by: Dan Carpenter +Signed-off-by: Ingo Molnar +Cc: "Srivatsa S. Bhat" +Cc: Anthony Liguori +-- + kernel/events/core.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) +--- + kernel/events/core.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index da467e1dd49a..5a29ab09e72d 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -10085,6 +10085,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, + if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) { + int fpos = token == IF_SRC_FILE ? 2 : 1; + ++ kfree(filename); + filename = match_strdup(&args[fpos]); + if (!filename) { + ret = -ENOMEM; +@@ -10131,16 +10132,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, + */ + ret = -EOPNOTSUPP; + if (!event->ctx->task) +- goto fail_free_name; ++ goto fail; + + /* look up the path and grab its inode */ + ret = kern_path(filename, LOOKUP_FOLLOW, + &filter->path); + if (ret) +- goto fail_free_name; +- +- kfree(filename); +- filename = NULL; ++ goto fail; + + ret = -EINVAL; + if (!filter->path.dentry || +@@ -10160,13 +10158,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, + if (state != IF_STATE_ACTION) + goto fail; + ++ kfree(filename); + kfree(orig); + + return 0; + +-fail_free_name: +- kfree(filename); + fail: ++ kfree(filename); + free_filters_list(filters); + kfree(orig); + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25705/0001-icmp-randomize-the-global-rate-limiter.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25705/0001-icmp-randomize-the-global-rate-limiter.patch new file mode 100644 index 000000000..079f8d78e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-25705/0001-icmp-randomize-the-global-rate-limiter.patch @@ -0,0 +1,51 @@ +From df6369cb69d03c30b299a8a2e3dbeab2261562f9 Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Thu, 15 Oct 2020 11:42:00 -0700 +Subject: [PATCH] icmp: randomize the global rate limiter + +[ Upstream commit b38e7819cae946e2edf869e604af1e65a5d241c5 ] + +Keyu Man reported that the ICMP rate limiter could be used +by attackers to get useful signal. Details will be provided +in an upcoming academic publication. + +Our solution is to add some noise, so that the attackers +no longer can get help from the predictable token bucket limiter. + +Fixes: 4cdf507d5452 ("icmp: add a global rate limitation") +Signed-off-by: Eric Dumazet +Reported-by: Keyu Man +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/icmp.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c +index ac95ba78b903..76cacbe39a21 100644 +--- a/net/ipv4/icmp.c ++++ b/net/ipv4/icmp.c +@@ -239,7 +239,7 @@ static struct { + /** + * icmp_global_allow - Are we allowed to send one more ICMP message ? + * +- * Uses a token bucket to limit our ICMP messages to sysctl_icmp_msgs_per_sec. ++ * Uses a token bucket to limit our ICMP messages to ~sysctl_icmp_msgs_per_sec. + * Returns false if we reached the limit and can not send another packet. + * Note: called with BH disabled + */ +@@ -267,7 +267,10 @@ bool icmp_global_allow(void) + } + credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); + if (credit) { +- credit--; ++ /* We want to use a credit of one in average, but need to randomize ++ * it for security reasons. ++ */ ++ credit = max_t(int, credit - prandom_u32_max(3), 0); + rc = true; + } + WRITE_ONCE(icmp_global.credit, credit); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29369/0001-mm-mmap.c-close-race-between-munmap-and-expand_upwar.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29369/0001-mm-mmap.c-close-race-between-munmap-and-expand_upwar.patch new file mode 100644 index 000000000..378d7c529 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29369/0001-mm-mmap.c-close-race-between-munmap-and-expand_upwar.patch @@ -0,0 +1,89 @@ +From 246c320a8cfe0b11d81a4af38fa9985ef0cc9a4c Mon Sep 17 00:00:00 2001 +From: "Kirill A. Shutemov" +Date: Thu, 23 Jul 2020 21:15:11 -0700 +Subject: [PATCH] mm/mmap.c: close race between munmap() and + expand_upwards()/downwards() + +VMA with VM_GROWSDOWN or VM_GROWSUP flag set can change their size under +mmap_read_lock(). It can lead to race with __do_munmap(): + + Thread A Thread B +__do_munmap() + detach_vmas_to_be_unmapped() + mmap_write_downgrade() + expand_downwards() + vma->vm_start = address; + // The VMA now overlaps with + // VMAs detached by the Thread A + // page fault populates expanded part + // of the VMA + unmap_region() + // Zaps pagetables partly + // populated by Thread B + +Similar race exists for expand_upwards(). + +The fix is to avoid downgrading mmap_lock in __do_munmap() if detached +VMAs are next to VM_GROWSDOWN or VM_GROWSUP VMA. + +[akpm@linux-foundation.org: s/mmap_sem/mmap_lock/ in comment] + +Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap") +Reported-by: Jann Horn +Signed-off-by: Kirill A. Shutemov +Signed-off-by: Andrew Morton +Reviewed-by: Yang Shi +Acked-by: Vlastimil Babka +Cc: Oleg Nesterov +Cc: Matthew Wilcox +Cc: [4.20+] +Link: http://lkml.kernel.org/r/20200709105309.42495-1-kirill.shutemov@linux.intel.com +Signed-off-by: Linus Torvalds +--- + mm/mmap.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/mm/mmap.c b/mm/mmap.c +index 59a4682ebf3f..8c7ca737a19b 100644 +--- a/mm/mmap.c ++++ b/mm/mmap.c +@@ -2620,7 +2620,7 @@ static void unmap_region(struct mm_struct *mm, + * Create a list of vma's touched by the unmap, removing them from the mm's + * vma list as we go.. + */ +-static void ++static bool + detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, + struct vm_area_struct *prev, unsigned long end) + { +@@ -2645,6 +2645,17 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, + + /* Kill the cache */ + vmacache_invalidate(mm); ++ ++ /* ++ * Do not downgrade mmap_lock if we are next to VM_GROWSDOWN or ++ * VM_GROWSUP VMA. Such VMAs can change their size under ++ * down_read(mmap_lock) and collide with the VMA we are about to unmap. ++ */ ++ if (vma && (vma->vm_flags & VM_GROWSDOWN)) ++ return false; ++ if (prev && (prev->vm_flags & VM_GROWSUP)) ++ return false; ++ return true; + } + + /* +@@ -2825,7 +2836,8 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len, + } + + /* Detach vmas from rbtree */ +- detach_vmas_to_be_unmapped(mm, vma, prev, end); ++ if (!detach_vmas_to_be_unmapped(mm, vma, prev, end)) ++ downgrade = false; + + if (downgrade) + mmap_write_downgrade(mm); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29372/0001-mm-check-that-mm-is-still-valid-in-madvise.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29372/0001-mm-check-that-mm-is-still-valid-in-madvise.patch new file mode 100644 index 000000000..80519ac8d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29372/0001-mm-check-that-mm-is-still-valid-in-madvise.patch @@ -0,0 +1,72 @@ +From bc0c4d1e176eeb614dc8734fc3ace34292771f11 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Fri, 24 Apr 2020 11:10:58 -0700 +Subject: [PATCH] mm: check that mm is still valid in madvise() + +IORING_OP_MADVISE can end up basically doing mprotect() on the VM of +another process, which means that it can race with our crazy core dump +handling which accesses the VM state without holding the mmap_sem +(because it incorrectly thinks that it is the final user). + +This is clearly a core dumping problem, but we've never fixed it the +right way, and instead have the notion of "check that the mm is still +ok" using mmget_still_valid() after getting the mmap_sem for writing in +any situation where we're not the original VM thread. + +See commit 04f5866e41fb ("coredump: fix race condition between +mmget_not_zero()/get_task_mm() and core dumping") for more background on +this whole mmget_still_valid() thing. You might want to have a barf bag +handy when you do. + +We're discussing just fixing this properly in the only remaining core +dumping routines. But even if we do that, let's make do_madvise() do +the right thing, and then when we fix core dumping, we can remove all +these mmget_still_valid() checks. + +Reported-and-tested-by: Jann Horn +Fixes: c1ca757bd6f4 ("io_uring: add IORING_OP_MADVISE") +Acked-by: Jens Axboe +Signed-off-by: Linus Torvalds +--- + mm/madvise.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/mm/madvise.c b/mm/madvise.c +index 4bb30ed6c8d2..8cbd8c1bfe15 100644 +--- a/mm/madvise.c ++++ b/mm/madvise.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #include + +@@ -1090,6 +1091,23 @@ int do_madvise(unsigned long start, size_t len_in, int behavior) + if (write) { + if (down_write_killable(¤t->mm->mmap_sem)) + return -EINTR; ++ ++ /* ++ * We may have stolen the mm from another process ++ * that is undergoing core dumping. ++ * ++ * Right now that's io_ring, in the future it may ++ * be remote process management and not "current" ++ * at all. ++ * ++ * We need to fix core dumping to not do this, ++ * but for now we have the mmget_still_valid() ++ * model. ++ */ ++ if (!mmget_still_valid(current->mm)) { ++ up_write(¤t->mm->mmap_sem); ++ return -EINTR; ++ } + } else { + down_read(¤t->mm->mmap_sem); + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29660/0001-tty-Fix-session-locking.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29660/0001-tty-Fix-session-locking.patch new file mode 100644 index 000000000..a00ce2a95 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29660/0001-tty-Fix-session-locking.patch @@ -0,0 +1,204 @@ +From 35ee9ac513280f46eeb1196bac82ed5320380412 Mon Sep 17 00:00:00 2001 +From: Jann Horn +Date: Thu, 3 Dec 2020 02:25:05 +0100 +Subject: [PATCH] tty: Fix ->session locking + +commit c8bcd9c5be24fb9e6132e97da5a35e55a83e36b9 upstream. + +Currently, locking of ->session is very inconsistent; most places +protect it using the legacy tty mutex, but disassociate_ctty(), +__do_SAK(), tiocspgrp() and tiocgsid() don't. +Two of the writers hold the ctrl_lock (because they already need it for +->pgrp), but __proc_set_tty() doesn't do that yet. + +On a PREEMPT=y system, an unprivileged user can theoretically abuse +this broken locking to read 4 bytes of freed memory via TIOCGSID if +tiocgsid() is preempted long enough at the right point. (Other things +might also go wrong, especially if root-only ioctls are involved; I'm +not sure about that.) + +Change the locking on ->session such that: + + - tty_lock() is held by all writers: By making disassociate_ctty() + hold it. This should be fine because the same lock can already be + taken through the call to tty_vhangup_session(). + The tricky part is that we need to shorten the area covered by + siglock to be able to take tty_lock() without ugly retry logic; as + far as I can tell, this should be fine, since nothing in the + signal_struct is touched in the `if (tty)` branch. + - ctrl_lock is held by all writers: By changing __proc_set_tty() to + hold the lock a little longer. + - All readers that aren't holding tty_lock() hold ctrl_lock: By + adding locking to tiocgsid() and __do_SAK(), and expanding the area + covered by ctrl_lock in tiocspgrp(). + +Cc: stable@kernel.org +Signed-off-by: Jann Horn +Reviewed-by: Jiri Slaby +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/tty_io.c | 7 ++++++- + drivers/tty/tty_jobctrl.c | 44 +++++++++++++++++++++++++++------------ + include/linux/tty.h | 4 ++++ + 3 files changed, 41 insertions(+), 14 deletions(-) + +diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c +index 36c1c59cc72a..642765bf1023 100644 +--- a/drivers/tty/tty_io.c ++++ b/drivers/tty/tty_io.c +@@ -2894,10 +2894,14 @@ void __do_SAK(struct tty_struct *tty) + struct task_struct *g, *p; + struct pid *session; + int i; ++ unsigned long flags; + + if (!tty) + return; +- session = tty->session; ++ ++ spin_lock_irqsave(&tty->ctrl_lock, flags); ++ session = get_pid(tty->session); ++ spin_unlock_irqrestore(&tty->ctrl_lock, flags); + + tty_ldisc_flush(tty); + +@@ -2929,6 +2933,7 @@ void __do_SAK(struct tty_struct *tty) + task_unlock(p); + } while_each_thread(g, p); + read_unlock(&tasklist_lock); ++ put_pid(session); + #endif + } + +diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c +index af508957ff05..813be2c05262 100644 +--- a/drivers/tty/tty_jobctrl.c ++++ b/drivers/tty/tty_jobctrl.c +@@ -103,8 +103,8 @@ static void __proc_set_tty(struct tty_struct *tty) + put_pid(tty->session); + put_pid(tty->pgrp); + tty->pgrp = get_pid(task_pgrp(current)); +- spin_unlock_irqrestore(&tty->ctrl_lock, flags); + tty->session = get_pid(task_session(current)); ++ spin_unlock_irqrestore(&tty->ctrl_lock, flags); + if (current->signal->tty) { + tty_debug(tty, "current tty %s not NULL!!\n", + current->signal->tty->name); +@@ -293,20 +293,23 @@ void disassociate_ctty(int on_exit) + spin_lock_irq(¤t->sighand->siglock); + put_pid(current->signal->tty_old_pgrp); + current->signal->tty_old_pgrp = NULL; +- + tty = tty_kref_get(current->signal->tty); ++ spin_unlock_irq(¤t->sighand->siglock); ++ + if (tty) { + unsigned long flags; ++ ++ tty_lock(tty); + spin_lock_irqsave(&tty->ctrl_lock, flags); + put_pid(tty->session); + put_pid(tty->pgrp); + tty->session = NULL; + tty->pgrp = NULL; + spin_unlock_irqrestore(&tty->ctrl_lock, flags); ++ tty_unlock(tty); + tty_kref_put(tty); + } + +- spin_unlock_irq(¤t->sighand->siglock); + /* Now clear signal->tty under the lock */ + read_lock(&tasklist_lock); + session_clear_tty(task_session(current)); +@@ -477,14 +480,19 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t + return -ENOTTY; + if (retval) + return retval; +- if (!current->signal->tty || +- (current->signal->tty != real_tty) || +- (real_tty->session != task_session(current))) +- return -ENOTTY; ++ + if (get_user(pgrp_nr, p)) + return -EFAULT; + if (pgrp_nr < 0) + return -EINVAL; ++ ++ spin_lock_irq(&real_tty->ctrl_lock); ++ if (!current->signal->tty || ++ (current->signal->tty != real_tty) || ++ (real_tty->session != task_session(current))) { ++ retval = -ENOTTY; ++ goto out_unlock_ctrl; ++ } + rcu_read_lock(); + pgrp = find_vpid(pgrp_nr); + retval = -ESRCH; +@@ -494,12 +502,12 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t + if (session_of_pgrp(pgrp) != task_session(current)) + goto out_unlock; + retval = 0; +- spin_lock_irq(&real_tty->ctrl_lock); + put_pid(real_tty->pgrp); + real_tty->pgrp = get_pid(pgrp); +- spin_unlock_irq(&real_tty->ctrl_lock); + out_unlock: + rcu_read_unlock(); ++out_unlock_ctrl: ++ spin_unlock_irq(&real_tty->ctrl_lock); + return retval; + } + +@@ -511,20 +519,30 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t + * + * Obtain the session id of the tty. If there is no session + * return an error. +- * +- * Locking: none. Reference to current->signal->tty is safe. + */ + static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) + { ++ unsigned long flags; ++ pid_t sid; ++ + /* + * (tty == real_tty) is a cheap way of + * testing if the tty is NOT a master pty. + */ + if (tty == real_tty && current->signal->tty != real_tty) + return -ENOTTY; ++ ++ spin_lock_irqsave(&real_tty->ctrl_lock, flags); + if (!real_tty->session) +- return -ENOTTY; +- return put_user(pid_vnr(real_tty->session), p); ++ goto err; ++ sid = pid_vnr(real_tty->session); ++ spin_unlock_irqrestore(&real_tty->ctrl_lock, flags); ++ ++ return put_user(sid, p); ++ ++err: ++ spin_unlock_irqrestore(&real_tty->ctrl_lock, flags); ++ return -ENOTTY; + } + + /* +diff --git a/include/linux/tty.h b/include/linux/tty.h +index a99e9b8e4e31..eb33d948788c 100644 +--- a/include/linux/tty.h ++++ b/include/linux/tty.h +@@ -306,6 +306,10 @@ struct tty_struct { + struct termiox *termiox; /* May be NULL for unsupported */ + char name[64]; + struct pid *pgrp; /* Protected by ctrl lock */ ++ /* ++ * Writes protected by both ctrl lock and legacy mutex, readers must use ++ * at least one of them. ++ */ + struct pid *session; + unsigned long flags; + int count; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29661/0001-tty-Fix-pgrp-locking-in-tiocspgrp.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29661/0001-tty-Fix-pgrp-locking-in-tiocspgrp.patch new file mode 100644 index 000000000..b41d6a9a1 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/CVE-2020-29661/0001-tty-Fix-pgrp-locking-in-tiocspgrp.patch @@ -0,0 +1,46 @@ +From c536ecd4856084604701b95bd7e3fb15f05634bf Mon Sep 17 00:00:00 2001 +From: Jann Horn +Date: Thu, 3 Dec 2020 02:25:04 +0100 +Subject: [PATCH] tty: Fix ->pgrp locking in tiocspgrp() + +commit 54ffccbf053b5b6ca4f6e45094b942fab92a25fc upstream. + +tiocspgrp() takes two tty_struct pointers: One to the tty that userspace +passed to ioctl() (`tty`) and one to the TTY being changed (`real_tty`). +These pointers are different when ioctl() is called with a master fd. + +To properly lock real_tty->pgrp, we must take real_tty->ctrl_lock. + +This bug makes it possible for racing ioctl(TIOCSPGRP, ...) calls on +both sides of a PTY pair to corrupt the refcount of `struct pid`, +leading to use-after-free errors. + +Fixes: 47f86834bbd4 ("redo locking of tty->pgrp") +CC: stable@kernel.org +Signed-off-by: Jann Horn +Reviewed-by: Jiri Slaby +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/tty_jobctrl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c +index f8ed50a16848..af508957ff05 100644 +--- a/drivers/tty/tty_jobctrl.c ++++ b/drivers/tty/tty_jobctrl.c +@@ -494,10 +494,10 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t + if (session_of_pgrp(pgrp) != task_session(current)) + goto out_unlock; + retval = 0; +- spin_lock_irq(&tty->ctrl_lock); ++ spin_lock_irq(&real_tty->ctrl_lock); + put_pid(real_tty->pgrp); + real_tty->pgrp = get_pid(pgrp); +- spin_unlock_irq(&tty->ctrl_lock); ++ spin_unlock_irq(&real_tty->ctrl_lock); + out_unlock: + rcu_read_unlock(); + return retval; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg index 077b83bac..9c08d590f 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/intel.cfg @@ -88,3 +88,6 @@ CONFIG_USB_EHCI_HCD=n CONFIG_USB_EHCI_ROOT_HUB_TT=n CONFIG_USB_EHCI_HCD_PLATFORM=n CONFIG_IPMB_DEVICE_INTERFACE=y +CONFIG_BPF_SYSCALL=n +CONFIG_IO_URING=n + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index 908dc0a8d..c2e2343dc 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -1,5 +1,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +LINUX_VERSION="5.4.48" +SRCREV="2b4829edfc1c225c717652153097470529d171db" + do_compile_prepend(){ # device tree compiler flags export DTC_FLAGS=-@ @@ -93,7 +96,9 @@ SRC_URI += " \ file://0123-peci-fix-error-handling-in-peci_dev_ioctl.patch \ file://1001-Igore-0x3FF-in-aspeed_adc-driver.patch \ file://0120-media-aspeed-adjust-irq-enabling-timing-and-resource.patch \ + file://1002-Filter-erroneous-adc-readings.patch \ file://0121-Add-a-WA-to-defer-flash-writes-on-PS_ALERT_N-asserti.patch \ + file://0125-i2c-aspeed-clear-slave-addresses-in-probe.patch \ " # CVE-2020-16166 vulnerability fix @@ -121,5 +126,59 @@ SRC_URI += " \ file://0001-net-packet-fix-overflow-in-tpacket_rcv.patch \ " +# CVE-2020-25705 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-25705:" +SRC_URI += " \ + file://0001-icmp-randomize-the-global-rate-limiter.patch \ + " + +# CVE-2020-15436 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-15436:" +SRC_URI += " \ + file://0001-block-Fix-use-after-free-in-blkdev_get.patch \ + " + +# CVE-2020-29369 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-29369:" +SRC_URI += " \ + file://0001-mm-mmap.c-close-race-between-munmap-and-expand_upwar.patch \ + " + +# CVE-2020-15437 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-15437:" +SRC_URI += " \ + file://0001-serial-8250-fix-null-ptr-deref-in-serial8250_start_t.patch \ + " + +# CVE-2020-25704 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-25704:" +SRC_URI += " \ + file://0001-perf-core-Fix-a-memory-leak-in-perf_event_parse_addr.patch \ + " + +# CVE-2020-29372 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-29372:" +SRC_URI += " \ + file://0001-mm-check-that-mm-is-still-valid-in-madvise.patch \ + " + +# CVE-2020-14351 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-14351:" +SRC_URI += " \ + file://0001-perf-core-Fix-race-in-the-perf_mmap_close-function.patch \ + " + +# CVE-2020-29661 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-29661:" +SRC_URI += " \ + file://0001-tty-Fix-pgrp-locking-in-tiocspgrp.patch \ + " + +# CVE-2020-29660 vulnerability fix +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/CVE-2020-29660:" +SRC_URI += " \ + file://0001-tty-Fix-session-locking.patch \ + " + SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0005-128MB-flashmap-for-PFR.patch', '', d)}" SRC_URI += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', 'file://debug.cfg', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 7e81ad63a..2578785b4 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -18,7 +18,7 @@ SOFS_MACDIR=${SOFS_MNT}/factory-settings/network/mac read_hw_mac() { local iface="$1" - cat /sys/class/net/"$iface"/address 2>/dev/null + cat /sys/class/net/"$iface"/address 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null } set_hw_mac() { @@ -33,12 +33,12 @@ set_hw_mac() { read_sofs_mac() { local iface="$1" - cat "${SOFS_MACDIR}/${iface}" 2>/dev/null + cat "${SOFS_MACDIR}/${iface}" 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null } read_fw_env_mac() { local envname="$1" - fw_printenv "$envname" 2>/dev/null | sed "s/^$envname=//" + fw_printenv "$envname" 2>/dev/null | sed "s/^$envname=//" 2>/dev/null | tr [:upper:] [:lower:] 2>/dev/null } set_fw_env_mac() { @@ -97,10 +97,16 @@ error=0 first_error_seen=0 while read IFACE UBDEV; do - mac_check "$IFACE" "$UBDEV" - error=$? - if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then - first_error_seen=$error + # Try to configure the MAC address if the kernel finds the NIC. Blindly + # trying all of the interfaces listed in the DOCSTRING (END_CONF) below + # may result in first_error_seen being set to a non-zero value. If that + # happens the journal log will report the error, which is undesirable. + if [ -h /sys/class/net/$IFACE ]; then + mac_check "$IFACE" "$UBDEV" + error=$? + if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then + first_error_seen=$error + fi fi done <<-END_CONF eth0 eth1addr diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Improve-initialization-of-I2C-sensors.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Improve-initialization-of-I2C-sensors.patch new file mode 100644 index 000000000..0ad78b69d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Improve-initialization-of-I2C-sensors.patch @@ -0,0 +1,450 @@ +From abfcf2d0b849c1bdd82ff1112192fab28f68800a Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Tue, 13 Oct 2020 15:00:51 -0700 +Subject: [PATCH] Improve initialization of I2C sensors + +After an AC cycle validation has witnessed some systems sensors are +missing. As Entity Manager begins the process of scanning for +sesnsors, and creating the hardware monitoring nodes, there are +occassionally some failures to correctly create the node. This +manifests itself by the 'dd' kernel driver emitting an -EBUSY error +message. Unfortunately the 'dd' driver also eats the error code, and +continues. This is by design. + +This commit modifies how the nodes are initialized. The steps taken: +1. Determine if the node is already present +2. Create the node if it is not +3. Set a timer, to give the kernel time to create the node +4. For those sensors that create a "hwmon" subdir, search for that +directory after the timer elapses. +5. If the subdir is not present, delete the device, and try again by +initiating another timer. +6. Continue until the subdir exists, or a retry count expires. + +Tested: +Ran AC cycles via a script. +After each cycle, wait for the SUT to DC on, and arrive at the EFI +Shell> propmt. +Issue "ipmitool sensor list", capturing the results +Search the list for all of the sensors that have been reported as +missing after AC cycles. + +Change-Id: I118df674162677d66e7d211b089430fce384086b +Signed-off-by: Johnathan Mantey +--- + include/devices.hpp | 133 +++++++++++++++++------------- + src/Overlay.cpp | 192 ++++++++++++++++++++++++++++++++++---------- + 2 files changed, 223 insertions(+), 102 deletions(-) + +diff --git a/include/devices.hpp b/include/devices.hpp +index 16d1822..8f484bc 100644 +--- a/include/devices.hpp ++++ b/include/devices.hpp +@@ -30,84 +30,101 @@ struct CmpStr + + struct ExportTemplate + { +- ExportTemplate(const char* params, const char* dev) : +- parameters(params), device(dev){}; ++ ExportTemplate(const char* params, const char* dev, const char* constructor, ++ const char* destructor, bool createsHWMon) : ++ parameters(params), ++ devicePath(dev), add(constructor), remove(destructor), ++ createsHWMon(createsHWMon){}; + const char* parameters; +- const char* device; ++ const char* devicePath; ++ const char* add; ++ const char* remove; ++ bool createsHWMon; + }; + + const boost::container::flat_map + exportTemplates{ +- {{"24C02", ExportTemplate("24c02 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"24C64", ExportTemplate("24c64 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ {{"24C02", ++ ExportTemplate("24c02 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, ++ {"24C64", ++ ExportTemplate("24c64 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, + {"ADM1272", +- ExportTemplate("adm1272 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"EEPROM", ExportTemplate("eeprom $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("adm1272 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, ++ {"EEPROM", ++ ExportTemplate("eeprom $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, + {"EMC1413", +- ExportTemplate("emc1413 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")}, +- {"INA230", ExportTemplate("ina230 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("emc1413 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, ++ {"Gpio", ExportTemplate("$Index", "/sys/class/gpio", "export", ++ "unexport", false)}, ++ {"INA230", ++ ExportTemplate("ina230 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"ISL68137", +- ExportTemplate("isl68137 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("isl68137 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX16601", +- ExportTemplate("max16601 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max16601 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX20730", +- ExportTemplate("max20730 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max20730 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX20734", +- ExportTemplate("max20734 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max20734 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX20796", +- ExportTemplate("max20796 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max20796 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX31725", +- ExportTemplate("max31725 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max31725 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX31730", +- ExportTemplate("max31730 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max31730 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX34451", +- ExportTemplate("max34451 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max34451 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"MAX6654", +- ExportTemplate("max6654 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("max6654 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"PCA9543Mux", +- ExportTemplate("pca9543 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("pca9543 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, + {"PCA9544Mux", +- ExportTemplate("pca9544 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("pca9544 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, + {"PCA9545Mux", +- ExportTemplate("pca9545 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("pca9545 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, + {"PCA9546Mux", +- ExportTemplate("pca9546 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("pca9546 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, + {"PCA9547Mux", +- ExportTemplate("pca9547 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"SBTSI", ExportTemplate("sbtsi $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"pmbus", ExportTemplate("pmbus $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"TMP112", ExportTemplate("tmp112 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"TMP175", ExportTemplate("tmp175 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"TMP421", ExportTemplate("tmp421 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, +- {"TMP441", ExportTemplate("tmp441 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ ExportTemplate("pca9547 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", false)}, ++ {"SBTSI", ++ ExportTemplate("sbtsi $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, ++ {"pmbus", ++ ExportTemplate("pmbus $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, ++ {"TMP112", ++ ExportTemplate("tmp112 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, ++ {"TMP175", ++ ExportTemplate("tmp175 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, ++ {"TMP421", ++ ExportTemplate("tmp421 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, ++ {"TMP441", ++ ExportTemplate("tmp441 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}, + {"TMP75", +- ExportTemplate("tmp75 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}}; ++ ExportTemplate("tmp75 $Address", "/sys/bus/i2c/devices/i2c-$Bus", ++ "new_device", "delete_device", true)}}}; + } // namespace devices +diff --git a/src/Overlay.cpp b/src/Overlay.cpp +index edd00f7..32385c6 100644 +--- a/src/Overlay.cpp ++++ b/src/Overlay.cpp +@@ -20,6 +20,7 @@ + #include "devices.hpp" + + #include ++#include + #include + #include + #include +@@ -31,6 +32,8 @@ + #include + #include + ++extern boost::asio::io_context io; ++ + constexpr const char* OUTPUT_DIR = "/tmp/overlays"; + constexpr const char* TEMPLATE_CHAR = "$"; + constexpr const char* HEX_FORMAT_STR = "0x"; +@@ -112,16 +115,150 @@ void linkMux(const std::string& muxName, size_t busIndex, size_t address, + } + } + ++static int deleteDevice(const std::string& devicePath, ++ std::shared_ptr address, ++ const std::string& destructor) ++{ ++ if (!address) ++ { ++ return -1; ++ } ++ std::filesystem::path deviceDestructor(devicePath); ++ deviceDestructor /= destructor; ++ std::ofstream deviceFile(deviceDestructor); ++ if (!deviceFile.good()) ++ { ++ std::cerr << "Error writing " << deviceDestructor << "\n"; ++ return -1; ++ } ++ deviceFile << std::to_string(*address); ++ deviceFile.close(); ++ return 0; ++} ++ ++static int createDevice(const std::string& devicePath, ++ const std::string& parameters, ++ const std::string& constructor) ++{ ++ std::filesystem::path deviceConstructor(devicePath); ++ deviceConstructor /= constructor; ++ std::ofstream deviceFile(deviceConstructor); ++ if (!deviceFile.good()) ++ { ++ std::cerr << "Error writing " << deviceConstructor << "\n"; ++ return -1; ++ } ++ deviceFile << parameters; ++ deviceFile.close(); ++ ++ return 0; ++} ++ ++static bool deviceIsCreated(const std::string& devicePath, ++ std::shared_ptr bus, ++ std::shared_ptr address, ++ const bool retrying) ++{ ++ // Prevent the device from being created a second time. ++ if (bus && address) ++ { ++ std::ostringstream hex; ++ hex << std::hex << *address; ++ std::string addressHex = hex.str(); ++ std::string busStr = std::to_string(*bus); ++ ++ if (std::filesystem::is_directory(devicePath)) ++ { ++ for (const auto& path : ++ std::filesystem::directory_iterator(devicePath)) ++ { ++ if (!std::filesystem::is_directory(path)) ++ { ++ continue; ++ } ++ ++ const std::string& directoryName = path.path().filename(); ++ if (boost::starts_with(directoryName, busStr) && ++ boost::ends_with(directoryName, addressHex)) ++ { ++ if (retrying) ++ { ++ // subsequent attempts should find the hwmon subdir. ++ std::filesystem::path hwmonDir(devicePath); ++ hwmonDir /= directoryName; ++ hwmonDir /= "hwmon"; ++ bool dirFound = ++ (std::filesystem::is_directory(hwmonDir)); ++ return dirFound; ++ } ++ else ++ { ++ return true; ++ } ++ } ++ } ++ return false; ++ } ++ } ++ return false; ++} ++ ++constexpr size_t totalBuildDeviceRetries = 5; ++static int buildDevice(const std::string& devicePath, ++ const std::string& parameters, ++ std::shared_ptr bus, ++ std::shared_ptr address, ++ const std::string& constructor, ++ const std::string& destructor, const bool createsHWMon, ++ const size_t retries = totalBuildDeviceRetries) ++{ ++ bool tryAgain = false; ++ if (!retries) ++ { ++ return -1; ++ } ++ int retVal = 0; ++ ++ if (!deviceIsCreated(devicePath, bus, address, false)) ++ { ++ createDevice(devicePath, parameters, constructor); ++ tryAgain = true; ++ } ++ else if (createsHWMon && !deviceIsCreated(devicePath, bus, address, true)) ++ { ++ // device is present, hwmon subdir missing ++ deleteDevice(devicePath, address, destructor); ++ tryAgain = true; ++ } ++ ++ if (tryAgain) ++ { ++ std::shared_ptr createTimer = ++ std::make_shared(io); ++ createTimer->expires_after(std::chrono::milliseconds(500)); ++ createTimer->async_wait([createTimer, devicePath, parameters, bus, ++ address, constructor, destructor, createsHWMon, ++ retries](const boost::system::error_code&) { ++ buildDevice(devicePath, parameters, bus, address, constructor, ++ destructor, createsHWMon, retries - 1); ++ }); ++ } ++ return 0; ++} ++ + void exportDevice(const std::string& type, + const devices::ExportTemplate& exportTemplate, + const nlohmann::json& configuration) + { + + std::string parameters = exportTemplate.parameters; +- std::string device = exportTemplate.device; ++ std::string devicePath = exportTemplate.devicePath; ++ std::string constructor = exportTemplate.add; ++ std::string destructor = exportTemplate.remove; ++ bool createsHWMon = exportTemplate.createsHWMon; + std::string name = "unknown"; +- const uint64_t* bus = nullptr; +- const uint64_t* address = nullptr; ++ std::shared_ptr bus = nullptr; ++ std::shared_ptr address = nullptr; + const nlohmann::json::array_t* channels = nullptr; + + for (auto keyPair = configuration.begin(); keyPair != configuration.end(); +@@ -143,11 +280,13 @@ void exportDevice(const std::string& type, + + if (keyPair.key() == "Bus") + { +- bus = keyPair.value().get_ptr(); ++ bus = std::make_shared( ++ *keyPair.value().get_ptr()); + } + else if (keyPair.key() == "Address") + { +- address = keyPair.value().get_ptr(); ++ address = std::make_shared( ++ *keyPair.value().get_ptr()); + } + else if (keyPair.key() == "ChannelNames") + { +@@ -156,49 +295,14 @@ void exportDevice(const std::string& type, + } + boost::replace_all(parameters, TEMPLATE_CHAR + keyPair.key(), + subsituteString); +- boost::replace_all(device, TEMPLATE_CHAR + keyPair.key(), ++ boost::replace_all(devicePath, TEMPLATE_CHAR + keyPair.key(), + subsituteString); + } + +- // if we found bus and address we can attempt to prevent errors +- if (bus != nullptr && address != nullptr) +- { +- std::ostringstream hex; +- hex << std::hex << *address; +- const std::string& addressHex = hex.str(); +- std::string busStr = std::to_string(*bus); ++ int err = buildDevice(devicePath, parameters, bus, address, constructor, ++ destructor, createsHWMon); + +- std::filesystem::path devicePath(device); +- std::filesystem::path parentPath = devicePath.parent_path(); +- if (std::filesystem::is_directory(parentPath)) +- { +- for (const auto& path : +- std::filesystem::directory_iterator(parentPath)) +- { +- if (!std::filesystem::is_directory(path)) +- { +- continue; +- } +- +- const std::string& directoryName = path.path().filename(); +- if (boost::starts_with(directoryName, busStr) && +- boost::ends_with(directoryName, addressHex)) +- { +- return; // already exported +- } +- } +- } +- } +- +- std::ofstream deviceFile(device); +- if (!deviceFile.good()) +- { +- std::cerr << "Error writing " << device << "\n"; +- return; +- } +- deviceFile << parameters; +- deviceFile.close(); +- if (boost::ends_with(type, "Mux") && bus && address && channels) ++ if (!err && boost::ends_with(type, "Mux") && bus && address && channels) + { + linkMux(name, static_cast(*bus), static_cast(*address), + *channels); +-- +2.26.2 + 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 f3f7d7ebe..212797329 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 @@ -3,4 +3,5 @@ SRC_URI = "git://github.com/openbmc/entity-manager.git" SRCREV = "e18edb5badc2e16181cfc464a6ccd0ef51dc4548" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += "file://0001-Add-retries-to-mapper-calls.patch" +SRC_URI += "file://0001-Add-retries-to-mapper-calls.patch \ + file://0002-Improve-initialization-of-I2C-sensors.patch" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/0001-Ignore-SIG_QUIT-signal-in-obmc-console-server.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/0001-Ignore-SIG_QUIT-signal-in-obmc-console-server.patch new file mode 100644 index 000000000..b500fffc1 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/0001-Ignore-SIG_QUIT-signal-in-obmc-console-server.patch @@ -0,0 +1,37 @@ +From 9560be9acd6baaf816c2f3cba37185a8c1d83131 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Wed, 28 Oct 2020 14:02:07 +0800 +Subject: [PATCH] Ignore SIG_QUIT signal in obmc-console-server. + +During long time AC cycle testing, there are 2 unexpected QUIT +signals in 1500 cycles. +Which cause obmc-console service restart as below: +"""""""" +intel-obmc systemd[1]:obmc-console@ttyS2.service: Main process exited, code=dumped, status=3/QUIT +intel-obmc systemd[1]:obmc-console@ttyS2.service: Failed with result 'core-dump'. +intel-obmc systemd[1]:obmc-console@ttyS2.service: Scheduled restart job, restart counter is at 1. +"""""""" + +Tested: +obmc-console service will not restart even send QUIT signal by kill command + +Signed-off-by: Kuiying Wang +--- + console-server.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/console-server.c b/console-server.c +index 11d017b..f6ac09a 100644 +--- a/console-server.c ++++ b/console-server.c +@@ -703,6 +703,7 @@ int run_console(struct console *console) + int rc, timeout; + + sighandler_save = signal(SIGINT, sighandler); ++ signal(SIGQUIT,SIG_IGN); + + rc = 0; + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console_%.bbappend index 09510fec8..95b43e778 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console_%.bbappend @@ -2,6 +2,7 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" OBMC_CONSOLE_HOST_TTY = "ttyS2" SRC_URI += "file://sol-option-check.sh \ file://obmc-console@.service \ + file://0001-Ignore-SIG_QUIT-signal-in-obmc-console-server.patch \ " inherit obmc-phosphor-systemd diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-add-sufficient-delay-to-create-fw-update-object.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-add-sufficient-delay-to-create-fw-update-object.patch index e6fd85f85..611d585bc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-add-sufficient-delay-to-create-fw-update-object.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-add-sufficient-delay-to-create-fw-update-object.patch @@ -3,13 +3,13 @@ From: Chalapathi Venkataramashetty Date: Tue, 25 Aug 2020 15:44:35 +0000 Subject: [PATCH] add sufficient delay to create fw update object -Add support to increase timeoutTimeSeconds to 10 secs to allow firmware +Add support to increase timeoutTimeSeconds to 20 secs to allow firmware object to create successfully to proceed for firmware update. Tested: Redfish validator passed. -Updated the firmware using redfish for 16 times continuously. +Successfully updated the firmware using redfish for more than 10 times continuously. POST: https:///redfish/v1/UpdateService/ with binary file firmware updated. @@ -22,6 +22,7 @@ firmware updated. } Signed-off-by: Chalapathi Venkataramashetty +Signed-off-by: Jayaprakash Mutyala --- redfish-core/lib/update_service.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) @@ -35,7 +36,7 @@ index 9407d75..ec5ab8c 100644 std::shared_ptr asyncResp, const crow::Request& req, const std::string& url, const std::vector& imgUriTargets, - int timeoutTimeSeconds = 5) -+ int timeoutTimeSeconds = 10) ++ int timeoutTimeSeconds = 20) { // Only allow one FW update at a time if (fwUpdateInProgress != false) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0032-fix-for-duplicate-redfish-event-log-ID-s.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0032-fix-for-duplicate-redfish-event-log-ID-s.patch new file mode 100644 index 000000000..f4e1feea1 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0032-fix-for-duplicate-redfish-event-log-ID-s.patch @@ -0,0 +1,68 @@ +From 013530bbf14bf14f7772a24675abba15bfba6be8 Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Mon, 12 Oct 2020 20:10:31 +0530 +Subject: [PATCH] fix for duplicate redfish event log ID's + +Corrected the logic of reading redfish event +logs distributed across backup's files with +same time stamp. +When event logs with same timestamp is distributed +across redfish event log backup files, redfish event +log ID's calculation causes duplicate ID's. Corrected +the logic for avoiding duplicate ID's. + +Tested: + - Simulated duplicate ID's across backup files and + confirmed no duplicate ID's + +Change-Id: I94266a4396380f50c0df556f4a61426967d8e24a +Signed-off-by: AppaRao Puli +--- + redfish-core/lib/log_services.hpp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp +index e6090e5..e6a9022 100644 +--- a/redfish-core/lib/log_services.hpp ++++ b/redfish-core/lib/log_services.hpp +@@ -1265,6 +1265,9 @@ class JournalEventLogEntryCollection : public Node + uint64_t entryCount = 0; + std::string logEntry; + ++ // Reset the unique ID on the first entry ++ bool firstEntry = true; ++ + // Oldest logs are in the last file, so start there and loop backwards + for (auto it = redfishLogFiles.rbegin(); it < redfishLogFiles.rend(); + it++) +@@ -1275,8 +1278,6 @@ class JournalEventLogEntryCollection : public Node + continue; + } + +- // Reset the unique ID on the first entry +- bool firstEntry = true; + while (std::getline(logStream, logEntry)) + { + entryCount++; +@@ -1353,6 +1354,9 @@ class JournalEventLogEntry : public Node + getRedfishLogFiles(redfishLogFiles); + std::string logEntry; + ++ // Reset the unique ID on the first entry ++ bool firstEntry = true; ++ + // Oldest logs are in the last file, so start there and loop backwards + for (auto it = redfishLogFiles.rbegin(); it < redfishLogFiles.rend(); + it++) +@@ -1363,8 +1367,6 @@ class JournalEventLogEntry : public Node + continue; + } + +- // Reset the unique ID on the first entry +- bool firstEntry = true; + while (std::getline(logStream, logEntry)) + { + std::string idStr; +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0033-Redfish-validator-conformance-fix.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0033-Redfish-validator-conformance-fix.patch new file mode 100644 index 000000000..504e72663 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0033-Redfish-validator-conformance-fix.patch @@ -0,0 +1,121 @@ +From 7959553c906887b5dc9b3fdf020bbd1049007cb6 Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Mon, 12 Oct 2020 17:52:31 +0530 +Subject: [PATCH] Redfish validator conformance fix + +This commit fixes the issues reported in +redfish service validator conformance test. + - PCIeFunctions: Add empty checks for + not mandatory properties and skip them. + Also assign default if DeviceId exist and + DeviceClass is empty. + - Memory schema: Corrected the MemoryDeviceType + Value. + +Tested: + - Redfish validator passed. + +Change-Id: Ic32e0f3688a3c0d211b6da995ee86b225c256a92 +Signed-off-by: AppaRao Puli +--- + redfish-core/lib/cpudimm.hpp | 12 +++++++++--- + redfish-core/lib/pcie.hpp | 21 ++++++++++++++------- + 2 files changed, 23 insertions(+), 10 deletions(-) + +diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp +index e332a11..d15ae6b 100644 +--- a/redfish-core/lib/cpudimm.hpp ++++ b/redfish-core/lib/cpudimm.hpp +@@ -513,10 +513,16 @@ void getDimmDataByService(std::shared_ptr aResp, + std::get_if(&property.second); + if (value != nullptr) + { +- aResp->res.jsonValue["MemoryDeviceType"] = *value; +- if (boost::starts_with(*value, "DDR")) ++ std::size_t found = value->find_last_of("."); ++ if (found != std::string::npos) + { +- aResp->res.jsonValue["MemoryType"] = "DRAM"; ++ std::string memDevType = value->substr(found + 1); ++ aResp->res.jsonValue["MemoryDeviceType"] = ++ memDevType; ++ if (boost::starts_with(memDevType, "DDR")) ++ { ++ aResp->res.jsonValue["MemoryType"] = "DRAM"; ++ } + } + } + } +diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp +index ac2a2f9..ee92429 100644 +--- a/redfish-core/lib/pcie.hpp ++++ b/redfish-core/lib/pcie.hpp +@@ -364,14 +364,14 @@ class SystemPCIeFunction : public Node + + if (std::string* property = std::get_if( + &pcieDevProperties["Function" + function + "DeviceId"]); +- property) ++ property && !property->empty()) + { + asyncResp->res.jsonValue["DeviceId"] = *property; + } + + if (std::string* property = std::get_if( + &pcieDevProperties["Function" + function + "VendorId"]); +- property) ++ property && !property->empty()) + { + asyncResp->res.jsonValue["VendorId"] = *property; + } +@@ -385,28 +385,35 @@ class SystemPCIeFunction : public Node + + if (std::string* property = std::get_if( + &pcieDevProperties["Function" + function + "DeviceClass"]); +- property) ++ property && !property->empty()) + { + asyncResp->res.jsonValue["DeviceClass"] = *property; + } ++ else ++ { ++ // DeviceClass is mandatory property. If DeviceId exist and ++ // DeviceClass is empty, Lets mark it 'UnassignedClass' so ++ // that user can lookup the DeviceId for actual class. ++ asyncResp->res.jsonValue["DeviceClass"] = "UnassignedClass"; ++ } + + if (std::string* property = std::get_if( + &pcieDevProperties["Function" + function + "ClassCode"]); +- property) ++ property && !property->empty()) + { + asyncResp->res.jsonValue["ClassCode"] = *property; + } + + if (std::string* property = std::get_if( + &pcieDevProperties["Function" + function + "RevisionId"]); +- property) ++ property && !property->empty()) + { + asyncResp->res.jsonValue["RevisionId"] = *property; + } + + if (std::string* property = std::get_if( + &pcieDevProperties["Function" + function + "SubsystemId"]); +- property) ++ property && !property->empty()) + { + asyncResp->res.jsonValue["SubsystemId"] = *property; + } +@@ -414,7 +421,7 @@ class SystemPCIeFunction : public Node + if (std::string* property = std::get_if( + &pcieDevProperties["Function" + function + + "SubsystemVendorId"]); +- property) ++ property && !property->empty()) + { + asyncResp->res.jsonValue["SubsystemVendorId"] = *property; + } +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0036-fix-bmcweb-crash-during-sol-communication.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0036-fix-bmcweb-crash-during-sol-communication.patch new file mode 100644 index 000000000..9c0d659b5 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0036-fix-bmcweb-crash-during-sol-communication.patch @@ -0,0 +1,75 @@ +From 8f990dfe45e41c8733f52b1a35575fe7bf749054 Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Fri, 13 Nov 2020 19:28:22 +0530 +Subject: [PATCH] fix bmcweb crash during sol communication + +After establishing the obmc_console socket +communication, If client closes the connection +abruptly, async read/write operation fails with +asio.ssl.stream error. To handle the error, it calls +closeHandler call back function and cleans the session +and socket. Any ongoing async read operation should +be discarded by checking socket handle. Read/Write message +from stream via async_read_some()/async_write_some() +without checking socket handle, causes the crash. +Added socket handle validation before performing any +read/write operation to avoid crash. + +Tested: + - Without fix, when sol connection closes abruptly, at times + saw the crash with below logs. +Nov 13 11:32:51 intel-obmc bmcweb[20169]: doRead error asio.ssl.stream:1 +Nov 13 11:32:51 intel-obmc systemd[1]: bmcweb.service: Main process exited, code=dumped, status=11/SEGV +Nov 13 11:32:51 intel-obmc systemd[1]: bmcweb.service: Failed with result 'core-dump'. + + - With fix, verified the case and no crashes seen. +Nov 13 12:55:04 intel-obmc bmcweb[24426]: (2020-11-13 12:55:04) [ERROR "websocket.h":207] doRead error asio.ssl.stream:1 +Nov 13 12:55:04 intel-obmc bmcweb[24426]: (2020-11-13 12:55:04) [ERROR "obmc_console.hpp":67] doread() - Socket closed + +Signed-off-by: AppaRao Puli +Change-Id: I2afda509ca77a561651a8682e042c45ca7366642 +--- + include/obmc_console.hpp | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp +index 9e5e058..8608f5f 100644 +--- a/include/obmc_console.hpp ++++ b/include/obmc_console.hpp +@@ -36,6 +36,12 @@ void doWrite() + return; + } + ++ if (!host_socket) ++ { ++ BMCWEB_LOG_ERROR << "doWrite(): Socket closed."; ++ return; ++ } ++ + doingWrite = true; + host_socket->async_write_some( + boost::asio::buffer(inputBuffer.data(), inputBuffer.size()), +@@ -62,6 +68,12 @@ void doWrite() + + void doRead() + { ++ if (!host_socket) ++ { ++ BMCWEB_LOG_ERROR << "doRead(): Socket closed."; ++ return; ++ } ++ + BMCWEB_LOG_DEBUG << "Reading from socket"; + host_socket->async_read_some( + boost::asio::buffer(outputBuffer.data(), outputBuffer.size()), +@@ -125,6 +137,7 @@ void requestRoutes(CrowApp& app) + }) + .onclose( + [](crow::websocket::Connection& conn, const std::string& reason) { ++ BMCWEB_LOG_INFO << "Closing websocket. Reason: " << reason; + sessions.erase(&conn); + if (sessions.empty()) + { +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Use-non-throw-version-of-remote_endpoint.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Use-non-throw-version-of-remote_endpoint.patch new file mode 100644 index 000000000..e1171e182 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Use-non-throw-version-of-remote_endpoint.patch @@ -0,0 +1,55 @@ +From 666b78c7599960a8ac8d1a90d389dd02e605a170 Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Tue, 24 Nov 2020 13:55:12 +0530 +Subject: [PATCH] Use non-throw version of remote_endpoint + +Using boost call to get the remote endpoint of +socket is not handled properly in code, causes +the bmcweb crash in some corner cases. + +Nov 23 18:48:07 intel-obmc bmcweb[19300]: terminate called after throwing an instance of 'boost::wrapexcept' +Nov 23 18:48:07 intel-obmc bmcweb[19300]: what(): remote_endpoint: Bad file descriptor + +Added non-throw version of remote_endpoint() +and handled the error code appropriately to avoid +the bmcweb crash. + +Tested: + - Sesisons URI show properly remote IP address + and no bmcweb crashes seen. + +Change-Id: Iafa9011dbc09235785cbb7d853e22d5fd752db89 +Signed-off-by: AppaRao Puli +--- + redfish-core/lib/redfish_sessions.hpp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp +index 267f98a..1a015f3 100644 +--- a/redfish-core/lib/redfish_sessions.hpp ++++ b/redfish-core/lib/redfish_sessions.hpp +@@ -230,12 +230,18 @@ class SessionCollection : public Node + auto socket = req.socket(); + if (socket) + { ++ boost::system::error_code ec; + #ifdef BMCWEB_ENABLE_SSL +- clientIp = +- (*socket).next_layer().remote_endpoint().address().to_string(); ++ boost::asio::ip::tcp::endpoint endpoint = ++ (*socket).next_layer().remote_endpoint(ec); + #else +- clientIp = (*socket).remote_endpoint().address().to_string(); ++ boost::asio::ip::tcp::endpoint endpoint = ++ (*socket).remote_endpoint(ec); + #endif ++ if (!ec) ++ { ++ clientIp = endpoint.address().to_string(); ++ } + } + // User is authenticated - create session + std::shared_ptr session = +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Change-Severity-for-ServiceFailure-redfish-event.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Change-Severity-for-ServiceFailure-redfish-event.patch new file mode 100644 index 000000000..af2f05151 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Change-Severity-for-ServiceFailure-redfish-event.patch @@ -0,0 +1,56 @@ +From 8c1be7323641010df618e8d6fc60829b1afa75c6 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Thu, 3 Dec 2020 18:33:43 +0000 +Subject: [PATCH] Change Severity for ServiceFailure redfish event + +During Ac cycle stress, at times some services may exit unsuccessfully. +This will not have any functionality impact. So updated Severity of +"ServiceFailure" redfish event to "Ok". + +Tested: +1. Redfish validator - passed for this with change +2. Killed couple of process and observed Redfish EventLog shows updated + Severity. +Redfish URI: +GET: https:///redfish/v1/Systems/system/LogServices/EventLog + /Entries + { + "@odata.id": "/redfish/v1/Systems/system/LogServices/ + EventLog/Entries/1606938922", + "@odata.type": "#LogEntry.v1_4_0.LogEntry", + "Created": "2020-12-02T19:55:22+00:00", + "EntryType": "Event", + "Id": "1606938922", + "Message": "Service phosphor-ipmi-host.service has exited + unsuccessfully.", + "MessageArgs": [ + "phosphor-ipmi-host.service" + ], + "MessageId": "OpenBMC.0.1.ServiceFailure", + "Name": "System Event Log Entry", + "Severity": "OK" + } + +Signed-off-by: Jayaprakash Mutyala +--- + redfish-core/include/registries/openbmc_message_registry.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp +index 6f1fec3..522d783 100644 +--- a/redfish-core/include/registries/openbmc_message_registry.hpp ++++ b/redfish-core/include/registries/openbmc_message_registry.hpp +@@ -2281,8 +2281,8 @@ constexpr std::array registry = { + { + "Indicates that a service has exited unsuccessfully.", + "Service %1 has exited unsuccessfully.", +- "Warning", +- "Warning", ++ "OK", ++ "OK", + 1, + {"string"}, + "None.", +-- +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 38f0fe532..279b8bec4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -46,8 +46,13 @@ SRC_URI += "file://0001-Firmware-update-support-for-StandBySpare.patch \ file://0029-Added-Validation-on-MessageId-and-RegistryPrefix.patch \ file://0030-Initialize-Event-Service-Config-on-bmcweb-restart.patch \ file://0031-get-on-crashdump-can-follow-redfish-privileges.patch \ + file://0032-fix-for-duplicate-redfish-event-log-ID-s.patch \ + file://0033-Redfish-validator-conformance-fix.patch \ file://0034-Avoid-using-deleted-Connection-in-Response.patch \ file://0035-EventService-Fix-hostname-resolve-issue.patch \ + file://0036-fix-bmcweb-crash-during-sol-communication.patch \ + file://0037-Use-non-throw-version-of-remote_endpoint.patch \ + file://0038-Change-Severity-for-ServiceFailure-redfish-event.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/intrusionsensor-depend-on-networkd.conf b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/intrusionsensor-depend-on-networkd.conf new file mode 100644 index 000000000..6f0fd3ffc --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/intrusionsensor-depend-on-networkd.conf @@ -0,0 +1,3 @@ +[Unit] +After=systemd-networkd.service +Requires=systemd-networkd.service 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 68aa751db..ebb63ca19 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 @@ -1,11 +1,24 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +PROJECT_SRC_DIR := "${THISDIR}/${PN}" + SRCREV = "8aeffd91ff3434f7812e9fdb6b0b03c6119921dd" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" -DEPENDS_append = " libgpiod libmctp" +SRC_URI += "\ + file://intrusionsensor-depend-on-networkd.conf \ + " -FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" +DEPENDS_append = " libgpiod libmctp" PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'disable-nvme-sensors', d)}" PACKAGECONFIG[disable-nvme-sensors] = "-DDISABLE_NVME=ON, -DDISABLE_NVME=OFF" SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'disable-nvme-sensors', '', 'xyz.openbmc_project.nvmesensor.service', d)}" + +do_install_append() { + svc="xyz.openbmc_project.intrusionsensor.service" + srcf="${WORKDIR}/intrusionsensor-depend-on-networkd.conf" + dstf="${D}/etc/systemd/system/${svc}.d/10-depend-on-networkd.conf" + mkdir -p "${D}/etc/systemd/system/${svc}.d" + install "${srcf}" "${dstf}" +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb index fc6e1034a..addd1ccb2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog.bb @@ -5,20 +5,8 @@ DESCRIPTION = "BMC hardware watchdog service that is used to reset BMC \ inherit allarch inherit obmc-phosphor-systemd -RDEPENDS_${PN} = "bash" - LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" SYSTEMD_SERVICE_${PN} += "system-watchdog.service" SYSTEMD_ENVIRONMENT_FILE_${PN} += "obmc/system-watchdog/system-watchdog.conf" - -SYSTEMD_SERVICE_${PN} += "watchdog-reset@.service" -SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.service" -SYSTEMD_SERVICE_${PN} += "watchdog-clear-failures.timer" -SRC_URI += "file://watchdog-reset.sh" - -do_install_append(){ - install -d ${D}${bindir} - install -m 0755 ${WORKDIR}/watchdog-reset.sh ${D}${bindir} -} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.service deleted file mode 100644 index 801f4ed27..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Reset BMC Hardware Watchdog Failure Count - -[Service] -ExecStart=busctl call xyz.openbmc_project.U_Boot.Environment.Manager \ - /xyz/openbmc_project/u_boot/environment/mgr \ - xyz.openbmc_project.U_Boot.Environment.Manager \ - Write ss bootfailures 0 -Type=oneshot - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.timer b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.timer deleted file mode 100644 index 1abac4326..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-clear-failures.timer +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Starts the clear watchdog serivce after 30 minutes - -[Timer] -OnBootSec=30min - -[Install] -WantedBy=timers.target diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh deleted file mode 100644 index 3413fdb9f..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -echo "Watchdog being started by $1" > /dev/kmsg - -if /sbin/fw_printenv bootfailures -n | grep -q 3; then - exit 0 # passed boot limit, user started again on purpose -fi - -if test -f "/tmp/nowatchdog"; then - echo "Not resetting due to nowatchdog file" > /dev/kmsg - exit 0 -fi - -echo "Log as follows:" > /dev/kmsg -journalctl -r -n 100 | while read line; do echo $line > /dev/kmsg; done - -systemctl stop system-watchdog.service -/sbin/watchdog -T 0 -F /dev/watchdog1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset@.service b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset@.service deleted file mode 100644 index 6b1ebc544..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset@.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Reset BMC Using Hardware Watchdog - -[Service] -ExecStart=/usr/bin/watchdog-reset.sh %i -Type=oneshot - 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 9c4a3c879..46f4a28a9 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,4 +1,14 @@ SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2" FILESEXTRAPATHS_prepend_intel := "${THISDIR}/${PN}:" -SRCREV = "9db94c5d0e61c6cd5935e770c14a9ad6231da497" +SRCREV = "3b13f734a5f881b9b51346ba09fabea752b145f3" + +# 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 +} diff --git a/meta-openbmc-mods/meta-wht/recipes-core/host-error-monitor/host-error-monitor/0001-Filter-memory-thermtrip-events-based-on-DIMM-status.patch b/meta-openbmc-mods/meta-wht/recipes-core/host-error-monitor/host-error-monitor/0001-Filter-memory-thermtrip-events-based-on-DIMM-status.patch index 874477601..3f42f80bc 100644 --- a/meta-openbmc-mods/meta-wht/recipes-core/host-error-monitor/host-error-monitor/0001-Filter-memory-thermtrip-events-based-on-DIMM-status.patch +++ b/meta-openbmc-mods/meta-wht/recipes-core/host-error-monitor/host-error-monitor/0001-Filter-memory-thermtrip-events-based-on-DIMM-status.patch @@ -22,11 +22,11 @@ that the memory thermtrip event is logged. Change-Id: I9c38b41db30046499297ee24cc3a2790920b19d3 Signed-off-by: Jason M. Bills --- - src/host_error_monitor.cpp | 77 +++++++++++++++++++++++++++++++++++++- - 1 file changed, 75 insertions(+), 2 deletions(-) + src/host_error_monitor.cpp | 81 ++++++++++++++++++++++++++++++++++++-- + 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/src/host_error_monitor.cpp b/src/host_error_monitor.cpp -index 313ef29e0..ca089f70d 100644 +index 313ef29e0..16297bb47 100644 --- a/src/host_error_monitor.cpp +++ b/src/host_error_monitor.cpp @@ -17,6 +17,7 @@ @@ -137,6 +137,22 @@ index 313ef29e0..ca089f70d 100644 { memThermTripLog(2); } +@@ -1503,13 +1572,13 @@ static void initializeErrorState() + } + + // Handle CPU1_MEM_THERM_EVENT (CPU1 DIMM Thermal trip) if it's asserted now +- if (cpu1MemtripLine.get_value() == 0) ++ if ((cpu1MemtripLine.get_value() == 0) && !cpu1CriticalDIMMs.empty()) + { + memThermTripLog(1); + } + + // Handle CPU2_MEM_THERM_EVENT (CPU2 DIMM Thermal trip) if it's asserted now +- if (cpu2MemtripLine.get_value() == 0) ++ if ((cpu2MemtripLine.get_value() == 0) && !cpu2CriticalDIMMs.empty()) + { + memThermTripLog(2); + } @@ -1621,6 +1690,10 @@ int main(int argc, char* argv[]) std::shared_ptr hostStateMonitor = host_error_monitor::startHostStateMonitor(); -- cgit v1.2.3