diff options
| author | Jiaying Song <jiaying.song.cn@windriver.com> | 2025-12-10 16:04:46 +0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-12-10 08:56:16 -0800 |
| commit | b5685fb375d01d2a146c1707a6f290fad195826f (patch) | |
| tree | 34356382f7636157802ff28f1aacb499c0887ab6 | |
| parent | ec4c278bc970113ea04487d531a8c391c690d5cb (diff) | |
| download | meta-openembedded-b5685fb375d01d2a146c1707a6f290fad195826f.tar.gz | |
minicoredumper: fix 2038 year problem in timestamp handling
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 <jiaying.song.cn@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-kernel/minicoredumper/files/0002-Fix-2038-year-problem-in-timestamp-handling.patch | 55 | ||||
| -rw-r--r-- | meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.7.bb | 1 |
2 files changed, 56 insertions, 0 deletions
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 @@ | |||
| 1 | From 0f80d5813679320b69ae1d2aefb58af1e0e2d269 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jiaying Song <jiaying.song.cn@windriver.com> | ||
| 3 | Date: Wed, 10 Dec 2025 14:22:00 +0800 | ||
| 4 | Subject: [PATCH] Fix 2038 year problem in timestamp handling | ||
| 5 | |||
| 6 | The minicoredumper uses 'long' type for timestamp which causes | ||
| 7 | overflow on 32-bit systems after 2038-01-19. This leads to | ||
| 8 | incorrect timestamp formatting in core dump directory names. | ||
| 9 | |||
| 10 | Change timestamp variable from 'long' to 'time_t' and use | ||
| 11 | 'strtoll' instead of 'strtol' to handle 64-bit timestamps | ||
| 12 | properly on 32-bit systems. | ||
| 13 | |||
| 14 | Upstream-Status: Submitted | ||
| 15 | [https://github.com/diamon/minicoredumper/pull/24] | ||
| 16 | |||
| 17 | Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com> | ||
| 18 | --- | ||
| 19 | src/minicoredumper/corestripper.c | 6 +++--- | ||
| 20 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/src/minicoredumper/corestripper.c b/src/minicoredumper/corestripper.c | ||
| 23 | index e9e3936..e52802e 100644 | ||
| 24 | --- a/src/minicoredumper/corestripper.c | ||
| 25 | +++ b/src/minicoredumper/corestripper.c | ||
| 26 | @@ -617,7 +617,7 @@ static int init_di(struct dump_info *di, int argc, char *argv[]) | ||
| 27 | if (*p != 0) | ||
| 28 | return 1; | ||
| 29 | |||
| 30 | - di->timestamp = strtol(argv[5], &p, 10); | ||
| 31 | + di->timestamp = (time_t)strtoll(argv[5], &p, 10); | ||
| 32 | if (*p != 0) | ||
| 33 | return 1; | ||
| 34 | |||
| 35 | @@ -3715,7 +3715,7 @@ static int do_all_dumps(struct dump_info *di, int argc, char *argv[]) | ||
| 36 | bool live_dumper; | ||
| 37 | char *comm_base; | ||
| 38 | pid_t core_pid; | ||
| 39 | - long timestamp; | ||
| 40 | + time_t timestamp; | ||
| 41 | char *comm; | ||
| 42 | char *exe; | ||
| 43 | char *p; | ||
| 44 | @@ -3750,7 +3750,7 @@ static int do_all_dumps(struct dump_info *di, int argc, char *argv[]) | ||
| 45 | if (*p != 0) | ||
| 46 | return 1; | ||
| 47 | |||
| 48 | - timestamp = strtol(argv[5], &p, 10); | ||
| 49 | + timestamp = (time_t)strtoll(argv[5], &p, 10); | ||
| 50 | if (*p != 0) | ||
| 51 | return 1; | ||
| 52 | |||
| 53 | -- | ||
| 54 | 2.34.1 | ||
| 55 | |||
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 \ | |||
| 16 | file://minicoredumper.init \ | 16 | file://minicoredumper.init \ |
| 17 | file://run-ptest \ | 17 | file://run-ptest \ |
| 18 | file://0001-corestripper-Fix-uninitialized-warning.patch \ | 18 | file://0001-corestripper-Fix-uninitialized-warning.patch \ |
| 19 | file://0002-Fix-2038-year-problem-in-timestamp-handling.patch \ | ||
| 19 | " | 20 | " |
| 20 | 21 | ||
| 21 | 22 | ||
