From: Jiaying Song <[email protected]>

The minicoredumper has multiple 2038 year problems where 'long' type
variables and strtol() function calls cause overflow on 32-bit systems
when handling timestamps after 2038-01-19.

This leads to incorrect timestamp formatting in core dump directory
names (e.g., sleep40s.20380119.031407+0000.598).

Fix by changing 'long timestamp' to 'time_t timestamp' and replacing
strtol() with strtoll() to properly handle 64-bit timestamps on
32-bit systems.

Signed-off-by: Jiaying Song <[email protected]>
---
 ...8-year-problem-in-timestamp-handling.patch | 55 +++++++++++++++++++
 .../minicoredumper/minicoredumper_2.0.7.bb    |  1 +
 2 files changed, 56 insertions(+)
 create mode 100644 
meta-oe/recipes-kernel/minicoredumper/files/0002-Fix-2038-year-problem-in-timestamp-handling.patch

diff --git 
a/meta-oe/recipes-kernel/minicoredumper/files/0002-Fix-2038-year-problem-in-timestamp-handling.patch
 
b/meta-oe/recipes-kernel/minicoredumper/files/0002-Fix-2038-year-problem-in-timestamp-handling.patch
new file mode 100644
index 0000000000..977f59b976
--- /dev/null
+++ 
b/meta-oe/recipes-kernel/minicoredumper/files/0002-Fix-2038-year-problem-in-timestamp-handling.patch
@@ -0,0 +1,55 @@
+From 0f80d5813679320b69ae1d2aefb58af1e0e2d269 Mon Sep 17 00:00:00 2001
+From: Jiaying Song <[email protected]>
+Date: Wed, 10 Dec 2025 14:22:00 +0800
+Subject: [PATCH] Fix 2038 year problem in timestamp handling
+
+The minicoredumper uses 'long' type for timestamp which causes
+overflow on 32-bit systems after 2038-01-19. This leads to
+incorrect timestamp formatting in core dump directory names.
+
+Change timestamp variable from 'long' to 'time_t' and use
+'strtoll' instead of 'strtol' to handle 64-bit timestamps
+properly on 32-bit systems.
+
+Upstream-Status: Submitted
+[https://github.com/diamon/minicoredumper/pull/24]
+
+Signed-off-by: Jiaying Song <[email protected]>
+---
+ src/minicoredumper/corestripper.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/minicoredumper/corestripper.c 
b/src/minicoredumper/corestripper.c
+index e9e3936..e52802e 100644
+--- a/src/minicoredumper/corestripper.c
++++ b/src/minicoredumper/corestripper.c
+@@ -617,7 +617,7 @@ static int init_di(struct dump_info *di, int argc, char 
*argv[])
+       if (*p != 0)
+               return 1;
+ 
+-      di->timestamp = strtol(argv[5], &p, 10);
++      di->timestamp = (time_t)strtoll(argv[5], &p, 10);
+       if (*p != 0)
+               return 1;
+ 
+@@ -3715,7 +3715,7 @@ static int do_all_dumps(struct dump_info *di, int argc, 
char *argv[])
+       bool live_dumper;
+       char *comm_base;
+       pid_t core_pid;
+-      long timestamp;
++      time_t timestamp;
+       char *comm;
+       char *exe;
+       char *p;
+@@ -3750,7 +3750,7 @@ static int do_all_dumps(struct dump_info *di, int argc, 
char *argv[])
+       if (*p != 0)
+               return 1;
+ 
+-      timestamp = strtol(argv[5], &p, 10);
++      timestamp = (time_t)strtoll(argv[5], &p, 10);
+       if (*p != 0)
+               return 1;
+ 
+-- 
+2.34.1
+
diff --git a/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.7.bb 
b/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.7.bb
index 4073381899..f68984b072 100644
--- a/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.7.bb
+++ b/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.7.bb
@@ -16,6 +16,7 @@ SRC_URI = 
"git://github.com/diamon/minicoredumper;protocol=https;branch=master \
            file://minicoredumper.init \
            file://run-ptest \
            file://0001-corestripper-Fix-uninitialized-warning.patch \
+           file://0002-Fix-2038-year-problem-in-timestamp-handling.patch \
            "
 
 
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#122486): 
https://lists.openembedded.org/g/openembedded-devel/message/122486
Mute This Topic: https://lists.openembedded.org/mt/116708870/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to