summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2020-12-17 02:09:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-04 11:45:47 +0000
commit8c0bbcc2a53c90b93aa55738de36a0e91143ba35 (patch)
tree3edf1b1e7054805555e2aa50497eb379bfc83cef /meta/recipes-core
parente7e96971dcc40c82cf251ee749d587e6139b2ac1 (diff)
downloadpoky-8c0bbcc2a53c90b93aa55738de36a0e91143ba35.tar.gz
glibc: Make adjtime() for 32 bit support being called with delta == NULL
This backports a fix from glibc's master branch, which solves a regression in 2.32 with adjtime() where it would seg fault if being called with delta == NULL on 32 bit machines. (From OE-Core rev: 2f8da84311bb0a3b6eb93e4d5fe55914a84e68d7) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit aeecccf17c45c840c070e2de95c602a3c7e9d30e) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch110
-rw-r--r--meta/recipes-core/glibc/glibc_2.32.bb1
2 files changed, 111 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch b/meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch
new file mode 100644
index 0000000000..a458a2a223
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch
@@ -0,0 +1,110 @@
1From 75a193b7611bade31a150dfcc528b973e3d46231 Mon Sep 17 00:00:00 2001
2From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3Date: Mon, 2 Nov 2020 16:18:29 -0300
4Subject: [PATCH] linux: Allow adjtime with NULL argument [BZ #26833]
5
6The adjtime interface allows return the amount of time remaining
7from any previous adjustment that has not yet been completed by
8passing a NULL as first argument. This was introduced with y2038
9support 0308077e3a.
10
11Checked on i686-linux-gnu.
12
13Reviewed-by: Lukasz Majewski <lukma@denx.de>
14Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=75a193b7611bade31a150dfcc528b973e3d46231]
15Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
16---
17 sysdeps/unix/sysv/linux/adjtime.c | 11 +++++---
18 time/Makefile | 3 ++-
19 time/tst-adjtime.c | 44 +++++++++++++++++++++++++++++++
20 3 files changed, 54 insertions(+), 4 deletions(-)
21 create mode 100644 time/tst-adjtime.c
22
23diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c
24index 3f9a4ea2eb..6d1d1b6af2 100644
25--- a/sysdeps/unix/sysv/linux/adjtime.c
26+++ b/sysdeps/unix/sysv/linux/adjtime.c
27@@ -68,11 +68,16 @@ libc_hidden_def (__adjtime64)
28 int
29 __adjtime (const struct timeval *itv, struct timeval *otv)
30 {
31- struct __timeval64 itv64, otv64;
32+ struct __timeval64 itv64, *pitv64 = NULL;
33+ struct __timeval64 otv64;
34 int retval;
35
36- itv64 = valid_timeval_to_timeval64 (*itv);
37- retval = __adjtime64 (&itv64, otv != NULL ? &otv64 : NULL);
38+ if (itv != NULL)
39+ {
40+ itv64 = valid_timeval_to_timeval64 (*itv);
41+ pitv64 = &itv64;
42+ }
43+ retval = __adjtime64 (pitv64, otv != NULL ? &otv64 : NULL);
44 if (otv != NULL)
45 *otv = valid_timeval64_to_timeval (otv64);
46
47diff --git a/time/Makefile b/time/Makefile
48index 26aa835166..f27a75a115 100644
49--- a/time/Makefile
50+++ b/time/Makefile
51@@ -47,7 +47,8 @@ tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
52 tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
53 tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \
54 tst-tzname tst-y2039 bug-mktime4 tst-strftime2 tst-strftime3 \
55- tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1
56+ tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1 \
57+ tst-adjtime
58
59 include ../Rules
60
61diff --git a/time/tst-adjtime.c b/time/tst-adjtime.c
62new file mode 100644
63index 0000000000..ae2b37cdab
64--- /dev/null
65+++ b/time/tst-adjtime.c
66@@ -0,0 +1,44 @@
67+/* Basic tests for adjtime.
68+ Copyright (C) 2020 Free Software Foundation, Inc.
69+ This file is part of the GNU C Library.
70+
71+ The GNU C Library is free software; you can redistribute it and/or
72+ modify it under the terms of the GNU Lesser General Public
73+ License as published by the Free Software Foundation; either
74+ version 2.1 of the License, or (at your option) any later version.
75+
76+ The GNU C Library is distributed in the hope that it will be useful,
77+ but WITHOUT ANY WARRANTY; without even the implied warranty of
78+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
79+ Lesser General Public License for more details.
80+
81+ You should have received a copy of the GNU Lesser General Public
82+ License along with the GNU C Library; if not, see
83+ <https://www.gnu.org/licenses/>. */
84+
85+#include <sys/time.h>
86+#include <stdlib.h>
87+
88+#include <errno.h>
89+#include <support/check.h>
90+
91+
92+static int
93+do_test (void)
94+{
95+ /* Check if the interface allows getting the amount of time remaining
96+ from any previous adjustment that has not yet been completed. This
97+ is a non-privileged function of adjtime. */
98+ struct timeval tv;
99+ int r = adjtime (NULL, &tv);
100+ if (r == -1)
101+ {
102+ if (errno == ENOSYS)
103+ FAIL_UNSUPPORTED ("adjtime unsupported");
104+ FAIL_EXIT1 ("adjtime (NULL, ...) failed: %m");
105+ }
106+
107+ return 0;
108+}
109+
110+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc_2.32.bb b/meta/recipes-core/glibc/glibc_2.32.bb
index 6d42f33822..b850c28c78 100644
--- a/meta/recipes-core/glibc/glibc_2.32.bb
+++ b/meta/recipes-core/glibc/glibc_2.32.bb
@@ -43,6 +43,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
43 file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ 43 file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
44 file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \ 44 file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
45 file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \ 45 file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
46 file://0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch \
46 file://CVE-2020-29562.patch \ 47 file://CVE-2020-29562.patch \
47 file://CVE-2020-29573.patch \ 48 file://CVE-2020-29573.patch \
48 " 49 "