summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-core')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb5
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/0001-Fix-build-error-in-kernel-v5.10.patch62
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh59
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-Use-__pthread_attr_copy-in-mq_notify-bug-27896.patch54
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-sunrpc-use-snprintf-to-guard-against-buffer-overflow.patch35
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0037-Fix-use-of-__pthread_attr_copy-in-mq_notify-bug-27896.patch52
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend3
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb2
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend5
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0002-Add-event-log-for-system-time-synchronization.patch114
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend1
11 files changed, 312 insertions, 80 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb
index 10df9dd59..f35fee7ab 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb
+++ b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb
@@ -4,7 +4,7 @@ SUMMARY = "At Scale Debug Service"
DESCRIPTION = "At Scale Debug Service exposes remote JTAG target debug capabilities"
LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=0d1c657b2ba1e8877940a8d1614ec560"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=8929d33c051277ca2294fe0f5b062f38"
inherit cmake
@@ -13,8 +13,7 @@ DEPENDS = "sdbusplus openssl libpam libgpiod safec"
do_configure[depends] += "virtual/kernel:do_shared_workdir"
SRC_URI = "git://github.com/Intel-BMC/asd;protocol=git"
-SRC_URI += "file://0001-Fix-build-error-in-kernel-v5.10.patch"
-SRCREV = "1.4.4"
+SRCREV = "1.4.6"
inherit useradd
diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/0001-Fix-build-error-in-kernel-v5.10.patch b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/0001-Fix-build-error-in-kernel-v5.10.patch
deleted file mode 100644
index 7ebedeee3..000000000
--- a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/0001-Fix-build-error-in-kernel-v5.10.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 7ed9ba9738d8f27578ea2d00019f8245ee2a5556 Mon Sep 17 00:00:00 2001
-From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
-Date: Mon, 22 Feb 2021 15:32:13 -0800
-Subject: [PATCH] Fix build error in kernel v5.10
-
-Kernel headers should be added as last headers to prevent unexpected
-build breaks.
-
-Change-Id: Ie7d1a054baf2af88b9c46f928d0d84a64d8febd9
-Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
----
- i2c_handler.c | 5 +++--
- i2c_msg_builder.c | 5 +++--
- 2 files changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/i2c_handler.c b/i2c_handler.c
-index 21fb931..05470f4 100644
---- a/i2c_handler.c
-+++ b/i2c_handler.c
-@@ -29,8 +29,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- #include <errno.h>
- #include <fcntl.h>
--#include <linux/i2c-dev.h>
--#include <linux/i2c.h>
- #include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
-@@ -40,6 +38,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- #include "logging.h"
-
-+#include <linux/i2c-dev.h>
-+#include <linux/i2c.h>
-+
- #define FILE_NAME "/dev/i2c"
- #define MAX_I2C_DEV_FILENAME 256
-
-diff --git a/i2c_msg_builder.c b/i2c_msg_builder.c
-index 6ae06a0..05dc340 100644
---- a/i2c_msg_builder.c
-+++ b/i2c_msg_builder.c
-@@ -27,13 +27,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- #include "i2c_msg_builder.h"
-
--#include <linux/i2c-dev.h>
--#include <linux/i2c.h>
- #include <stdint.h>
- #include <stdlib.h>
-
- #include "logging.h"
-
-+#include <linux/i2c-dev.h>
-+#include <linux/i2c.h>
-+
- STATUS copy_i2c_to_asd(asd_i2c_msg* asd, struct i2c_msg* i2c);
- STATUS copy_asd_to_i2c(const asd_i2c_msg* asd, struct i2c_msg* i2c);
-
---
-2.17.1
-
diff --git a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh
index e97995cc1..922aa09f5 100755
--- a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh
+++ b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh
@@ -1,15 +1,48 @@
#!/bin/sh
-if [ -e /etc/systemd/system/dropbear@.service ] && \
- [ -e /etc/systemd/system/sockets.target.wants/dropbear.socket ]
-then
- echo "SSH is already enabled"
-else
- cp /usr/share/misc/dropbear@.service /etc/systemd/system/dropbear@.service
- cp /usr/share/misc/dropbear.socket /etc/systemd/system/dropbear.socket
- ln -s /etc/systemd/system/dropbear.socket /etc/systemd/system/sockets.target.wants/dropbear.socket
- groupmems -g priv-admin -a root
- systemctl daemon-reload
- systemctl restart dropbear.socket
- echo "Enabled SSH service for root user successful"
-fi
+usage="$(basename "$0") [-h] [-d] -- Enable/Disable ssh for root user
+where:
+ -h help
+ -d disable ssh and remove priv-admin permission for root user"
+
+enable_ssh() {
+ if [ -e /etc/systemd/system/dropbear@.service ] &&
+ [ -e /etc/systemd/system/sockets.target.wants/dropbear.socket ]; then
+ echo "SSH is already enabled"
+ else
+ cp /usr/share/misc/dropbear@.service /etc/systemd/system/dropbear@.service
+ cp /usr/share/misc/dropbear.socket /etc/systemd/system/dropbear.socket
+ ln -s /etc/systemd/system/dropbear.socket /etc/systemd/system/sockets.target.wants/dropbear.socket
+ groupmems -g priv-admin -a root
+ systemctl daemon-reload
+ systemctl restart dropbear.socket
+ echo "Enabled SSH service for root user successful"
+ fi
+}
+
+disable_ssh() {
+ if [ -e /etc/systemd/system/dropbear@.service ] &&
+ [ -e /etc/systemd/system/sockets.target.wants/dropbear.socket ]; then
+ systemctl stop dropbear.socket
+ systemctl stop dropbear@*.service
+ rm -rf /etc/systemd/system/sockets.target.wants/dropbear.socket
+ rm -rf /etc/systemd/system/dropbear.socket
+ rm -rf /etc/systemd/system/dropbear@.service
+ groupmems -g priv-admin -d root
+ echo "SSH disabled"
+ else
+ echo "SSH is already disabled"
+ fi
+}
+
+case "$1" in
+"-h")
+ echo ${usage}
+ ;;
+"-d")
+ disable_ssh
+ ;;
+*)
+ enable_ssh
+ ;;
+esac
diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-Use-__pthread_attr_copy-in-mq_notify-bug-27896.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-Use-__pthread_attr_copy-in-mq_notify-bug-27896.patch
new file mode 100644
index 000000000..5e1bc958b
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-Use-__pthread_attr_copy-in-mq_notify-bug-27896.patch
@@ -0,0 +1,54 @@
+From 42d359350510506b87101cf77202fefcbfc790cb Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@linux-m68k.org>
+Date: Thu, 27 May 2021 12:49:47 +0200
+Subject: [PATCH] Use __pthread_attr_copy in mq_notify (bug 27896)
+
+Make a deep copy of the pthread attribute object to remove a potential
+use-after-free issue.
+---
+ sysdeps/unix/sysv/linux/mq_notify.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
+index cc575a0cdd..f7ddfe5a6c 100644
+--- a/sysdeps/unix/sysv/linux/mq_notify.c
++++ b/sysdeps/unix/sysv/linux/mq_notify.c
+@@ -133,8 +133,11 @@ helper_thread (void *arg)
+ (void) __pthread_barrier_wait (&notify_barrier);
+ }
+ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
+- /* The only state we keep is the copy of the thread attributes. */
+- free (data.attr);
++ {
++ /* The only state we keep is the copy of the thread attributes. */
++ pthread_attr_destroy (data.attr);
++ free (data.attr);
++ }
+ }
+ return NULL;
+ }
+@@ -255,8 +258,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
+ if (data.attr == NULL)
+ return -1;
+
+- memcpy (data.attr, notification->sigev_notify_attributes,
+- sizeof (pthread_attr_t));
++ __pthread_attr_copy (data.attr, notification->sigev_notify_attributes);
+ }
+
+ /* Construct the new request. */
+@@ -270,7 +272,10 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
+
+ /* If it failed, free the allocated memory. */
+ if (__glibc_unlikely (retval != 0))
+- free (data.attr);
++ {
++ pthread_attr_destroy (data.attr);
++ free (data.attr);
++ }
+
+ return retval;
+ }
+--
+2.27.0
+
diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-sunrpc-use-snprintf-to-guard-against-buffer-overflow.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-sunrpc-use-snprintf-to-guard-against-buffer-overflow.patch
new file mode 100644
index 000000000..079ce0faa
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0036-sunrpc-use-snprintf-to-guard-against-buffer-overflow.patch
@@ -0,0 +1,35 @@
+From 174f4391195960b0b728fb5ee4959fcb9e12d59a Mon Sep 17 00:00:00 2001
+From: Philipp Tomsich <philipp.tomsich@vrull.eu>
+Date: Wed, 2 Dec 2020 20:04:11 +0100
+Subject: [PATCH] sunrpc: use snprintf to guard against buffer overflow
+
+GCC11 has improved detection of buffer overflows detectable through the analysis
+of format strings and parameters, which identifies the following issue:
+ netname.c:52:28: error: '%s' directive writing up to 255 bytes into a region
+ of size between 239 and 249 [-Werror=format-overflow=]
+
+This rewrites user2netname() to use snprintf to guard against overflows.
+---
+ sunrpc/netname.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/sunrpc/netname.c b/sunrpc/netname.c
+index ceed23b1a72d..1a18b7a39453 100644
+--- a/sunrpc/netname.c
++++ b/sunrpc/netname.c
+@@ -49,8 +49,10 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
+ if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
+ return 0;
+
+- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
+- i = strlen (netname);
++ i = snprintf (netname, MAXNETNAMELEN + 1, "%s.%d@%s", OPSYS, uid, dfltdom);
++ if (i > (size_t) MAXNETNAMELEN)
++ return 0;
++
+ if (netname[i - 1] == '.')
+ netname[i - 1] = '\0';
+ return 1;
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0037-Fix-use-of-__pthread_attr_copy-in-mq_notify-bug-27896.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0037-Fix-use-of-__pthread_attr_copy-in-mq_notify-bug-27896.patch
new file mode 100644
index 000000000..447943a46
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0037-Fix-use-of-__pthread_attr_copy-in-mq_notify-bug-27896.patch
@@ -0,0 +1,52 @@
+From 217b6dc298156bdb0d6aea9ea93e7e394a5ff091 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Tue, 1 Jun 2021 17:51:41 +0200
+Subject: [PATCH] Fix use of __pthread_attr_copy in mq_notify (bug 27896)
+
+__pthread_attr_copy can fail and does not initialize the attribute
+structure in that case.
+
+If __pthread_attr_copy is never called and there is no allocated
+attribute, pthread_attr_destroy should not be called, otherwise
+there is a null pointer dereference in rt/tst-mqueue6.
+
+Fixes commit 42d359350510506b87101cf77202fefcbfc790cb
+("Use __pthread_attr_copy in mq_notify (bug 27896)").
+
+Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
+---
+ sysdeps/unix/sysv/linux/mq_notify.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
+index f7ddfe5a6c..6f46d29d1d 100644
+--- a/sysdeps/unix/sysv/linux/mq_notify.c
++++ b/sysdeps/unix/sysv/linux/mq_notify.c
+@@ -258,7 +258,14 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
+ if (data.attr == NULL)
+ return -1;
+
+- __pthread_attr_copy (data.attr, notification->sigev_notify_attributes);
++ int ret = __pthread_attr_copy (data.attr,
++ notification->sigev_notify_attributes);
++ if (ret != 0)
++ {
++ free (data.attr);
++ __set_errno (ret);
++ return -1;
++ }
+ }
+
+ /* Construct the new request. */
+@@ -271,7 +278,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
+ int retval = INLINE_SYSCALL (mq_notify, 2, mqdes, &se);
+
+ /* If it failed, free the allocated memory. */
+- if (__glibc_unlikely (retval != 0))
++ if (retval != 0 && data.attr != NULL)
+ {
+ pthread_attr_destroy (data.attr);
+ free (data.attr);
+--
+2.27.0
+
diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend
index 327c1ce64..77cd9ce46 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend
@@ -2,4 +2,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += " \
file://0035-Fix-build-error.patch \
+ file://0036-sunrpc-use-snprintf-to-guard-against-buffer-overflow.patch \
+ file://0036-Use-__pthread_attr_copy-in-mq_notify-bug-27896.patch \
+ file://0037-Fix-use-of-__pthread_attr_copy-in-mq_notify-bug-27896.patch \
"
diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb
index 38426e81d..9a78fd9f8 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb
+++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb
@@ -2,7 +2,7 @@ SUMMARY = "libmctp"
DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)"
SRC_URI = "git://github.com/openbmc/libmctp.git"
-SRCREV = "9f5b47a5844023719b84855cb6c554271c95ee4a"
+SRCREV = "cfeaef8ecb0ab8c59ea4e145603523e599d60014"
PV = "0.1+git${SRCPV}"
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 628352f2c..e26e7ada4 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
@@ -2,4 +2,7 @@ EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DINTEL_PF
EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}"
EXTRA_OECMAKE += "-DUSING_ENTITY_MANAGER_DECORATORS=OFF"
SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git"
-SRCREV = "fb9f1aa1ea3c944fbba17b51ab26264af1c67a25"
+SRCREV = "323818779d541d53a70b8894f21e14b082ca59d0"
+
+FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
+
diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0002-Add-event-log-for-system-time-synchronization.patch b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0002-Add-event-log-for-system-time-synchronization.patch
new file mode 100644
index 000000000..8e07ad56a
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0002-Add-event-log-for-system-time-synchronization.patch
@@ -0,0 +1,114 @@
+From 5be7b53e598faa7605add3f9856d3b3eb4b50fe1 Mon Sep 17 00:00:00 2001
+From: Joshi-Mansi <mansi.joshi@linux.intel.com>
+Date: Thu, 13 May 2021 03:09:24 +0530
+Subject: [PATCH] Add event log for time synchronization
+
+Adding time synchronization event logs can be helpful in distinguishing
+older date and newly synced date with the first initialization
+(from 1970) or any later syncs either done via NTP or Manually.
+
+Tested:
+Confirmed that the event is getting logged correctly in Redfish.
+
+Signed-off-by: Joshi-Mansi <mansi.joshi@linux.intel.com>
+Change-Id: I8901227990ee7bc41de30af13c775cc45016a626
+---
+ src/timedate/timedated.c | 14 ++++++++++++++
+ src/timesync/timesyncd-manager.c | 14 ++++++++++++++
+ 2 files changed, 28 insertions(+)
+
+diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
+index 8149facb34..5da7158c0d 100644
+--- a/src/timedate/timedated.c
++++ b/src/timedate/timedated.c
+@@ -8,6 +8,7 @@
+ #include "sd-bus.h"
+ #include "sd-event.h"
+ #include "sd-messages.h"
++#include "sd-journal.h"
+
+ #include "alloc-util.h"
+ #include "bus-common-errors.h"
+@@ -805,6 +806,8 @@ static int method_set_time(sd_bus_message *m, void *userdata, sd_bus_error *erro
+ struct timespec ts;
+ usec_t start;
+ struct tm tm;
++ char olddate[FORMAT_TIMESTAMP_MAX];
++ char newdate[FORMAT_TIMESTAMP_MAX];
+
+ assert(m);
+ assert(c);
+@@ -819,6 +822,9 @@ static int method_set_time(sd_bus_message *m, void *userdata, sd_bus_error *erro
+ if (context_ntp_service_is_active(c) > 0)
+ return sd_bus_error_set(error, BUS_ERROR_AUTOMATIC_TIME_SYNC_ENABLED, "Automatic time synchronization is enabled");
+
++ usec_t oldtime = now(CLOCK_REALTIME);
++ format_timestamp(olddate, sizeof(olddate), oldtime);
++
+ /* this only gets used if dbus does not provide a timestamp */
+ start = now(CLOCK_MONOTONIC);
+
+@@ -886,6 +892,14 @@ static int method_set_time(sd_bus_message *m, void *userdata, sd_bus_error *erro
+ "REALTIME="USEC_FMT, timespec_load(&ts),
+ LOG_MESSAGE("Changed local time to %s", ctime(&ts.tv_sec)));
+
++ // Log an event when the system time is set manually
++ usec_t newtime = now(CLOCK_REALTIME);
++ format_timestamp(newdate, sizeof(newdate), newtime);
++ sd_journal_send("MESSAGE=BMC time updated Manually: New time=%s, Old time=%s",
++ newdate, olddate, "PRIORITY=%i", LOG_INFO,
++ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.BMCTimeUpdatedManually",
++ "REDFISH_MESSAGE_ARGS=%s,%s", newdate, olddate, NULL);
++
+ return sd_bus_reply_method_return(m, NULL);
+ }
+
+diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
+index 93ba4ef87d..d46097da07 100644
+--- a/src/timesync/timesyncd-manager.c
++++ b/src/timesync/timesyncd-manager.c
+@@ -11,6 +11,7 @@
+ #include <sys/types.h>
+
+ #include "sd-daemon.h"
++#include "sd-journal.h"
+
+ #include "alloc-util.h"
+ #include "dns-domain.h"
+@@ -425,6 +426,8 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
+ bool spike;
+ int leap_sec;
+ int r;
++ char olddate[FORMAT_TIMESTAMP_MAX];
++ char newdate[FORMAT_TIMESTAMP_MAX];
+
+ assert(source);
+ assert(m);
+@@ -513,6 +516,9 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
+ return manager_connect(m);
+ }
+
++ usec_t oldtime = now(CLOCK_REALTIME);
++ format_timestamp(olddate, sizeof(olddate), oldtime);
++
+ /* valid packet */
+ m->pending = false;
+ m->retry_interval = 0;
+@@ -610,6 +616,14 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
+
+ server_address_pretty(m->current_server_address, &pretty);
+ /* "Initial", as further successful syncs will not be logged. */
++ /* Log an event for NTP Synchronization from older date to newly synced date. */
++ usec_t newtime = now(CLOCK_REALTIME);
++ format_timestamp(newdate, sizeof(newdate), newtime);
++ sd_journal_send("MESSAGE=BMC time updated via NTP: New time=%s, Old time=%s",
++ newdate, olddate, "PRIORITY=%i", LOG_INFO,
++ "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.BMCTimeUpdatedViaNTP",
++ "REDFISH_MESSAGE_ARGS=%s,%s", newdate, olddate, NULL);
++
+ log_info("Initial synchronization to time server %s (%s).", strna(pretty), m->current_server_name->string);
+ sd_notifyf(false, "STATUS=Initial synchronization to time server %s (%s).", strna(pretty), m->current_server_name->string);
+ }
+--
+2.17.1
+
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 19843d892..ca73c1770 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend
@@ -6,6 +6,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-Modfiy-system.conf-DefaultTimeoutStopSec.patch \
file://systemd-time-wait-sync.service \
+ file://0002-Add-event-log-for-system-time-synchronization.patch \
"
USERADD_PACKAGES_remove = "${PN}-journal-gateway ${PN}-journal-upload ${PN}-journal-remote"