diff options
| -rw-r--r-- | meta/recipes-core/busybox/busybox/0001-hwclock-Check-for-SYS_settimeofday-before-calling-sy.patch | 52 | ||||
| -rw-r--r-- | meta/recipes-core/busybox/busybox_1.37.0.bb | 1 |
2 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/0001-hwclock-Check-for-SYS_settimeofday-before-calling-sy.patch b/meta/recipes-core/busybox/busybox/0001-hwclock-Check-for-SYS_settimeofday-before-calling-sy.patch new file mode 100644 index 0000000000..11ef2b6824 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/0001-hwclock-Check-for-SYS_settimeofday-before-calling-sy.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From 4e1eafc6e0de3e58cac9f62e57b552eddb50ca8e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sun, 7 Mar 2021 17:30:24 -0800 | ||
| 4 | Subject: [PATCH] hwclock: Check for SYS_settimeofday before calling syscall | ||
| 5 | |||
| 6 | Some newer architectures e.g. RISCV32 have 64bit time_t from get go and | ||
| 7 | thusly do not have gettimeofday_time64/settimeofday_time64 implemented | ||
| 8 | therefore check for SYS_settimeofday definition before making the | ||
| 9 | syscall. Fixes build for riscv32 and it will bail out at runtime. | ||
| 10 | |||
| 11 | This issue has been discussed on the musl mailing list, and | ||
| 12 | the musl developers' opinion is that Busybox is wrong: | ||
| 13 | |||
| 14 | https://www.openwall.com/lists/musl/2024/03/03/2 | ||
| 15 | https://www.openwall.com/lists/musl/2024/04/07/2 | ||
| 16 | |||
| 17 | The correct fix isn't clear, and in the mean time, the patch | ||
| 18 | turns the build issue into a runtime error only on the problematic | ||
| 19 | architecture (riscv32), which seems like a reasonable trade-off | ||
| 20 | |||
| 21 | Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-March/088583.html]] | ||
| 22 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 23 | --- | ||
| 24 | util-linux/hwclock.c | 7 +++++-- | ||
| 25 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c | ||
| 28 | index c3fd0eb57..dea9c9a55 100644 | ||
| 29 | --- a/util-linux/hwclock.c | ||
| 30 | +++ b/util-linux/hwclock.c | ||
| 31 | @@ -132,6 +132,7 @@ static void show_clock(const char **pp_rtcname, int utc) | ||
| 32 | |||
| 33 | static void set_kernel_tz(const struct timezone *tz) | ||
| 34 | { | ||
| 35 | + int ret = 1; | ||
| 36 | #if LIBC_IS_MUSL | ||
| 37 | /* musl libc does not pass tz argument to syscall | ||
| 38 | * because "it's deprecated by POSIX, therefore it's fine | ||
| 39 | @@ -140,9 +141,11 @@ static void set_kernel_tz(const struct timezone *tz) | ||
| 40 | #if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32) | ||
| 41 | # define SYS_settimeofday SYS_settimeofday_time32 | ||
| 42 | #endif | ||
| 43 | - int ret = syscall(SYS_settimeofday, NULL, tz); | ||
| 44 | +#if defined(SYS_settimeofday) | ||
| 45 | + ret = syscall(SYS_settimeofday, NULL, tz); | ||
| 46 | +#endif | ||
| 47 | #else | ||
| 48 | - int ret = settimeofday(NULL, tz); | ||
| 49 | + ret = settimeofday(NULL, tz); | ||
| 50 | #endif | ||
| 51 | if (ret) | ||
| 52 | bb_simple_perror_msg_and_die("settimeofday"); | ||
diff --git a/meta/recipes-core/busybox/busybox_1.37.0.bb b/meta/recipes-core/busybox/busybox_1.37.0.bb index 85f22ada53..9f7ded3354 100644 --- a/meta/recipes-core/busybox/busybox_1.37.0.bb +++ b/meta/recipes-core/busybox/busybox_1.37.0.bb | |||
| @@ -54,6 +54,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ | |||
| 54 | file://0002-start-stop-daemon-fix-tests.patch \ | 54 | file://0002-start-stop-daemon-fix-tests.patch \ |
| 55 | file://0003-start-stop-false.patch \ | 55 | file://0003-start-stop-false.patch \ |
| 56 | file://0001-archival-disallow-path-traversals-CVE-2023-39810.patch \ | 56 | file://0001-archival-disallow-path-traversals-CVE-2023-39810.patch \ |
| 57 | file://0001-hwclock-Check-for-SYS_settimeofday-before-calling-sy.patch \ | ||
| 57 | " | 58 | " |
| 58 | SRC_URI:append:libc-musl = " file://musl.cfg" | 59 | SRC_URI:append:libc-musl = " file://musl.cfg" |
| 59 | SRC_URI:append:x86-64 = " file://sha_accel.cfg" | 60 | SRC_URI:append:x86-64 = " file://sha_accel.cfg" |
