diff --git a/meta-webos/recipes-webos/bootd/bootd.bb b/meta-webos/recipes-webos/bootd/bootd.bb index 078796905..d19602c4f 100644 --- a/meta-webos/recipes-webos/bootd/bootd.bb +++ b/meta-webos/recipes-webos/bootd/bootd.bb @@ -14,7 +14,7 @@ LIC_FILES_CHKSUM = " \ DEPENDS = "luna-service2 libpbnjson pmloglib glib-2.0 boost" WEBOS_VERSION = "2.0.0-22_f03736d2cb1bfb131b31706f64d1c2fdf06178a0" -PR = "r18" +PR = "r19" inherit webos_component inherit webos_enhanced_submissions @@ -25,7 +25,9 @@ inherit webos_lttng inherit webos_public_repo inherit webos_prerelease_dep -SRC_URI = "${WEBOSOSE_GIT_REPO_COMPLETE}" +SRC_URI = "${WEBOSOSE_GIT_REPO_COMPLETE} \ + file://0002-Logger.cpp-fix-segfault-with-64bit-time_t.patch \ +" S = "${WORKDIR}/git" inherit webos_systemd diff --git a/meta-webos/recipes-webos/bootd/bootd/0002-Logger.cpp-fix-segfault-with-64bit-time_t.patch b/meta-webos/recipes-webos/bootd/bootd/0002-Logger.cpp-fix-segfault-with-64bit-time_t.patch new file mode 100644 index 000000000..2785b42bc --- /dev/null +++ b/meta-webos/recipes-webos/bootd/bootd/0002-Logger.cpp-fix-segfault-with-64bit-time_t.patch @@ -0,0 +1,74 @@ +From f6efaccc5c8f90100880cb588bcfbab84e274a75 Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Mon, 19 Aug 2024 17:07:20 +0200 +Subject: [PATCH] Logger.cpp: fix segfault with 64bit time_t + +:Release Notes: +It was already reported by gcc in log.do_compile: +../git/src/bootd/util/Logger.cpp:124:20: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__time64_t' {aka 'long long int'} [-Wformat=] +../git/src/bootd/event/DynamicEventDB.cpp:315:28: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Wformat=] +but it wasn't fatal for the build, "only" causes segfault in runtime. + +:Detailed Notes: +Fixes: + Program received signal SIGSEGV, Segmentation fault. + __GI_strlen () at ../sysdeps/i386/i586/strlen.S:50 + warning: Source file is more recent than executable. + 50 cmpb %dh, (%eax) /* is byte NUL? */ + (gdb) bt + #0 __GI_strlen () at ../sysdeps/i386/i586/strlen.S:50 + #1 0xb760fb49 in __printf_buffer (buf=0xbffff030, format=0x42b8cf "%s(%3ld.%09ld) : %s) %s\n", ap=0xbffff89c "\251\271B", mode_flags=2) at /usr/src/debug/glibc/2.40+git/stdio-common/vfprintf-process-arg.c:435 + #2 0xb762f64f in __vdprintf_internal (d=870436166, format=0x42b8cf "%s(%3ld.%09ld) : %s) %s\n", arg=0xbffff88c "\350\270B", mode_flags=2) at iovdprintf.c:69 + #3 0xb76dd7d3 in __dprintf_chk (d=4, flag=1, format=0x42b8cf "%s(%3ld.%09ld) : %s) %s\n") at dprintf_chk.c:33 + #4 0x00429a95 in dprintf (__fd=, __fmt=0x42b8cf "%s(%3ld.%09ld) : %s) %s\n") at /usr/include/bits/stdio2.h:174 + #5 Logger::writeBootdLog (this=0x435440 , type=0x42b8e8 "PERFORMANCE", msgid=0x42b9a9 "Boot", msg=0x43544c "BOOTD_START") at /usr/src/debug/bootd/2.0.0-23/src/bootd/util/Logger.cpp:123 + #6 0x00429bdf in Logger::performanceLog (this=0x435440 , msgid=0x42b9a9 "Boot", format=0x42b008 "BOOTD_START") at /usr/src/debug/bootd/2.0.0-23/src/bootd/util/Logger.cpp:143 + #7 0x0040fbf8 in main (argc=1, argv=0xbffffa54) at /usr/src/debug/bootd/2.0.0-23/src/bootd/Main.cpp:44 + +:Testing Performed: +Local Test: OK + +:QA Notes: + +:Issues Addressed: +[WRQ-32812] bootd segfaults with 64-bit time_t + +Change-Id: I45ed378ac1212a6ecbcdf84479d721c2960641c5 +--- +Upstream-Status: Submitted [http://gpro.lge.com/c/webosose/bootd/+/428559 Logger.cpp: fix segfault with 64bit time_t] + + src/bootd/event/DynamicEventDB.cpp | 2 +- + src/bootd/util/Logger.cpp | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/bootd/event/DynamicEventDB.cpp b/src/bootd/event/DynamicEventDB.cpp +index e2de0d3..acf61b6 100644 +--- a/src/bootd/event/DynamicEventDB.cpp ++++ b/src/bootd/event/DynamicEventDB.cpp +@@ -312,7 +312,7 @@ void DynamicEventDB::callEventListeners(string eventName, EventHandleType type) + struct timespec curTime; + char timeBuffer[256] = { 0, }; + g_Logger.getCurrentTime(curTime); +- sprintf(timeBuffer, "%ld.%09ld", curTime.tv_sec, curTime.tv_nsec); ++ sprintf(timeBuffer, "%jd.%09jd", (intmax_t)curTime.tv_sec, (intmax_t)curTime.tv_nsec); + m_eventDatabase[eventName].put(KEY_TIME, timeBuffer); + } + +diff --git a/src/bootd/util/Logger.cpp b/src/bootd/util/Logger.cpp +index 190e9ce..cbc1c26 100644 +--- a/src/bootd/util/Logger.cpp ++++ b/src/bootd/util/Logger.cpp +@@ -121,10 +121,10 @@ void Logger::writeBootdLog(const char *type, const char *msgid, const char *msg) + return; + + dprintf(m_fdBootdLog, +- "%s(%3ld.%09ld) : %s) %s\n", ++ "%s(%3jd.%09jd) : %s) %s\n", + type, +- curTime.tv_sec, +- curTime.tv_nsec, ++ (intmax_t)curTime.tv_sec, ++ (intmax_t)curTime.tv_nsec, + msgid, + msg); + }