summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakib Sajal <sakib.sajal@windriver.com>2020-07-21 16:39:12 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-31 22:02:52 +0100
commit6e1263c5f95a6c990f7640387adb634c5a7bcfd6 (patch)
treee65e010354c22e5d67a992b228731552eb63a067
parent977a4f10ff99bf43a34b2fe9474b08be56f3e1b0 (diff)
downloadpoky-6e1263c5f95a6c990f7640387adb634c5a7bcfd6.tar.gz
busybox: make hwclock compatible with glibc 2.31
settimeofday(2) has been deprecated as of glibc 2.31 which hwclock makes use of. This patch makes hwclock compatible with glibc v2.31 See patch for more details: busybox/0001-hwclock-make-glibc-2.31-compatible.patch Fixes [YOCTO #13981] (From OE-Core rev: 92d8bba5405244ae2594abc1a012c08c74999ab4) Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/busybox/busybox/0001-hwclock-make-glibc-2.31-compatible.patch83
-rw-r--r--meta/recipes-core/busybox/busybox_1.31.1.bb1
2 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/0001-hwclock-make-glibc-2.31-compatible.patch b/meta/recipes-core/busybox/busybox/0001-hwclock-make-glibc-2.31-compatible.patch
new file mode 100644
index 0000000000..0a141cebd5
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-hwclock-make-glibc-2.31-compatible.patch
@@ -0,0 +1,83 @@
1From 19a6baf0b79346deb383bbd2b5b825d59add7d5d Mon Sep 17 00:00:00 2001
2From: Sakib Sajal <sakib.sajal@windriver.com>
3Date: Fri, 17 Jul 2020 17:27:21 +0000
4Subject: [PATCH] hwclock: make glibc 2.31 compatible
5
6NEWS for glibc version 2.31
7===========================
8
9Deprecated and removed features, and other changes affecting compatibility:
10
11* The settimeofday function can still be used to set a system-wide
12 time zone when the operating system supports it. This is because
13 the Linux kernel reused the API, on some architectures, to describe
14 a system-wide time-zone-like offset between the software clock
15 maintained by the kernel, and the "RTC" clock that keeps time when
16 the system is shut down.
17
18 However, to reduce the odds of this offset being set by accident,
19 settimeofday can no longer be used to set the time and the offset
20 simultaneously. If both of its two arguments are non-null, the call
21 will fail (setting errno to EINVAL).
22
23 Callers attempting to set this offset should also be prepared for
24 the call to fail and set errno to ENOSYS; this already happens on
25 the Hurd and on some Linux architectures. The Linux kernel
26 maintainers are discussing a more principled replacement for the
27 reused API. After a replacement becomes available, we will change
28 settimeofday to fail with ENOSYS on all platforms when its 'tzp'
29 argument is not a null pointer.
30
31 settimeofday itself is obsolescent according to POSIX. Programs
32 that set the system time should use clock_settime and/or the adjtime
33 family of functions instead. We may cease to make settimeofday
34 available to newly linked binaries after there is a replacement for
35 Linux's time-zone-like offset API.
36
37hwclock had two calls to settimeofday, in functions to_sys_clock and
38set_system_clock_timezone, where both the arguments to settimeofday
39were valid (non-null).
40Therefore, split the call, once for timezone and once for timeval.
41
42Fixes #12756
43
44Upstream-Status: Pending
45
46Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
47---
48 util-linux/hwclock.c | 12 ++++++++----
49 1 file changed, 8 insertions(+), 4 deletions(-)
50
51diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
52index 29f5102..088ab3b 100644
53--- a/util-linux/hwclock.c
54+++ b/util-linux/hwclock.c
55@@ -131,8 +131,10 @@ static void to_sys_clock(const char **pp_rtcname, int utc)
56
57 tv.tv_sec = read_rtc(pp_rtcname, NULL, utc);
58 tv.tv_usec = 0;
59- if (settimeofday(&tv, &tz))
60- bb_perror_msg_and_die("settimeofday");
61+ if (settimeofday(NULL, &tz))
62+ bb_perror_msg_and_die("settimeofday: timezone");
63+ if (settimeofday(&tv, NULL))
64+ bb_perror_msg_and_die("settimeofday: timeval");
65 }
66
67 static void from_sys_clock(const char **pp_rtcname, int utc)
68@@ -283,8 +285,10 @@ static void set_system_clock_timezone(int utc)
69 gettimeofday(&tv, NULL);
70 if (!utc)
71 tv.tv_sec += tz.tz_minuteswest * 60;
72- if (settimeofday(&tv, &tz))
73- bb_perror_msg_and_die("settimeofday");
74+ if (settimeofday(NULL, &tz))
75+ bb_perror_msg_and_die("settimeofday: timezone");
76+ if (settimeofday(&tv, NULL))
77+ bb_perror_msg_and_die("settimeofday: timeval");
78 }
79
80 //usage:#define hwclock_trivial_usage
81--
822.27.0
83
diff --git a/meta/recipes-core/busybox/busybox_1.31.1.bb b/meta/recipes-core/busybox/busybox_1.31.1.bb
index a6b47027af..7563368287 100644
--- a/meta/recipes-core/busybox/busybox_1.31.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.31.1.bb
@@ -49,6 +49,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
49 file://0001-Remove-stime-function-calls.patch \ 49 file://0001-Remove-stime-function-calls.patch \
50 file://0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch \ 50 file://0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch \
51 file://busybox-CVE-2018-1000500.patch \ 51 file://busybox-CVE-2018-1000500.patch \
52 file://0001-hwclock-make-glibc-2.31-compatible.patch \
52" 53"
53SRC_URI_append_libc-musl = " file://musl.cfg " 54SRC_URI_append_libc-musl = " file://musl.cfg "
54 55