summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0034-Fix-format-truncation-compile-failure-by-typecasting.patch
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2018-07-17 10:05:11 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-18 10:18:42 +0100
commitada8a5d9175b141b4fe532f542f5c1f7ffa26d88 (patch)
tree64af2142c781c13ee7669004b615d41cfb787f92 /meta/recipes-core/systemd/systemd/0034-Fix-format-truncation-compile-failure-by-typecasting.patch
parent219eed186d32b01a7132233c5110c08055ed6e27 (diff)
downloadpoky-ada8a5d9175b141b4fe532f542f5c1f7ffa26d88.tar.gz
systemd: upgrade to 239
Upgrade systemd to 239. 1. Patch Changes * Rebased Patches 0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch 0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch 0006-Make-root-s-home-directory-configurable.patch 0027-remove-nobody-user-group-checking.patch 0011-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch 0013-add-fallback-parse_printf_format-implementation.patch 0014-src-basic-missing.h-check-for-missing-strndupa.patch 0015-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch 0016-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch 0017-Include-netinet-if_ether.h.patch 0019-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch 0022-don-t-use-glibc-specific-qsort_r.patch 0024-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch 0026-Use-uintmax_t-for-handling-rlim_t.patch 0030-fix-missing-of-__register_atfork-for-non-glibc-build.patch 0031-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch 0001-core-device.c-Change-the-default-device-timeout-to-2.patch 0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch * Dropped Patches and Reasons 0001-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch This patch is dropped because the problem has been fixed by binutils upstream. And this workaround could be dropped. https://sourceware.org/bugzilla/show_bug.cgi?id=18548 0007-Revert-rules-remove-firmware-loading-rules.patch 0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch These two patches are dropped because they are for kernel < 3.7. But the current minimal requirement of kernel to build systemd is as below. REQUIREMENTS: Linux kernel >= 3.13 Linux kernel >= 4.2 for unified cgroup hierarchy support So these two patches no long make any sense. Also remove non-exist firmware-path option 0009-remove-duplicate-include-uchar.h.patch 0010-check-for-uchar.h-in-meson.build.patch These two patches are dropped because musl has implemented uchar.h. See commit below from musl repo. """ ab9672ae73248f51e30f4553c4b8878525e46383 implement uchar.h (C11 UTF-16/32 conversion) interfaces """ 0018-check-for-missing-canonicalize_file_name.patch The above patch is dropped because current systemd does not need canonicalize_file_name. 0025-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch The above patch is dropped because utmp makes no sense in musl. Check code below from musl. include/utmp.h:#define _PATH_UTMP "/dev/null/utmp" And utmp PACKAGECONFIG has been explicitly disabled for musl. So we don't need this patch. 0032-memfd.patch 0033-basic-macros-rename-noreturn-into-_noreturn_-8456.patch libmount.patch 0034-Fix-format-truncation-compile-failure-by-typecasting.patch The above patches are dropped because they are backported patches. And current systemd has contained these patches. 0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch The above patch is dropped because it has been merged and is now in new version. * Newly Added Patch 0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch This patch is added to fix build for musl. 0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch This patch is added to fix the following error which caused system unable to boot up. systemd-udevd.service: Failed to adjust OOM setting: Invalid argument dbus.service: Failed to adjust OOM setting: Invalid argument 0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch This patch is added to fix segment fault error on musl systems. 0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch This patch is backported to solve a race condition between user-runtime-dir@xxx.service stop and user deletion. 2. PACKAGECONFIG and Dependency Changes * Add a new PACKAGECONFIG item 'gshadow'. Enable it by default for glibc but disable it by default for musl. This is because musl does not provide gshadow.h. * Add a new PACKAGECONFIG item 'portabled'. Default to disable it because it's still experimental, according to the announcement letter. """ Currently, the support is still experimental, but this is expected to change soon. Reflecting this experimental state, the "portablectl" binary is not installed into /usr/bin yet. """ * Change 'kmod' from a hard dependency to a PACKAGECONFIG item. Default to enable it. * Change 'acl' from a hard dependency to a PACKAGECONFIG item. Default to enable it. * Remove 'readline' from DEPENDS. systemd does not need it. * Remove 'libcgroup' from DEPENDS. The dependency on libcgroup has been removed from systemd a long time ago. We now remove this unnecessary dependency from DEPENDS. 3. update-alternatives changes The utilities like shutdown, poweroff, etc. are now created as symlinks at do_install. So there's no need to use update-alternatives mechanism anymore to create the symlinks now. In addtion, I don't think we now support multiple init systems at one running system, so there's really no need to use update-alternatives mechanism here. Also update the FILES_${PN} to include these files to avoid QA issue. (From OE-Core rev: 597f4645faf61486eb1d2ab73f3d974460ab9466) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0034-Fix-format-truncation-compile-failure-by-typecasting.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0034-Fix-format-truncation-compile-failure-by-typecasting.patch173
1 files changed, 0 insertions, 173 deletions
diff --git a/meta/recipes-core/systemd/systemd/0034-Fix-format-truncation-compile-failure-by-typecasting.patch b/meta/recipes-core/systemd/systemd/0034-Fix-format-truncation-compile-failure-by-typecasting.patch
deleted file mode 100644
index e56061f41b..0000000000
--- a/meta/recipes-core/systemd/systemd/0034-Fix-format-truncation-compile-failure-by-typecasting.patch
+++ /dev/null
@@ -1,173 +0,0 @@
1From c2b3ebe112ebfd9f9e82fb1531ee225c3152ca83 Mon Sep 17 00:00:00 2001
2From: Patrick Uiterwijk <patrick@puiterwijk.org>
3Date: Thu, 22 Feb 2018 19:41:30 +0100
4Subject: [PATCH] Fix format-truncation compile failure by typecasting USB IDs
5 (#8250)
6
7This patch adds safe_atoux16 for parsing an unsigned hexadecimal 16bit int, and
8uses that for parsing USB device and vendor IDs.
9
10This fixes a compile error with gcc-8 because while we know that USB IDs are 2 bytes,
11the compiler does not know that.
12
13../src/udev/udev-builtin-hwdb.c:80:38: error: '%04X' directive output may be
14truncated writing between 4 and 8 bytes into a region of size between 2 and 6
15[-Werror=format-truncation=]
16
17Upstream-Status: Backport [https://github.com/systemd/systemd/commit/5547c12503a683290eaed47954ffcfb2d1bc03cd]
18
19Signed-off-by: Adam Williamson <awilliam@redhat.com>
20Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
21---
22 src/basic/parse-util.c | 24 ++++++++++++++++++++++
23 src/basic/parse-util.h | 2 ++
24 src/test/test-parse-util.c | 39 ++++++++++++++++++++++++++++++++++++
25 src/udev/udev-builtin-hwdb.c | 13 ++++++------
26 4 files changed, 71 insertions(+), 7 deletions(-)
27
28diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
29index 97533721d..ff3fc298a 100644
30--- a/src/basic/parse-util.c
31+++ b/src/basic/parse-util.c
32@@ -532,6 +532,30 @@ int safe_atoi16(const char *s, int16_t *ret) {
33 return 0;
34 }
35
36+int safe_atoux16(const char *s, uint16_t *ret) {
37+ char *x = NULL;
38+ unsigned long l;
39+
40+ assert(s);
41+ assert(ret);
42+
43+ s += strspn(s, WHITESPACE);
44+
45+ errno = 0;
46+ l = strtoul(s, &x, 16);
47+ if (errno > 0)
48+ return -errno;
49+ if (!x || x == s || *x != 0)
50+ return -EINVAL;
51+ if (s[0] == '-')
52+ return -ERANGE;
53+ if ((unsigned long) (uint16_t) l != l)
54+ return -ERANGE;
55+
56+ *ret = (uint16_t) l;
57+ return 0;
58+}
59+
60 int safe_atod(const char *s, double *ret_d) {
61 _cleanup_(freelocalep) locale_t loc = (locale_t) 0;
62 char *x = NULL;
63diff --git a/src/basic/parse-util.h b/src/basic/parse-util.h
64index 1eda1d7f9..727422056 100644
65--- a/src/basic/parse-util.h
66+++ b/src/basic/parse-util.h
67@@ -54,6 +54,8 @@ int safe_atou8(const char *s, uint8_t *ret);
68 int safe_atou16(const char *s, uint16_t *ret);
69 int safe_atoi16(const char *s, int16_t *ret);
70
71+int safe_atoux16(const char *s, uint16_t *ret);
72+
73 static inline int safe_atou32(const char *s, uint32_t *ret_u) {
74 assert_cc(sizeof(uint32_t) == sizeof(unsigned));
75 return safe_atou(s, (unsigned*) ret_u);
76diff --git a/src/test/test-parse-util.c b/src/test/test-parse-util.c
77index 937500213..a99cea5a1 100644
78--- a/src/test/test-parse-util.c
79+++ b/src/test/test-parse-util.c
80@@ -468,6 +468,44 @@ static void test_safe_atoi16(void) {
81 assert_se(r == -EINVAL);
82 }
83
84+static void test_safe_atoux16(void) {
85+ int r;
86+ uint16_t l;
87+
88+ r = safe_atoux16("1234", &l);
89+ assert_se(r == 0);
90+ assert_se(l == 0x1234);
91+
92+ r = safe_atoux16("abcd", &l);
93+ assert_se(r == 0);
94+ assert_se(l == 0xabcd);
95+
96+ r = safe_atoux16(" 1234", &l);
97+ assert_se(r == 0);
98+ assert_se(l == 0x1234);
99+
100+ r = safe_atoux16("12345", &l);
101+ assert_se(r == -ERANGE);
102+
103+ r = safe_atoux16("-1", &l);
104+ assert_se(r == -ERANGE);
105+
106+ r = safe_atoux16(" -1", &l);
107+ assert_se(r == -ERANGE);
108+
109+ r = safe_atoux16("junk", &l);
110+ assert_se(r == -EINVAL);
111+
112+ r = safe_atoux16("123x", &l);
113+ assert_se(r == -EINVAL);
114+
115+ r = safe_atoux16("12.3", &l);
116+ assert_se(r == -EINVAL);
117+
118+ r = safe_atoux16("", &l);
119+ assert_se(r == -EINVAL);
120+}
121+
122 static void test_safe_atou64(void) {
123 int r;
124 uint64_t l;
125@@ -745,6 +783,7 @@ int main(int argc, char *argv[]) {
126 test_safe_atolli();
127 test_safe_atou16();
128 test_safe_atoi16();
129+ test_safe_atoux16();
130 test_safe_atou64();
131 test_safe_atoi64();
132 test_safe_atod();
133diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
134index ca7f7c230..dbfe02429 100644
135--- a/src/udev/udev-builtin-hwdb.c
136+++ b/src/udev/udev-builtin-hwdb.c
137@@ -27,6 +27,7 @@
138
139 #include "alloc-util.h"
140 #include "hwdb-util.h"
141+#include "parse-util.h"
142 #include "string-util.h"
143 #include "udev-util.h"
144 #include "udev.h"
145@@ -63,7 +64,7 @@ int udev_builtin_hwdb_lookup(struct udev_device *dev,
146
147 static const char *modalias_usb(struct udev_device *dev, char *s, size_t size) {
148 const char *v, *p;
149- int vn, pn;
150+ uint16_t vn, pn;
151
152 v = udev_device_get_sysattr_value(dev, "idVendor");
153 if (!v)
154@@ -71,12 +72,10 @@ static const char *modalias_usb(struct udev_device *dev, char *s, size_t size) {
155 p = udev_device_get_sysattr_value(dev, "idProduct");
156 if (!p)
157 return NULL;
158- vn = strtol(v, NULL, 16);
159- if (vn <= 0)
160- return NULL;
161- pn = strtol(p, NULL, 16);
162- if (pn <= 0)
163- return NULL;
164+ if (safe_atoux16(v, &vn) < 0)
165+ return NULL;
166+ if (safe_atoux16(p, &pn) < 0)
167+ return NULL;
168 snprintf(s, size, "usb:v%04Xp%04X*", vn, pn);
169 return s;
170 }
171--
1722.17.0
173