summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2023-08-03 00:16:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-04 11:44:28 +0100
commit93e8644287b472e138b6cb5ec3d52ae2f201ed80 (patch)
tree12056c32257b1be6e1340b6e0ab964581b0d58c2
parent1666605fe5baef005ae199221cb11d1aebc91461 (diff)
downloadpoky-93e8644287b472e138b6cb5ec3d52ae2f201ed80.tar.gz
systemd: update to v254
- Drop dependency on gnu-efi, add dependency on pyelftools for EFI builds - Refresh patches - Ship new files and directories - Use meson target to build sd-boot instead of filenames - Change libpam recipe to set ANY_OF_DISTRO_FEATURES = "pam systemd" to let logind pull in pam-plugin-umask (From OE-Core rev: 95ed1fa4ff74a77deade51ad73b2f8963ff81548) Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/systemd/systemd-boot_254.bb (renamed from meta/recipes-core/systemd/systemd-boot_253.7.bb)21
-rw-r--r--meta/recipes-core/systemd/systemd.inc5
-rw-r--r--meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0003-errno-util-Make-STRERROR-portable-for-musl.patch7
-rw-r--r--meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0010-add-fallback-parse_printf_format-implementation.patch6
-rw-r--r--meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-strndupa.patch69
-rw-r--r--meta/recipes-core/systemd/systemd/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch4
-rw-r--r--meta/recipes-core/systemd/systemd/0014-Use-uintmax_t-for-handling-rlim_t.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0015-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch41
-rw-r--r--meta/recipes-core/systemd/systemd/0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch12
-rw-r--r--meta/recipes-core/systemd/systemd/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0021-do-not-disable-buffer-in-writing-files.patch142
-rw-r--r--meta/recipes-core/systemd/systemd/0022-Handle-__cpu_mask-usage.patch4
-rw-r--r--meta/recipes-core/systemd/systemd/0023-Handle-missing-gshadow.patch28
-rw-r--r--meta/recipes-core/systemd/systemd/0024-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0025-include-sys-file.h-for-LOCK_EX.patch29
-rw-r--r--meta/recipes-core/systemd/systemd/0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch44
-rw-r--r--meta/recipes-core/systemd/systemd/0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch28
-rw-r--r--meta/recipes-core/systemd/systemd/0027-include-missing-sys-file.h-for-LOCK_EX.patch98
-rw-r--r--meta/recipes-core/systemd/systemd/27253.patch313
-rw-r--r--meta/recipes-core/systemd/systemd/27254.patch345
-rw-r--r--meta/recipes-core/systemd/systemd_254.bb (renamed from meta/recipes-core/systemd/systemd_253.7.bb)17
-rw-r--r--meta/recipes-extended/pam/libpam_1.5.3.bb2
25 files changed, 335 insertions, 932 deletions
diff --git a/meta/recipes-core/systemd/systemd-boot_253.7.bb b/meta/recipes-core/systemd/systemd-boot_254.bb
index b67706b731..e887e636e8 100644
--- a/meta/recipes-core/systemd/systemd-boot_253.7.bb
+++ b/meta/recipes-core/systemd/systemd-boot_254.bb
@@ -3,29 +3,27 @@ FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3 3
4require conf/image-uefi.conf 4require conf/image-uefi.conf
5 5
6DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native python3-jinja2-native" 6DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native"
7 7
8inherit meson pkgconfig gettext 8inherit meson pkgconfig gettext
9inherit deploy 9inherit deploy
10 10
11LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " 11LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12 12
13do_write_config[vardeps] += "CC OBJCOPY" 13EFI_LD = "bfd"
14
15do_write_config[vardeps] += "CC OBJCOPY EFI_LD"
14do_write_config:append() { 16do_write_config:append() {
15 cat >${WORKDIR}/meson-${PN}.cross <<EOF 17 cat >${WORKDIR}/meson-${PN}.cross <<EOF
16[binaries] 18[binaries]
17efi_cc = ${@meson_array('CC', d)} 19c = ${@meson_array('CC', d)}
18objcopy = ${@meson_array('OBJCOPY', d)} 20objcopy = ${@meson_array('OBJCOPY', d)}
21c_ld = ${@meson_array('EFI_LD', d)}
19EOF 22EOF
20} 23}
21 24
22EFI_LD = "bfd"
23
24EXTRA_OEMESON += "-Defi=true \ 25EXTRA_OEMESON += "-Defi=true \
25 -Dgnu-efi=true \ 26 -Dbootloader=true \
26 -Defi-includedir=${STAGING_INCDIR}/efi \
27 -Defi-libdir=${STAGING_LIBDIR} \
28 -Defi-ld=${EFI_LD} \
29 -Dman=false \ 27 -Dman=false \
30 --cross-file ${WORKDIR}/meson-${PN}.cross \ 28 --cross-file ${WORKDIR}/meson-${PN}.cross \
31 " 29 "
@@ -54,9 +52,7 @@ COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
54COMPATIBLE_HOST:x86-x32 = "null" 52COMPATIBLE_HOST:x86-x32 = "null"
55 53
56do_compile() { 54do_compile() {
57 ninja \ 55 ninja systemd-boot
58 src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \
59 src/boot/efi/linux${EFI_ARCH}.efi.stub
60} 56}
61 57
62do_install() { 58do_install() {
@@ -67,6 +63,7 @@ do_install() {
67do_deploy () { 63do_deploy () {
68 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} 64 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
69 install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR} 65 install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
66 install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR}
70} 67}
71 68
72addtask deploy before do_build after do_compile 69addtask deploy before do_build after do_compile
diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc
index c2f2899044..b00a49884b 100644
--- a/meta/recipes-core/systemd/systemd.inc
+++ b/meta/recipes-core/systemd/systemd.inc
@@ -14,10 +14,9 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
14LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ 14LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
15 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" 15 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
16 16
17SRCREV = "f1c4da0414640cf201147144f558e1af31a3ae80" 17SRCREV = "994c7978608a0bd9b317f4f74ff266dd50a3e74e"
18SRCBRANCH = "v253-stable" 18SRCBRANCH = "v254-stable"
19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \ 19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \
20 file://0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch \
21 " 20 "
22 21
23S = "${WORKDIR}/git" 22S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch
index 43611e65fb..085f1e9052 100644
--- a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch
@@ -19,40 +19,36 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
19[rebased for systemd 243] 19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com> 20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21--- 21---
22 units/meson.build | 6 ++---- 22 units/meson.build | 2 --
23 units/proc-sys-fs-binfmt_misc.automount | 3 +++ 23 units/proc-sys-fs-binfmt_misc.automount | 3 +++
24 units/systemd-binfmt.service.in | 4 ++++ 24 units/systemd-binfmt.service.in | 4 ++++
25 3 files changed, 9 insertions(+), 4 deletions(-) 25 3 files changed, 7 insertions(+), 2 deletions(-)
26 26
27diff --git a/units/meson.build b/units/meson.build 27diff --git a/units/meson.build b/units/meson.build
28index c7939a10f8..219570ab19 100644 28index c7939a10f8..219570ab19 100644
29--- a/units/meson.build 29--- a/units/meson.build
30+++ b/units/meson.build 30+++ b/units/meson.build
31@@ -62,8 +62,7 @@ units = [ 31@@ -149,7 +149,6 @@ units = [
32 ['poweroff.target', '', 32 {
33 (with_runlevels ? 'runlevel0.target' : '')], 33 'file' : 'proc-sys-fs-binfmt_misc.automount',
34 ['printer.target', ''], 34 'conditions' : ['ENABLE_BINFMT'],
35- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', 35- 'symlinks' : ['sysinit.target.wants/'],
36- 'sysinit.target.wants/'], 36 },
37+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], 37 {
38 ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], 38 'file' : 'proc-sys-fs-binfmt_misc.mount',
39 ['reboot.target', '', 39@@ -246,7 +245,6 @@ units = [
40 'ctrl-alt-del.target' + (with_runlevels ? ' runlevel6.target' : '')], 40 {
41@@ -185,8 +184,7 @@ in_units = [ 41 'file' : 'systemd-binfmt.service.in',
42 ['rescue.service', ''], 42 'conditions' : ['ENABLE_BINFMT'],
43 ['serial-getty@.service', ''], 43- 'symlinks' : ['sysinit.target.wants/'],
44 ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], 44 },
45- ['systemd-binfmt.service', 'ENABLE_BINFMT', 45 {
46- 'sysinit.target.wants/'], 46 'file' : 'systemd-bless-boot.service.in',
47+ ['systemd-binfmt.service', 'ENABLE_BINFMT'],
48 ['systemd-bless-boot.service', 'HAVE_GNU_EFI HAVE_BLKID'],
49 ['systemd-boot-check-no-failures.service', ''],
50 ['systemd-coredump@.service', 'ENABLE_COREDUMP'],
51diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount 47diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
52index 6b1bbdc91e..5ec5b8670a 100644 48index 6b1bbdc91e..5ec5b8670a 100644
53--- a/units/proc-sys-fs-binfmt_misc.automount 49--- a/units/proc-sys-fs-binfmt_misc.automount
54+++ b/units/proc-sys-fs-binfmt_misc.automount 50+++ b/units/proc-sys-fs-binfmt_misc.automount
55@@ -19,3 +19,6 @@ ConditionPathIsReadWrite=/proc/sys/ 51@@ -22,3 +22,6 @@ Before=shutdown.target
56 52
57 [Automount] 53 [Automount]
58 Where=/proc/sys/fs/binfmt_misc 54 Where=/proc/sys/fs/binfmt_misc
diff --git a/meta/recipes-core/systemd/systemd/0003-errno-util-Make-STRERROR-portable-for-musl.patch b/meta/recipes-core/systemd/systemd/0003-errno-util-Make-STRERROR-portable-for-musl.patch
index e9e69cb648..fcc56a2e65 100644
--- a/meta/recipes-core/systemd/systemd/0003-errno-util-Make-STRERROR-portable-for-musl.patch
+++ b/meta/recipes-core/systemd/systemd/0003-errno-util-Make-STRERROR-portable-for-musl.patch
@@ -11,8 +11,8 @@ Upstream-Status: Inappropriate [musl specific]
11 11
12Signed-off-by: Khem Raj <raj.khem@gmail.com> 12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13--- 13---
14 src/basic/errno-util.h | 12 ++++++++++-- 14 src/basic/errno-util.h | 10 +++++++++-
15 1 file changed, 10 insertions(+), 2 deletions(-) 15 1 file changed, 9 insertions(+), 1 deletion(-)
16 16
17diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h 17diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h
18index 091f99c590..eb5c1f9961 100644 18index 091f99c590..eb5c1f9961 100644
@@ -23,9 +23,8 @@ index 091f99c590..eb5c1f9961 100644
23 * 23 *
24 * Note that we use the GNU variant of strerror_r() here. */ 24 * Note that we use the GNU variant of strerror_r() here. */
25-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN) 25-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN)
26-
27+static inline const char * STRERROR(int errnum); 26+static inline const char * STRERROR(int errnum);
28+ 27
29+static inline const char * STRERROR(int errnum) { 28+static inline const char * STRERROR(int errnum) {
30+#ifdef __GLIBC__ 29+#ifdef __GLIBC__
31+ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN); 30+ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN);
diff --git a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch
index aa1f3c2e82..98914ae154 100644
--- a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch
+++ b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch
@@ -44,7 +44,7 @@ diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
44index 1af3a36d1d..def502b717 100644 44index 1af3a36d1d..def502b717 100644
45--- a/src/libsystemd/sd-path/sd-path.c 45--- a/src/libsystemd/sd-path/sd-path.c
46+++ b/src/libsystemd/sd-path/sd-path.c 46+++ b/src/libsystemd/sd-path/sd-path.c
47@@ -362,19 +362,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) { 47@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
48 return 0; 48 return 0;
49 49
50 case SD_PATH_SYSUSERS: 50 case SD_PATH_SYSUSERS:
diff --git a/meta/recipes-core/systemd/systemd/0010-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0010-add-fallback-parse_printf_format-implementation.patch
index 2090d81dc3..4143ab4d70 100644
--- a/meta/recipes-core/systemd/systemd/0010-add-fallback-parse_printf_format-implementation.patch
+++ b/meta/recipes-core/systemd/systemd/0010-add-fallback-parse_printf_format-implementation.patch
@@ -23,7 +23,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
23 23
24--- a/meson.build 24--- a/meson.build
25+++ b/meson.build 25+++ b/meson.build
26@@ -755,6 +755,7 @@ endif 26@@ -781,6 +781,7 @@ endif
27 foreach header : ['crypt.h', 27 foreach header : ['crypt.h',
28 'linux/memfd.h', 28 'linux/memfd.h',
29 'linux/vm_sockets.h', 29 'linux/vm_sockets.h',
@@ -33,7 +33,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
33 'valgrind/memcheck.h', 33 'valgrind/memcheck.h',
34--- a/src/basic/meson.build 34--- a/src/basic/meson.build
35+++ b/src/basic/meson.build 35+++ b/src/basic/meson.build
36@@ -173,6 +173,11 @@ endforeach 36@@ -179,6 +179,11 @@ endforeach
37 37
38 basic_sources += generated_gperf_headers 38 basic_sources += generated_gperf_headers
39 39
@@ -407,7 +407,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
407 #include <stddef.h> 407 #include <stddef.h>
408 #include <sys/un.h> 408 #include <sys/un.h>
409 #include <unistd.h> 409 #include <unistd.h>
410@@ -25,6 +24,7 @@ 410@@ -27,6 +26,7 @@
411 #include "stdio-util.h" 411 #include "stdio-util.h"
412 #include "string-util.h" 412 #include "string-util.h"
413 #include "tmpfile-util.h" 413 #include "tmpfile-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-strndupa.patch
index bd5f6a6190..ec451cddb7 100644
--- a/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-strndupa.patch
+++ b/meta/recipes-core/systemd/systemd/0011-src-basic-missing.h-check-for-missing-strndupa.patch
@@ -17,6 +17,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
17[rebased for systemd 244] 17[rebased for systemd 244]
18[Rebased for v247] 18[Rebased for v247]
19Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> 19Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
20[Rebased for v254]
20--- 21---
21 meson.build | 1 + 22 meson.build | 1 +
22 src/backlight/backlight.c | 1 + 23 src/backlight/backlight.c | 1 +
@@ -74,7 +75,7 @@ diff --git a/meson.build b/meson.build
74index fb96143c37..739b2f7f72 100644 75index fb96143c37..739b2f7f72 100644
75--- a/meson.build 76--- a/meson.build
76+++ b/meson.build 77+++ b/meson.build
77@@ -574,6 +574,7 @@ foreach ident : ['secure_getenv', '__secure_getenv'] 78@@ -595,6 +595,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
78 endforeach 79 endforeach
79 80
80 foreach ident : [ 81 foreach ident : [
@@ -98,7 +99,7 @@ diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
98index feda596939..11b4375ed5 100644 99index feda596939..11b4375ed5 100644
99--- a/src/basic/cgroup-util.c 100--- a/src/basic/cgroup-util.c
100+++ b/src/basic/cgroup-util.c 101+++ b/src/basic/cgroup-util.c
101@@ -37,6 +37,7 @@ 102@@ -38,6 +38,7 @@
102 #include "unit-name.h" 103 #include "unit-name.h"
103 #include "user-util.h" 104 #include "user-util.h"
104 #include "xattr-util.h" 105 #include "xattr-util.h"
@@ -122,14 +123,14 @@ diff --git a/src/basic/log.c b/src/basic/log.c
122index fc5793139e..515218fca8 100644 123index fc5793139e..515218fca8 100644
123--- a/src/basic/log.c 124--- a/src/basic/log.c
124+++ b/src/basic/log.c 125+++ b/src/basic/log.c
125@@ -39,6 +39,7 @@ 126@@ -40,6 +40,7 @@
126 #include "terminal-util.h" 127 #include "terminal-util.h"
127 #include "time-util.h" 128 #include "time-util.h"
128 #include "utf8.h" 129 #include "utf8.h"
129+#include "missing_stdlib.h" 130+#include "missing_stdlib.h"
130 131
131 #define SNDBUF_SIZE (8*1024*1024) 132 #define SNDBUF_SIZE (8*1024*1024)
132 #define IOVEC_MAX 128U 133 #define IOVEC_MAX 256U
133diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h 134diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
134index 8c76f93eb2..9068bfb4f0 100644 135index 8c76f93eb2..9068bfb4f0 100644
135--- a/src/basic/missing_stdlib.h 136--- a/src/basic/missing_stdlib.h
@@ -166,7 +167,7 @@ diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
166index bc74fbef8f..cdb609bb84 100644 167index bc74fbef8f..cdb609bb84 100644
167--- a/src/basic/mountpoint-util.c 168--- a/src/basic/mountpoint-util.c
168+++ b/src/basic/mountpoint-util.c 169+++ b/src/basic/mountpoint-util.c
169@@ -13,6 +13,7 @@ 170@@ -18,6 +18,7 @@
170 #include "missing_stat.h" 171 #include "missing_stat.h"
171 #include "missing_syscall.h" 172 #include "missing_syscall.h"
172 #include "mkdir.h" 173 #include "mkdir.h"
@@ -214,14 +215,14 @@ diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
214index eea70d8606..ae3abd8402 100644 215index eea70d8606..ae3abd8402 100644
215--- a/src/basic/proc-cmdline.c 216--- a/src/basic/proc-cmdline.c
216+++ b/src/basic/proc-cmdline.c 217+++ b/src/basic/proc-cmdline.c
217@@ -15,6 +15,7 @@ 218@@ -16,6 +16,7 @@
218 #include "special.h"
219 #include "string-util.h" 219 #include "string-util.h"
220 #include "strv.h"
220 #include "virt.h" 221 #include "virt.h"
221+#include "missing_stdlib.h" 222+#include "missing_stdlib.h"
222 223
223 int proc_cmdline(char **ret) { 224 int proc_cmdline_filter_pid1_args(char **argv, char ***ret) {
224 const char *e; 225 enum {
225diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c 226diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
226index bcba5a5208..64a95dd866 100644 227index bcba5a5208..64a95dd866 100644
227--- a/src/basic/procfs-util.c 228--- a/src/basic/procfs-util.c
@@ -238,7 +239,7 @@ diff --git a/src/basic/time-util.c b/src/basic/time-util.c
238index b700f364ef..48a26bcec9 100644 239index b700f364ef..48a26bcec9 100644
239--- a/src/basic/time-util.c 240--- a/src/basic/time-util.c
240+++ b/src/basic/time-util.c 241+++ b/src/basic/time-util.c
241@@ -26,6 +26,7 @@ 242@@ -27,6 +27,7 @@
242 #include "string-util.h" 243 #include "string-util.h"
243 #include "strv.h" 244 #include "strv.h"
244 #include "time-util.h" 245 #include "time-util.h"
@@ -262,7 +263,7 @@ diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
262index b5484eda78..54ed62c790 100644 263index b5484eda78..54ed62c790 100644
263--- a/src/core/dbus-cgroup.c 264--- a/src/core/dbus-cgroup.c
264+++ b/src/core/dbus-cgroup.c 265+++ b/src/core/dbus-cgroup.c
265@@ -21,6 +21,7 @@ 266@@ -23,6 +23,7 @@
266 #include "parse-util.h" 267 #include "parse-util.h"
267 #include "path-util.h" 268 #include "path-util.h"
268 #include "percent-util.h" 269 #include "percent-util.h"
@@ -274,7 +275,7 @@ diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
274index f514b8fd12..4febd0d496 100644 275index f514b8fd12..4febd0d496 100644
275--- a/src/core/dbus-execute.c 276--- a/src/core/dbus-execute.c
276+++ b/src/core/dbus-execute.c 277+++ b/src/core/dbus-execute.c
277@@ -45,6 +45,7 @@ 278@@ -48,6 +48,7 @@
278 #include "unit-printf.h" 279 #include "unit-printf.h"
279 #include "user-util.h" 280 #include "user-util.h"
280 #include "utf8.h" 281 #include "utf8.h"
@@ -298,7 +299,7 @@ diff --git a/src/core/execute.c b/src/core/execute.c
298index 853e87450f..8ef76de9ab 100644 299index 853e87450f..8ef76de9ab 100644
299--- a/src/core/execute.c 300--- a/src/core/execute.c
300+++ b/src/core/execute.c 301+++ b/src/core/execute.c
301@@ -105,6 +105,7 @@ 302@@ -113,6 +113,7 @@
302 #include "unit-serialize.h" 303 #include "unit-serialize.h"
303 #include "user-util.h" 304 #include "user-util.h"
304 #include "utmp-wtmp.h" 305 #include "utmp-wtmp.h"
@@ -310,9 +311,9 @@ diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
310index e843743777..e149807492 100644 311index e843743777..e149807492 100644
311--- a/src/core/kmod-setup.c 312--- a/src/core/kmod-setup.c
312+++ b/src/core/kmod-setup.c 313+++ b/src/core/kmod-setup.c
313@@ -12,6 +12,7 @@ 314@@ -13,6 +13,7 @@
314 #include "recurse-dir.h"
315 #include "string-util.h" 315 #include "string-util.h"
316 #include "strv.h"
316 #include "virt.h" 317 #include "virt.h"
317+#include "missing_stdlib.h" 318+#include "missing_stdlib.h"
318 319
@@ -322,7 +323,7 @@ diff --git a/src/core/service.c b/src/core/service.c
322index 9ad3c3d995..b112d64919 100644 323index 9ad3c3d995..b112d64919 100644
323--- a/src/core/service.c 324--- a/src/core/service.c
324+++ b/src/core/service.c 325+++ b/src/core/service.c
325@@ -42,6 +42,7 @@ 326@@ -45,6 +45,7 @@
326 #include "unit-name.h" 327 #include "unit-name.h"
327 #include "unit.h" 328 #include "unit.h"
328 #include "utf8.h" 329 #include "utf8.h"
@@ -346,7 +347,7 @@ diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-g
346index efc553b698..acea922311 100644 347index efc553b698..acea922311 100644
347--- a/src/fstab-generator/fstab-generator.c 348--- a/src/fstab-generator/fstab-generator.c
348+++ b/src/fstab-generator/fstab-generator.c 349+++ b/src/fstab-generator/fstab-generator.c
349@@ -33,6 +33,7 @@ 350@@ -37,6 +37,7 @@
350 #include "unit-name.h" 351 #include "unit-name.h"
351 #include "virt.h" 352 #include "virt.h"
352 #include "volatile-util.h" 353 #include "volatile-util.h"
@@ -358,7 +359,7 @@ diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journ
358index 7df264fb53..9463a0e9fb 100644 359index 7df264fb53..9463a0e9fb 100644
359--- a/src/journal-remote/journal-remote-main.c 360--- a/src/journal-remote/journal-remote-main.c
360+++ b/src/journal-remote/journal-remote-main.c 361+++ b/src/journal-remote/journal-remote-main.c
361@@ -25,6 +25,7 @@ 362@@ -26,6 +26,7 @@
362 #include "stat-util.h" 363 #include "stat-util.h"
363 #include "string-table.h" 364 #include "string-table.h"
364 #include "strv.h" 365 #include "strv.h"
@@ -370,7 +371,7 @@ diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
370index da0fac548e..c1c043e0e0 100644 371index da0fac548e..c1c043e0e0 100644
371--- a/src/journal/journalctl.c 372--- a/src/journal/journalctl.c
372+++ b/src/journal/journalctl.c 373+++ b/src/journal/journalctl.c
373@@ -72,6 +72,7 @@ 374@@ -77,6 +77,7 @@
374 #include "unit-name.h" 375 #include "unit-name.h"
375 #include "user-util.h" 376 #include "user-util.h"
376 #include "varlink.h" 377 #include "varlink.h"
@@ -406,7 +407,7 @@ diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-sock
406index 64037e4fe0..9b9ce0aaa9 100644 407index 64037e4fe0..9b9ce0aaa9 100644
407--- a/src/libsystemd/sd-bus/bus-socket.c 408--- a/src/libsystemd/sd-bus/bus-socket.c
408+++ b/src/libsystemd/sd-bus/bus-socket.c 409+++ b/src/libsystemd/sd-bus/bus-socket.c
409@@ -27,6 +27,7 @@ 410@@ -28,6 +28,7 @@
410 #include "string-util.h" 411 #include "string-util.h"
411 #include "user-util.h" 412 #include "user-util.h"
412 #include "utf8.h" 413 #include "utf8.h"
@@ -418,7 +419,7 @@ diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
418index f6a5e4aa06..b36faa79a3 100644 419index f6a5e4aa06..b36faa79a3 100644
419--- a/src/libsystemd/sd-bus/sd-bus.c 420--- a/src/libsystemd/sd-bus/sd-bus.c
420+++ b/src/libsystemd/sd-bus/sd-bus.c 421+++ b/src/libsystemd/sd-bus/sd-bus.c
421@@ -44,6 +44,7 @@ 422@@ -46,6 +46,7 @@
422 #include "string-util.h" 423 #include "string-util.h"
423 #include "strv.h" 424 #include "strv.h"
424 #include "user-util.h" 425 #include "user-util.h"
@@ -442,10 +443,10 @@ diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/
442index 9947947ef2..8dc6f93159 100644 443index 9947947ef2..8dc6f93159 100644
443--- a/src/libsystemd/sd-journal/sd-journal.c 444--- a/src/libsystemd/sd-journal/sd-journal.c
444+++ b/src/libsystemd/sd-journal/sd-journal.c 445+++ b/src/libsystemd/sd-journal/sd-journal.c
445@@ -41,6 +41,7 @@ 446@@ -44,6 +44,7 @@
446 #include "string-util.h"
447 #include "strv.h" 447 #include "strv.h"
448 #include "syslog-util.h" 448 #include "syslog-util.h"
449 #include "uid-alloc-range.h"
449+#include "missing_stdlib.h" 450+#include "missing_stdlib.h"
450 451
451 #define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC) 452 #define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC)
@@ -454,7 +455,7 @@ diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
454index ba2fca32c6..e1f9caa13b 100644 455index ba2fca32c6..e1f9caa13b 100644
455--- a/src/login/pam_systemd.c 456--- a/src/login/pam_systemd.c
456+++ b/src/login/pam_systemd.c 457+++ b/src/login/pam_systemd.c
457@@ -32,6 +32,7 @@ 458@@ -34,6 +34,7 @@
458 #include "locale-util.h" 459 #include "locale-util.h"
459 #include "login-util.h" 460 #include "login-util.h"
460 #include "macro.h" 461 #include "macro.h"
@@ -466,7 +467,7 @@ diff --git a/src/network/generator/network-generator.c b/src/network/generator/n
466index 1090934bfc..69a77f66e2 100644 467index 1090934bfc..69a77f66e2 100644
467--- a/src/network/generator/network-generator.c 468--- a/src/network/generator/network-generator.c
468+++ b/src/network/generator/network-generator.c 469+++ b/src/network/generator/network-generator.c
469@@ -13,6 +13,7 @@ 470@@ -14,6 +14,7 @@
470 #include "string-table.h" 471 #include "string-table.h"
471 #include "string-util.h" 472 #include "string-util.h"
472 #include "strv.h" 473 #include "strv.h"
@@ -502,7 +503,7 @@ diff --git a/src/portable/portable.c b/src/portable/portable.c
502index 7811833fac..c6414da91c 100644 503index 7811833fac..c6414da91c 100644
503--- a/src/portable/portable.c 504--- a/src/portable/portable.c
504+++ b/src/portable/portable.c 505+++ b/src/portable/portable.c
505@@ -39,6 +39,7 @@ 506@@ -40,6 +40,7 @@
506 #include "strv.h" 507 #include "strv.h"
507 #include "tmpfile-util.h" 508 #include "tmpfile-util.h"
508 #include "user-util.h" 509 #include "user-util.h"
@@ -550,7 +551,7 @@ diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
550index 1e95e36678..640ee031d5 100644 551index 1e95e36678..640ee031d5 100644
551--- a/src/shared/bus-unit-util.c 552--- a/src/shared/bus-unit-util.c
552+++ b/src/shared/bus-unit-util.c 553+++ b/src/shared/bus-unit-util.c
553@@ -50,6 +50,7 @@ 554@@ -51,6 +51,7 @@
554 #include "unit-def.h" 555 #include "unit-def.h"
555 #include "user-util.h" 556 #include "user-util.h"
556 #include "utf8.h" 557 #include "utf8.h"
@@ -562,7 +563,7 @@ diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
562index d09ec5148d..f38a8f7cc1 100644 563index d09ec5148d..f38a8f7cc1 100644
563--- a/src/shared/bus-util.c 564--- a/src/shared/bus-util.c
564+++ b/src/shared/bus-util.c 565+++ b/src/shared/bus-util.c
565@@ -21,6 +21,7 @@ 566@@ -24,6 +24,7 @@
566 #include "path-util.h" 567 #include "path-util.h"
567 #include "socket-util.h" 568 #include "socket-util.h"
568 #include "stdio-util.h" 569 #include "stdio-util.h"
@@ -586,9 +587,9 @@ diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
586index d9eabec886..534c6cf7e3 100644 587index d9eabec886..534c6cf7e3 100644
587--- a/src/shared/journal-importer.c 588--- a/src/shared/journal-importer.c
588+++ b/src/shared/journal-importer.c 589+++ b/src/shared/journal-importer.c
589@@ -15,6 +15,7 @@ 590@@ -16,6 +16,7 @@
590 #include "parse-util.h"
591 #include "string-util.h" 591 #include "string-util.h"
592 #include "strv.h"
592 #include "unaligned.h" 593 #include "unaligned.h"
593+#include "missing_stdlib.h" 594+#include "missing_stdlib.h"
594 595
@@ -622,7 +623,7 @@ diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
622index 821049e667..08a5bdae3d 100644 623index 821049e667..08a5bdae3d 100644
623--- a/src/socket-proxy/socket-proxyd.c 624--- a/src/socket-proxy/socket-proxyd.c
624+++ b/src/socket-proxy/socket-proxyd.c 625+++ b/src/socket-proxy/socket-proxyd.c
625@@ -26,6 +26,7 @@ 626@@ -27,6 +27,7 @@
626 #include "set.h" 627 #include "set.h"
627 #include "socket-util.h" 628 #include "socket-util.h"
628 #include "string-util.h" 629 #include "string-util.h"
@@ -646,7 +647,7 @@ diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
646index 8e4d57ee72..6b4555b4d5 100644 647index 8e4d57ee72..6b4555b4d5 100644
647--- a/src/udev/udev-builtin-path_id.c 648--- a/src/udev/udev-builtin-path_id.c
648+++ b/src/udev/udev-builtin-path_id.c 649+++ b/src/udev/udev-builtin-path_id.c
649@@ -22,6 +22,7 @@ 650@@ -24,6 +24,7 @@
650 #include "sysexits.h" 651 #include "sysexits.h"
651 #include "udev-builtin.h" 652 #include "udev-builtin.h"
652 #include "udev-util.h" 653 #include "udev-util.h"
@@ -670,13 +671,13 @@ diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
670index 5bd09a64d1..0ce79f815c 100644 671index 5bd09a64d1..0ce79f815c 100644
671--- a/src/udev/udev-rules.c 672--- a/src/udev/udev-rules.c
672+++ b/src/udev/udev-rules.c 673+++ b/src/udev/udev-rules.c
673@@ -34,6 +34,7 @@ 674@@ -35,6 +35,7 @@
674 #include "udev-util.h" 675 #include "udev-util.h"
675 #include "user-util.h" 676 #include "user-util.h"
676 #include "virt.h" 677 #include "virt.h"
677+#include "missing_stdlib.h" 678+#include "missing_stdlib.h"
678 679
679 #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") 680 #define RULES_DIRS ((const char* const*) CONF_PATHS_STRV("udev/rules.d"))
680 681
681-- 682--
6822.39.2 6832.39.2
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
index b86cc42589..0d69e8e9cd 100644
--- a/meta/recipes-core/systemd/systemd/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+++ b/meta/recipes-core/systemd/systemd/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
@@ -130,7 +130,7 @@ index 458aed7054..2cf24b38c0 100644
130 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates 130 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
131 * them in the file system. This is intended to be used to create 131 * them in the file system. This is intended to be used to create
132 * properly owned directories beneath /tmp, /var/tmp, /run, which are 132 * properly owned directories beneath /tmp, /var/tmp, /run, which are
133@@ -2194,7 +2200,9 @@ finish: 133@@ -2355,7 +2361,9 @@ finish:
134 134
135 static int glob_item(Item *i, action_t action) { 135 static int glob_item(Item *i, action_t action) {
136 _cleanup_globfree_ glob_t g = { 136 _cleanup_globfree_ glob_t g = {
@@ -140,7 +140,7 @@ index 458aed7054..2cf24b38c0 100644
140 }; 140 };
141 int r = 0, k; 141 int r = 0, k;
142 142
143@@ -2214,7 +2222,9 @@ static int glob_item(Item *i, action_t action) { 143@@ -2375,7 +2383,9 @@ static int glob_item(Item *i, action_t action) {
144 144
145 static int glob_item_recursively(Item *i, fdaction_t action) { 145 static int glob_item_recursively(Item *i, fdaction_t action) {
146 _cleanup_globfree_ glob_t g = { 146 _cleanup_globfree_ glob_t g = {
diff --git a/meta/recipes-core/systemd/systemd/0014-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0014-Use-uintmax_t-for-handling-rlim_t.patch
index f586d3ff52..1d50faa363 100644
--- a/meta/recipes-core/systemd/systemd/0014-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Use-uintmax_t-for-handling-rlim_t.patch
@@ -89,7 +89,7 @@ diff --git a/src/core/execute.c b/src/core/execute.c
89index 8ef76de9ab..ea1c203e43 100644 89index 8ef76de9ab..ea1c203e43 100644
90--- a/src/core/execute.c 90--- a/src/core/execute.c
91+++ b/src/core/execute.c 91+++ b/src/core/execute.c
92@@ -6034,9 +6034,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { 92@@ -6667,9 +6667,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
93 for (unsigned i = 0; i < RLIM_NLIMITS; i++) 93 for (unsigned i = 0; i < RLIM_NLIMITS; i++)
94 if (c->rlimit[i]) { 94 if (c->rlimit[i]) {
95 fprintf(f, "%sLimit%s: " RLIM_FMT "\n", 95 fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
diff --git a/meta/recipes-core/systemd/systemd/0015-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0015-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
deleted file mode 100644
index afc80b9511..0000000000
--- a/meta/recipes-core/systemd/systemd/0015-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 96088895149746dd2ee8e8c2e4b97972ccf44696 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 28 Feb 2018 21:25:22 -0800
4Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
10---
11 src/test/test-sizeof.c | 4 ++++
12 1 file changed, 4 insertions(+)
13
14diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
15index 55bd81e22f..6cf92bffde 100644
16--- a/src/test/test-sizeof.c
17+++ b/src/test/test-sizeof.c
18@@ -55,8 +55,10 @@ int main(void) {
19 info(unsigned);
20 info(unsigned long);
21 info(unsigned long long);
22+#ifdef __GLIBC__
23 info(__syscall_ulong_t);
24 info(__syscall_slong_t);
25+#endif
26 info(intmax_t);
27 info(uintmax_t);
28
29@@ -76,7 +78,9 @@ int main(void) {
30 info(ssize_t);
31 info(time_t);
32 info(usec_t);
33+#ifdef __GLIBC__
34 info(__time_t);
35+#endif
36 info(pid_t);
37 info(uid_t);
38 info(gid_t);
39--
402.39.2
41
diff --git a/meta/recipes-core/systemd/systemd/0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
index 2f84d3d6c2..543fba7cdb 100644
--- a/meta/recipes-core/systemd/systemd/0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
+++ b/meta/recipes-core/systemd/systemd/0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
@@ -34,7 +34,7 @@ diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
34index 932d003f19..33215dbf5f 100644 34index 932d003f19..33215dbf5f 100644
35--- a/src/basic/fs-util.h 35--- a/src/basic/fs-util.h
36+++ b/src/basic/fs-util.h 36+++ b/src/basic/fs-util.h
37@@ -50,8 +50,27 @@ int futimens_opath(int fd, const struct timespec ts[2]); 37@@ -49,8 +49,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
38 int fd_warn_permissions(const char *path, int fd); 38 int fd_warn_permissions(const char *path, int fd);
39 int stat_warn_permissions(const char *path, const struct stat *st); 39 int stat_warn_permissions(const char *path, const struct stat *st);
40 40
@@ -67,16 +67,16 @@ diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
67index be6dd1654a..2726dc946a 100644 67index be6dd1654a..2726dc946a 100644
68--- a/src/shared/base-filesystem.c 68--- a/src/shared/base-filesystem.c
69+++ b/src/shared/base-filesystem.c 69+++ b/src/shared/base-filesystem.c
70@@ -131,7 +131,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { 70@@ -145,7 +145,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
71 return log_error_errno(errno, "Failed to open root file system: %m"); 71 /* The "root" parameter is decoration only – it's only used as part of log messages */
72 72
73 for (size_t i = 0; i < ELEMENTSOF(table); i++) { 73 for (size_t i = 0; i < ELEMENTSOF(table); i++) {
74- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) 74- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
75+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) 75+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0)
76 continue; 76 continue;
77 77
78 if (table[i].target) { 78 if (table[i].target) { /* Create as symlink? */
79@@ -139,7 +139,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { 79@@ -153,7 +153,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
80 80
81 /* check if one of the targets exists */ 81 /* check if one of the targets exists */
82 NULSTR_FOREACH(s, table[i].target) { 82 NULSTR_FOREACH(s, table[i].target) {
@@ -85,7 +85,7 @@ index be6dd1654a..2726dc946a 100644
85 continue; 85 continue;
86 86
87 /* check if a specific file exists at the target path */ 87 /* check if a specific file exists at the target path */
88@@ -150,7 +150,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { 88@@ -164,7 +164,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
89 if (!p) 89 if (!p)
90 return log_oom(); 90 return log_oom();
91 91
diff --git a/meta/recipes-core/systemd/systemd/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
index 401a9a9546..8162bc2c57 100644
--- a/meta/recipes-core/systemd/systemd/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+++ b/meta/recipes-core/systemd/systemd/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
@@ -27,7 +27,7 @@ diff --git a/src/basic/process-util.c b/src/basic/process-util.c
27index 0747c14c1c..8d0c5aae92 100644 27index 0747c14c1c..8d0c5aae92 100644
28--- a/src/basic/process-util.c 28--- a/src/basic/process-util.c
29+++ b/src/basic/process-util.c 29+++ b/src/basic/process-util.c
30@@ -1405,7 +1405,7 @@ int set_oom_score_adjust(int value) { 30@@ -1516,7 +1516,7 @@ int set_oom_score_adjust(int value) {
31 xsprintf(t, "%i", value); 31 xsprintf(t, "%i", value);
32 32
33 return write_string_file("/proc/self/oom_score_adj", t, 33 return write_string_file("/proc/self/oom_score_adj", t,
diff --git a/meta/recipes-core/systemd/systemd/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
index 48b8eda0a5..f6d908f947 100644
--- a/meta/recipes-core/systemd/systemd/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+++ b/meta/recipes-core/systemd/systemd/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
@@ -58,7 +58,7 @@ diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journa
58index 136ebcb153..8a75ba4ecd 100644 58index 136ebcb153..8a75ba4ecd 100644
59--- a/src/libsystemd/sd-journal/journal-send.c 59--- a/src/libsystemd/sd-journal/journal-send.c
60+++ b/src/libsystemd/sd-journal/journal-send.c 60+++ b/src/libsystemd/sd-journal/journal-send.c
61@@ -381,7 +381,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove 61@@ -360,7 +360,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
62 char* j; 62 char* j;
63 63
64 errno = 0; 64 errno = 0;
diff --git a/meta/recipes-core/systemd/systemd/0021-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0021-do-not-disable-buffer-in-writing-files.patch
index 46267a5ada..ef6b5342ca 100644
--- a/meta/recipes-core/systemd/systemd/0021-do-not-disable-buffer-in-writing-files.patch
+++ b/meta/recipes-core/systemd/systemd/0021-do-not-disable-buffer-in-writing-files.patch
@@ -18,34 +18,35 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
18Signed-off-by: Andrej Valek <andrej.valek@siemens.com> 18Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
19[rebased for systemd 243] 19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com> 20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21[rebased for systemd 254]
21--- 22---
22 src/basic/cgroup-util.c | 12 ++++++------ 23 src/basic/cgroup-util.c | 12 ++++++------
23 src/basic/namespace-util.c | 4 ++-- 24 src/basic/namespace-util.c | 4 ++--
24 src/basic/procfs-util.c | 4 ++-- 25 src/basic/procfs-util.c | 4 ++--
25 src/basic/sysctl-util.c | 2 +- 26 src/basic/sysctl-util.c | 2 +-
26 src/binfmt/binfmt.c | 6 +++--- 27 src/binfmt/binfmt.c | 6 +++---
27 src/core/cgroup.c | 2 +- 28 src/core/cgroup.c | 2 +-
28 src/core/main.c | 2 +- 29 src/core/main.c | 2 +-
29 src/core/smack-setup.c | 8 ++++---- 30 src/core/smack-setup.c | 8 ++++----
30 src/hibernate-resume/hibernate-resume.c | 2 +- 31 src/home/homework.c | 2 +-
31 src/home/homework.c | 2 +- 32 src/libsystemd/sd-device/sd-device.c | 2 +-
32 src/libsystemd/sd-device/sd-device.c | 2 +- 33 src/nspawn/nspawn-cgroup.c | 2 +-
33 src/nspawn/nspawn-cgroup.c | 2 +- 34 src/nspawn/nspawn.c | 6 +++---
34 src/nspawn/nspawn.c | 6 +++--- 35 src/shared/binfmt-util.c | 2 +-
35 src/shared/binfmt-util.c | 2 +- 36 src/shared/cgroup-setup.c | 4 ++--
36 src/shared/cgroup-setup.c | 4 ++-- 37 src/shared/coredump-util.c | 2 +-
37 src/shared/coredump-util.c | 2 +- 38 src/shared/sleep-util.c | 4 ++--
38 src/shared/smack-util.c | 2 +- 39 src/shared/smack-util.c | 2 +-
39 src/sleep/sleep.c | 8 ++++---- 40 src/sleep/sleep.c | 4 ++--
40 src/udev/udev-rules.c | 1 - 41 src/udev/udev-rules.c | 1 -
41 src/vconsole/vconsole-setup.c | 2 +- 42 src/vconsole/vconsole-setup.c | 2 +-
42 20 files changed, 37 insertions(+), 38 deletions(-) 43 20 files changed, 36 insertions(+), 37 deletions(-)
43 44
44diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c 45diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
45index 11b4375ed5..7d81a6007f 100644 46index 11b4375ed5..7d81a6007f 100644
46--- a/src/basic/cgroup-util.c 47--- a/src/basic/cgroup-util.c
47+++ b/src/basic/cgroup-util.c 48+++ b/src/basic/cgroup-util.c
48@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) { 49@@ -400,7 +400,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) {
49 if (r < 0) 50 if (r < 0)
50 return r; 51 return r;
51 52
@@ -54,7 +55,7 @@ index 11b4375ed5..7d81a6007f 100644
54 if (r < 0) 55 if (r < 0)
55 return r; 56 return r;
56 57
57@@ -805,7 +805,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { 58@@ -806,7 +806,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
58 59
59 sc = strstrip(contents); 60 sc = strstrip(contents);
60 if (isempty(sc)) { 61 if (isempty(sc)) {
@@ -63,7 +64,7 @@ index 11b4375ed5..7d81a6007f 100644
63 if (r < 0) 64 if (r < 0)
64 return r; 65 return r;
65 } else if (!path_equal(sc, agent)) 66 } else if (!path_equal(sc, agent))
66@@ -823,7 +823,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { 67@@ -824,7 +824,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
67 68
68 sc = strstrip(contents); 69 sc = strstrip(contents);
69 if (streq(sc, "0")) { 70 if (streq(sc, "0")) {
@@ -72,7 +73,7 @@ index 11b4375ed5..7d81a6007f 100644
72 if (r < 0) 73 if (r < 0)
73 return r; 74 return r;
74 75
75@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const char *controller) { 76@@ -851,7 +851,7 @@ int cg_uninstall_release_agent(const char *controller) {
76 if (r < 0) 77 if (r < 0)
77 return r; 78 return r;
78 79
@@ -81,7 +82,7 @@ index 11b4375ed5..7d81a6007f 100644
81 if (r < 0) 82 if (r < 0)
82 return r; 83 return r;
83 84
84@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const char *controller) { 85@@ -861,7 +861,7 @@ int cg_uninstall_release_agent(const char *controller) {
85 if (r < 0) 86 if (r < 0)
86 return r; 87 return r;
87 88
@@ -90,7 +91,7 @@ index 11b4375ed5..7d81a6007f 100644
90 if (r < 0) 91 if (r < 0)
91 return r; 92 return r;
92 93
93@@ -1752,7 +1752,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri 94@@ -1764,7 +1764,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
94 if (r < 0) 95 if (r < 0)
95 return r; 96 return r;
96 97
@@ -103,7 +104,7 @@ diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
103index f5c0e04cec..272b920022 100644 104index f5c0e04cec..272b920022 100644
104--- a/src/basic/namespace-util.c 105--- a/src/basic/namespace-util.c
105+++ b/src/basic/namespace-util.c 106+++ b/src/basic/namespace-util.c
106@@ -220,12 +220,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) { 107@@ -227,12 +227,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
107 freeze(); 108 freeze();
108 109
109 xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); 110 xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
@@ -186,7 +187,7 @@ diff --git a/src/core/cgroup.c b/src/core/cgroup.c
186index 4cac3f6a89..bebe2cd120 100644 187index 4cac3f6a89..bebe2cd120 100644
187--- a/src/core/cgroup.c 188--- a/src/core/cgroup.c
188+++ b/src/core/cgroup.c 189+++ b/src/core/cgroup.c
189@@ -4267,7 +4267,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { 190@@ -4349,7 +4349,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
190 u->freezer_state = FREEZER_THAWING; 191 u->freezer_state = FREEZER_THAWING;
191 } 192 }
192 193
@@ -199,7 +200,7 @@ diff --git a/src/core/main.c b/src/core/main.c
199index c0b8126d96..fe676320ba 100644 200index c0b8126d96..fe676320ba 100644
200--- a/src/core/main.c 201--- a/src/core/main.c
201+++ b/src/core/main.c 202+++ b/src/core/main.c
202@@ -1716,7 +1716,7 @@ static void initialize_core_pattern(bool skip_setup) { 203@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool skip_setup) {
203 if (getpid_cached() != 1) 204 if (getpid_cached() != 1)
204 return; 205 return;
205 206
@@ -234,19 +235,6 @@ index bcaa237c8d..4032bde19e 100644
234 if (r < 0) 235 if (r < 0)
235 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); 236 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
236 #endif 237 #endif
237diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
238index 9a9df5d22f..75ddec881a 100644
239--- a/src/hibernate-resume/hibernate-resume.c
240+++ b/src/hibernate-resume/hibernate-resume.c
241@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
242 return EXIT_FAILURE;
243 }
244
245- r = write_string_file("/sys/power/resume", FORMAT_DEVNUM(st.st_rdev), WRITE_STRING_FILE_DISABLE_BUFFER);
246+ r = write_string_file("/sys/power/resume", FORMAT_DEVNUM(st.st_rdev), 0);
247 if (r < 0) {
248 log_error_errno(r, "Failed to write '" DEVNUM_FORMAT_STR "' to /sys/power/resume: %m", DEVNUM_FORMAT_VAL(st.st_rdev));
249 return EXIT_FAILURE;
250diff --git a/src/home/homework.c b/src/home/homework.c 238diff --git a/src/home/homework.c b/src/home/homework.c
251index 28907386a4..f9e45349a7 100644 239index 28907386a4..f9e45349a7 100644
252--- a/src/home/homework.c 240--- a/src/home/homework.c
@@ -264,7 +252,7 @@ diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-
264index 8c65ee3469..153edab081 100644 252index 8c65ee3469..153edab081 100644
265--- a/src/libsystemd/sd-device/sd-device.c 253--- a/src/libsystemd/sd-device/sd-device.c
266+++ b/src/libsystemd/sd-device/sd-device.c 254+++ b/src/libsystemd/sd-device/sd-device.c
267@@ -2481,7 +2481,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, 255@@ -2515,7 +2515,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
268 if (!value) 256 if (!value)
269 return -ENOMEM; 257 return -ENOMEM;
270 258
@@ -290,7 +278,7 @@ diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
290index 36d336dfc8..8c5c69596b 100644 278index 36d336dfc8..8c5c69596b 100644
291--- a/src/nspawn/nspawn.c 279--- a/src/nspawn/nspawn.c
292+++ b/src/nspawn/nspawn.c 280+++ b/src/nspawn/nspawn.c
293@@ -2771,7 +2771,7 @@ static int reset_audit_loginuid(void) { 281@@ -2774,7 +2774,7 @@ static int reset_audit_loginuid(void) {
294 if (streq(p, "4294967295")) 282 if (streq(p, "4294967295"))
295 return 0; 283 return 0;
296 284
@@ -299,7 +287,7 @@ index 36d336dfc8..8c5c69596b 100644
299 if (r < 0) { 287 if (r < 0) {
300 log_error_errno(r, 288 log_error_errno(r,
301 "Failed to reset audit login UID. This probably means that your kernel is too\n" 289 "Failed to reset audit login UID. This probably means that your kernel is too\n"
302@@ -4211,7 +4211,7 @@ static int setup_uid_map( 290@@ -4214,7 +4214,7 @@ static int setup_uid_map(
303 return log_oom(); 291 return log_oom();
304 292
305 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); 293 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
@@ -308,7 +296,7 @@ index 36d336dfc8..8c5c69596b 100644
308 if (r < 0) 296 if (r < 0)
309 return log_error_errno(r, "Failed to write UID map: %m"); 297 return log_error_errno(r, "Failed to write UID map: %m");
310 298
311@@ -4221,7 +4221,7 @@ static int setup_uid_map( 299@@ -4224,7 +4224,7 @@ static int setup_uid_map(
312 return log_oom(); 300 return log_oom();
313 301
314 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); 302 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
@@ -334,7 +322,7 @@ diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
334index 2ea83f05d3..8626bb184c 100644 322index 2ea83f05d3..8626bb184c 100644
335--- a/src/shared/cgroup-setup.c 323--- a/src/shared/cgroup-setup.c
336+++ b/src/shared/cgroup-setup.c 324+++ b/src/shared/cgroup-setup.c
337@@ -350,7 +350,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { 325@@ -351,7 +351,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
338 326
339 xsprintf(c, PID_FMT "\n", pid); 327 xsprintf(c, PID_FMT "\n", pid);
340 328
@@ -343,7 +331,7 @@ index 2ea83f05d3..8626bb184c 100644
343 if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0) 331 if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0)
344 /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */ 332 /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
345 return -EUCLEAN; 333 return -EUCLEAN;
346@@ -887,7 +887,7 @@ int cg_enable_everywhere( 334@@ -964,7 +964,7 @@ int cg_enable_everywhere(
347 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); 335 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
348 } 336 }
349 337
@@ -356,8 +344,8 @@ diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
356index 3d2f179049..c1b6c170ac 100644 344index 3d2f179049..c1b6c170ac 100644
357--- a/src/shared/coredump-util.c 345--- a/src/shared/coredump-util.c
358+++ b/src/shared/coredump-util.c 346+++ b/src/shared/coredump-util.c
359@@ -71,7 +71,7 @@ int set_coredump_filter(uint64_t value) { 347@@ -163,7 +163,7 @@ int set_coredump_filter(uint64_t value) {
360 sprintf(t, "0x%"PRIx64, value); 348 xsprintf(t, "0x%"PRIx64, value);
361 349
362 return write_string_file("/proc/self/coredump_filter", t, 350 return write_string_file("/proc/self/coredump_filter", t,
363- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); 351- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
@@ -365,11 +353,33 @@ index 3d2f179049..c1b6c170ac 100644
365 } 353 }
366 354
367 /* Turn off core dumps but only if we're running outside of a container. */ 355 /* Turn off core dumps but only if we're running outside of a container. */
356diff --git a/src/shared/sleep-util.c b/src/shared/sleep-util.c
357index d7277399fb..d06d636fcc 100644
358--- a/src/shared/sleep-util.c
359+++ b/src/shared/sleep-util.c
360@@ -1044,7 +1044,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
361
362 /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so
363 * fail gracefully if it doesn't exist and we're only overwriting it with 0. */
364- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
365+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
366 if (r == -ENOENT) {
367 if (offset != 0)
368 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
369@@ -1060,7 +1060,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
370 log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.",
371 offset_str, device);
372
373- r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER);
374+ r = write_string_file("/sys/power/resume", devno_str, 0);
375 if (r < 0)
376 return log_error_errno(r,
377 "Failed to write device '%s' (%s) to /sys/power/resume: %m",
368diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c 378diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
369index b3b5c905ad..bbfa1973fd 100644 379index b3b5c905ad..bbfa1973fd 100644
370--- a/src/shared/smack-util.c 380--- a/src/shared/smack-util.c
371+++ b/src/shared/smack-util.c 381+++ b/src/shared/smack-util.c
372@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { 382@@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
373 return 0; 383 return 0;
374 384
375 p = procfs_file_alloca(pid, "attr/current"); 385 p = procfs_file_alloca(pid, "attr/current");
@@ -382,25 +392,7 @@ diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
382index 765dd4974f..cd6afb001b 100644 392index 765dd4974f..cd6afb001b 100644
383--- a/src/sleep/sleep.c 393--- a/src/sleep/sleep.c
384+++ b/src/sleep/sleep.c 394+++ b/src/sleep/sleep.c
385@@ -50,7 +50,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca 395@@ -139,7 +139,7 @@ static int write_mode(char **modes) {
386 assert(hibernate_location->swap);
387
388 xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
389- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
390+ r = write_string_file("/sys/power/resume", resume_str, 0);
391 if (r < 0)
392 return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
393 hibernate_location->swap->device, resume_str);
394@@ -77,7 +77,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
395 }
396
397 xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
398- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
399+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
400 if (r < 0)
401 return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
402 hibernate_location->swap->device, offset_str);
403@@ -93,7 +93,7 @@ static int write_mode(char **modes) {
404 STRV_FOREACH(mode, modes) { 396 STRV_FOREACH(mode, modes) {
405 int k; 397 int k;
406 398
@@ -409,7 +401,7 @@ index 765dd4974f..cd6afb001b 100644
409 if (k >= 0) 401 if (k >= 0)
410 return 0; 402 return 0;
411 403
412@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **states) { 404@@ -160,7 +160,7 @@ static int write_state(FILE **f, char **states) {
413 STRV_FOREACH(state, states) { 405 STRV_FOREACH(state, states) {
414 int k; 406 int k;
415 407
@@ -422,8 +414,8 @@ diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
422index 0ce79f815c..28aab475d0 100644 414index 0ce79f815c..28aab475d0 100644
423--- a/src/udev/udev-rules.c 415--- a/src/udev/udev-rules.c
424+++ b/src/udev/udev-rules.c 416+++ b/src/udev/udev-rules.c
425@@ -2357,7 +2357,6 @@ static int udev_rule_apply_token_to_event( 417@@ -2634,7 +2634,6 @@ static int udev_rule_apply_token_to_event(
426 log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value); 418 log_event_debug(dev, token, "ATTR '%s' writing '%s'", buf, value);
427 r = write_string_file(buf, value, 419 r = write_string_file(buf, value,
428 WRITE_STRING_FILE_VERIFY_ON_FAILURE | 420 WRITE_STRING_FILE_VERIFY_ON_FAILURE |
429- WRITE_STRING_FILE_DISABLE_BUFFER | 421- WRITE_STRING_FILE_DISABLE_BUFFER |
@@ -434,7 +426,7 @@ diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
434index 7d3e9db73f..2d4a0c4c9d 100644 426index 7d3e9db73f..2d4a0c4c9d 100644
435--- a/src/vconsole/vconsole-setup.c 427--- a/src/vconsole/vconsole-setup.c
436+++ b/src/vconsole/vconsole-setup.c 428+++ b/src/vconsole/vconsole-setup.c
437@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { 429@@ -259,7 +259,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
438 static int toggle_utf8_sysfs(bool utf8) { 430 static int toggle_utf8_sysfs(bool utf8) {
439 int r; 431 int r;
440 432
diff --git a/meta/recipes-core/systemd/systemd/0022-Handle-__cpu_mask-usage.patch b/meta/recipes-core/systemd/systemd/0022-Handle-__cpu_mask-usage.patch
index 61545f5778..341543afdc 100644
--- a/meta/recipes-core/systemd/systemd/0022-Handle-__cpu_mask-usage.patch
+++ b/meta/recipes-core/systemd/systemd/0022-Handle-__cpu_mask-usage.patch
@@ -46,8 +46,8 @@ index 6cf92bffde..937d26ca55 100644
46-#include <sched.h> 46-#include <sched.h>
47 #include <stdio.h> 47 #include <stdio.h>
48 #include <string.h> 48 #include <string.h>
49 #include <sys/types.h> 49 #include <sys/resource.h>
50@@ -10,6 +9,7 @@ 50@@ -11,6 +10,7 @@
51 #include <float.h> 51 #include <float.h>
52 52
53 #include "time-util.h" 53 #include "time-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0023-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0023-Handle-missing-gshadow.patch
index 7da8798ebc..19ee3ff311 100644
--- a/meta/recipes-core/systemd/systemd/0023-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0023-Handle-missing-gshadow.patch
@@ -20,7 +20,7 @@ diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
20index 88b8fc2f8f..a819d41bac 100644 20index 88b8fc2f8f..a819d41bac 100644
21--- a/src/shared/user-record-nss.c 21--- a/src/shared/user-record-nss.c
22+++ b/src/shared/user-record-nss.c 22+++ b/src/shared/user-record-nss.c
23@@ -331,8 +331,10 @@ int nss_group_to_group_record( 23@@ -329,8 +329,10 @@ int nss_group_to_group_record(
24 if (isempty(grp->gr_name)) 24 if (isempty(grp->gr_name))
25 return -EINVAL; 25 return -EINVAL;
26 26
@@ -31,7 +31,7 @@ index 88b8fc2f8f..a819d41bac 100644
31 31
32 g = group_record_new(); 32 g = group_record_new();
33 if (!g) 33 if (!g)
34@@ -348,6 +350,7 @@ int nss_group_to_group_record( 34@@ -346,6 +348,7 @@ int nss_group_to_group_record(
35 35
36 g->gid = grp->gr_gid; 36 g->gid = grp->gr_gid;
37 37
@@ -39,7 +39,7 @@ index 88b8fc2f8f..a819d41bac 100644
39 if (sgrp) { 39 if (sgrp) {
40 if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { 40 if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
41 g->hashed_password = strv_new(sgrp->sg_passwd); 41 g->hashed_password = strv_new(sgrp->sg_passwd);
42@@ -363,6 +366,7 @@ int nss_group_to_group_record( 42@@ -361,6 +364,7 @@ int nss_group_to_group_record(
43 if (r < 0) 43 if (r < 0)
44 return r; 44 return r;
45 } 45 }
@@ -47,7 +47,7 @@ index 88b8fc2f8f..a819d41bac 100644
47 47
48 r = json_build(&g->json, JSON_BUILD_OBJECT( 48 r = json_build(&g->json, JSON_BUILD_OBJECT(
49 JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), 49 JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
50@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 50@@ -387,6 +391,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
51 assert(ret_sgrp); 51 assert(ret_sgrp);
52 assert(ret_buffer); 52 assert(ret_buffer);
53 53
@@ -55,7 +55,7 @@ index 88b8fc2f8f..a819d41bac 100644
55 for (;;) { 55 for (;;) {
56 _cleanup_free_ char *buf = NULL; 56 _cleanup_free_ char *buf = NULL;
57 struct sgrp sgrp, *result; 57 struct sgrp sgrp, *result;
58@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 58@@ -415,6 +420,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
59 buflen *= 2; 59 buflen *= 2;
60 buf = mfree(buf); 60 buf = mfree(buf);
61 } 61 }
@@ -65,7 +65,7 @@ index 88b8fc2f8f..a819d41bac 100644
65 } 65 }
66 66
67 int nss_group_record_by_name( 67 int nss_group_record_by_name(
68@@ -427,7 +435,9 @@ int nss_group_record_by_name( 68@@ -426,7 +434,9 @@ int nss_group_record_by_name(
69 struct group grp, *result; 69 struct group grp, *result;
70 bool incomplete = false; 70 bool incomplete = false;
71 size_t buflen = 4096; 71 size_t buflen = 4096;
@@ -75,7 +75,7 @@ index 88b8fc2f8f..a819d41bac 100644
75 int r; 75 int r;
76 76
77 assert(name); 77 assert(name);
78@@ -457,6 +467,7 @@ int nss_group_record_by_name( 78@@ -455,6 +465,7 @@ int nss_group_record_by_name(
79 buf = mfree(buf); 79 buf = mfree(buf);
80 } 80 }
81 81
@@ -83,7 +83,7 @@ index 88b8fc2f8f..a819d41bac 100644
83 if (with_shadow) { 83 if (with_shadow) {
84 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 84 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
85 if (r < 0) { 85 if (r < 0) {
86@@ -468,6 +479,9 @@ int nss_group_record_by_name( 86@@ -466,6 +477,9 @@ int nss_group_record_by_name(
87 incomplete = true; 87 incomplete = true;
88 88
89 r = nss_group_to_group_record(result, sresult, ret); 89 r = nss_group_to_group_record(result, sresult, ret);
@@ -93,7 +93,7 @@ index 88b8fc2f8f..a819d41bac 100644
93 if (r < 0) 93 if (r < 0)
94 return r; 94 return r;
95 95
96@@ -484,7 +498,9 @@ int nss_group_record_by_gid( 96@@ -483,7 +497,9 @@ int nss_group_record_by_gid(
97 struct group grp, *result; 97 struct group grp, *result;
98 bool incomplete = false; 98 bool incomplete = false;
99 size_t buflen = 4096; 99 size_t buflen = 4096;
@@ -102,8 +102,8 @@ index 88b8fc2f8f..a819d41bac 100644
102+#endif 102+#endif
103 int r; 103 int r;
104 104
105 assert(ret); 105 for (;;) {
106@@ -512,6 +528,7 @@ int nss_group_record_by_gid( 106@@ -509,6 +525,7 @@ int nss_group_record_by_gid(
107 buf = mfree(buf); 107 buf = mfree(buf);
108 } 108 }
109 109
@@ -111,7 +111,7 @@ index 88b8fc2f8f..a819d41bac 100644
111 if (with_shadow) { 111 if (with_shadow) {
112 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 112 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
113 if (r < 0) { 113 if (r < 0) {
114@@ -523,6 +540,9 @@ int nss_group_record_by_gid( 114@@ -520,6 +537,9 @@ int nss_group_record_by_gid(
115 incomplete = true; 115 incomplete = true;
116 116
117 r = nss_group_to_group_record(result, sresult, ret); 117 r = nss_group_to_group_record(result, sresult, ret);
@@ -141,7 +141,7 @@ diff --git a/src/shared/userdb.c b/src/shared/userdb.c
141index a77eff4407..955e361d3a 100644 141index a77eff4407..955e361d3a 100644
142--- a/src/shared/userdb.c 142--- a/src/shared/userdb.c
143+++ b/src/shared/userdb.c 143+++ b/src/shared/userdb.c
144@@ -1044,13 +1044,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 144@@ -1038,13 +1038,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
145 if (gr) { 145 if (gr) {
146 _cleanup_free_ char *buffer = NULL; 146 _cleanup_free_ char *buffer = NULL;
147 bool incomplete = false; 147 bool incomplete = false;
@@ -158,7 +158,7 @@ index a77eff4407..955e361d3a 100644
158 if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) { 158 if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
159 r = nss_sgrp_for_group(gr, &sgrp, &buffer); 159 r = nss_sgrp_for_group(gr, &sgrp, &buffer);
160 if (r < 0) { 160 if (r < 0) {
161@@ -1063,6 +1065,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 161@@ -1057,6 +1059,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
162 } 162 }
163 163
164 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); 164 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
diff --git a/meta/recipes-core/systemd/systemd/0024-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0024-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
index 15ff6eb4f8..d64cec1585 100644
--- a/meta/recipes-core/systemd/systemd/0024-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
+++ b/meta/recipes-core/systemd/systemd/0024-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
@@ -36,7 +36,7 @@ diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
36index 2726dc946a..484f63e0b4 100644 36index 2726dc946a..484f63e0b4 100644
37--- a/src/shared/base-filesystem.c 37--- a/src/shared/base-filesystem.c
38+++ b/src/shared/base-filesystem.c 38+++ b/src/shared/base-filesystem.c
39@@ -19,6 +19,7 @@ 39@@ -20,6 +20,7 @@
40 #include "string-util.h" 40 #include "string-util.h"
41 #include "umask-util.h" 41 #include "umask-util.h"
42 #include "user-util.h" 42 #include "user-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0025-include-sys-file.h-for-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0025-include-sys-file.h-for-LOCK_EX.patch
new file mode 100644
index 0000000000..7827cc1403
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0025-include-sys-file.h-for-LOCK_EX.patch
@@ -0,0 +1,29 @@
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 10:33:48 -0700
4Subject: [PATCH] include sys/file.h for LOCK_EX
5
6Fixes
7| ../git/src/basic/user-util.c:708:30: error: use of undeclared identifier 'LOCK_EX'; did you mean 'LOCK_BSD'?
8| 708 | r = unposix_lock(fd, LOCK_EX);
9| | ^~~~~~~
10| | LOCK_BSD
11
12Upstream-Status: Backport [https://github.com/systemd/systemd/pull/28647]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 src/basic/user-util.c | 1 +
16 1 file changed, 1 insertion(+)
17
18diff --git a/src/basic/user-util.c b/src/basic/user-util.c
19index fe61a09005..5c39847733 100644
20--- a/src/basic/user-util.c
21+++ b/src/basic/user-util.c
22@@ -6,6 +6,7 @@
23 #include <stdint.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26+#include <sys/file.h>
27 #include <sys/stat.h>
28 #include <unistd.h>
29 #include <utmp.h>
diff --git a/meta/recipes-core/systemd/systemd/0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch b/meta/recipes-core/systemd/systemd/0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch
deleted file mode 100644
index c7e2280c3b..0000000000
--- a/meta/recipes-core/systemd/systemd/0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From 34072f456b4fe880fbb2f18760b64a1a6c1eebb8 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Mon, 6 Mar 2023 15:24:49 +0100
4Subject: [PATCH] src/boot/efi/efi-string.c: define wchar_t from __WCHAR_TYPE__
5
6systemd-boot relies on wchar_t being 16 bit, and breaks at build time otherwise.
7
8To set wchar_t to 16 bit it is passing -fshort-wchar to gcc; this has the
9desired effect on glibc (which sets wchar_t from __WCHAR_TYPE__) but not on
10musl (which hardcodes it to 32 bit).
11
12This patch ensures wchar_t is set from the compiler flags on all systems; note
13that systemd-boot is not actually using functions from musl or other libc, just their headers.
14
15Meanwhile upstream has refactored the code to not rely on libc headers at all;
16however this will not be backported to v253 and we need a different fix.
17
18Upstream-Status: Inappropriate [fixed differently in trunk according to https://github.com/systemd/systemd/pull/26689]
19Signed-off-by: Alexander Kanavin <alex@linutronix.de>
20---
21 src/boot/efi/efi-string.c | 6 ++++++
22 1 file changed, 6 insertions(+)
23
24diff --git a/src/boot/efi/efi-string.c b/src/boot/efi/efi-string.c
25index 22923d60f6..5d09d4281f 100644
26--- a/src/boot/efi/efi-string.c
27+++ b/src/boot/efi/efi-string.c
28@@ -2,7 +2,13 @@
29
30 #include <stdbool.h>
31 #include <stdint.h>
32+
33+#if SD_BOOT
34+typedef __WCHAR_TYPE__ wchar_t;
35+#define __DEFINED_wchar_t
36+#else
37 #include <wchar.h>
38+#endif
39
40 #include "efi-string.h"
41
42--
432.39.2
44
diff --git a/meta/recipes-core/systemd/systemd/0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch b/meta/recipes-core/systemd/systemd/0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch
new file mode 100644
index 0000000000..f2130c856f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch
@@ -0,0 +1,28 @@
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:14:56 -0700
4Subject: [PATCH] test/test-sizeof: Include sys/timex.h for struct timex
5
6Fixes
7
8../git/src/test/test-sizeof.c:64:41: error: incomplete definition of type 'struct timex'
9 64 | check(typeof(((struct timex *)0)->freq), SIZEOF_TIMEX_MEMBER);
10 | ~~~~~~~~~~~~~~~~~~~^
11
12Upstream-Status: Backport [https://github.com/systemd/systemd/pull/28651]
13---
14 src/test/test-sizeof.c | 1 +
15 1 file changed, 1 insertion(+)
16
17diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
18index 9d969cf8f1..b65c0bd370 100644
19--- a/src/test/test-sizeof.c
20+++ b/src/test/test-sizeof.c
21@@ -4,6 +4,7 @@
22 #include <string.h>
23 #include <sys/resource.h>
24 #include <sys/socket.h>
25+#include <sys/timex.h>
26 #include <sys/types.h>
27
28 #define __STDC_WANT_IEC_60559_TYPES_EXT__
diff --git a/meta/recipes-core/systemd/systemd/0027-include-missing-sys-file.h-for-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0027-include-missing-sys-file.h-for-LOCK_EX.patch
new file mode 100644
index 0000000000..19014802e4
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0027-include-missing-sys-file.h-for-LOCK_EX.patch
@@ -0,0 +1,98 @@
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:18:24 -0700
4Subject: [PATCH] include missing sys/file.h for LOCK_EX
5
6Upstream-Status: Backport [https://github.com/systemd/systemd/pull/28651]
7---
8 src/core/execute.c | 1 +
9 src/shared/btrfs-util.c | 1 +
10 src/shared/copy.c | 1 +
11 src/test/test-btrfs.c | 1 +
12 src/test/test-fs-util.c | 1 +
13 src/test/test-lock-util.c | 1 +
14 src/vconsole/vconsole-setup.c | 1 +
15 7 files changed, 7 insertions(+)
16
17diff --git a/src/core/execute.c b/src/core/execute.c
18index 5b2ae861ff..2ebf19ffaa 100644
19--- a/src/core/execute.c
20+++ b/src/core/execute.c
21@@ -4,6 +4,7 @@
22 #include <fcntl.h>
23 #include <poll.h>
24 #include <sys/eventfd.h>
25+#include <sys/file.h>
26 #include <sys/ioctl.h>
27 #include <sys/mman.h>
28 #include <sys/mount.h>
29diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c
30index 5128b308ab..3ded95ea82 100644
31--- a/src/shared/btrfs-util.c
32+++ b/src/shared/btrfs-util.c
33@@ -10,6 +10,7 @@
34 #include <stddef.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37+#include <sys/file.h>
38 #include <sys/ioctl.h>
39 #include <sys/sysmacros.h>
40 #include <unistd.h>
41diff --git a/src/shared/copy.c b/src/shared/copy.c
42index 241a2d112b..7e47dc002c 100644
43--- a/src/shared/copy.c
44+++ b/src/shared/copy.c
45@@ -6,6 +6,7 @@
46 #include <stddef.h>
47 #include <stdio.h>
48 #include <stdlib.h>
49+#include <sys/file.h>
50 #include <sys/ioctl.h>
51 #include <sys/sendfile.h>
52 #include <sys/xattr.h>
53diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c
54index 95b7ef25d8..ba09563058 100644
55--- a/src/test/test-btrfs.c
56+++ b/src/test/test-btrfs.c
57@@ -1,6 +1,7 @@
58 /* SPDX-License-Identifier: LGPL-2.1-or-later */
59
60 #include <fcntl.h>
61+#include <sys/file.h>
62
63 #include "btrfs-util.h"
64 #include "fd-util.h"
65diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c
66index 1beba916a4..5de1eea0d4 100644
67--- a/src/test/test-fs-util.c
68+++ b/src/test/test-fs-util.c
69@@ -1,5 +1,6 @@
70 /* SPDX-License-Identifier: LGPL-2.1-or-later */
71
72+#include <sys/file.h>
73 #include <unistd.h>
74
75 #include "alloc-util.h"
76diff --git a/src/test/test-lock-util.c b/src/test/test-lock-util.c
77index a9a1b438ff..28fc54a5d6 100644
78--- a/src/test/test-lock-util.c
79+++ b/src/test/test-lock-util.c
80@@ -1,5 +1,6 @@
81 /* SPDX-License-Identifier: LGPL-2.1-or-later */
82
83+#include <sys/file.h>
84 #include <unistd.h>
85
86 #include "fd-util.h"
87diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
88index d57d8b4001..86348d08c1 100644
89--- a/src/vconsole/vconsole-setup.c
90+++ b/src/vconsole/vconsole-setup.c
91@@ -11,6 +11,7 @@
92 #include <linux/vt.h>
93 #include <stdbool.h>
94 #include <stdlib.h>
95+#include <sys/file.h>
96 #include <sys/ioctl.h>
97 #include <sysexits.h>
98 #include <termios.h>
diff --git a/meta/recipes-core/systemd/systemd/27253.patch b/meta/recipes-core/systemd/systemd/27253.patch
deleted file mode 100644
index 6c556fe80f..0000000000
--- a/meta/recipes-core/systemd/systemd/27253.patch
+++ /dev/null
@@ -1,313 +0,0 @@
1From 924937cbc0bf692bc6e5b3a0bd3c18347d9521e9 Mon Sep 17 00:00:00 2001
2From: Yu Watanabe <watanabe.yu+github@gmail.com>
3Date: Thu, 13 Apr 2023 16:40:36 +0900
4Subject: [PATCH 1/7] timesync: drop unnecessary initialization
5
6Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/27253]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 src/timesync/timesyncd-manager.c | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12--- a/src/timesync/timesyncd-manager.c
13+++ b/src/timesync/timesyncd-manager.c
14@@ -410,7 +410,7 @@ static int manager_receive_response(sd_e
15 .msg_name = &server_addr,
16 .msg_namelen = sizeof(server_addr),
17 };
18- struct timespec *recv_time = NULL;
19+ struct timespec *recv_time;
20 triple_timestamp dts;
21 ssize_t len;
22 double origin, receive, trans, dest, delay, offset, root_distance;
23@@ -445,7 +445,7 @@ static int manager_receive_response(sd_e
24 return 0;
25 }
26
27- recv_time = CMSG_FIND_DATA(&msghdr, SOL_SOCKET, SCM_TIMESTAMPNS, struct timespec);
28+ recv_time = CMSG_FIND_AND_COPY_DATA(&msghdr, SOL_SOCKET, SCM_TIMESTAMPNS, struct timespec);
29 if (!recv_time)
30 return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Packet timestamp missing.");
31
32--- a/src/basic/socket-util.h
33+++ b/src/basic/socket-util.h
34@@ -183,17 +183,22 @@ int flush_accept(int fd);
35 * riscv32. */
36 #define CMSG_TYPED_DATA(cmsg, type) \
37 ({ \
38- struct cmsghdr *_cmsg = cmsg; \
39- assert_cc(__alignof__(type) <= __alignof__(struct cmsghdr)); \
40+ struct cmsghdr *_cmsg = (cmsg); \
41+ assert_cc(alignof(type) <= alignof(struct cmsghdr)); \
42 _cmsg ? CAST_ALIGN_PTR(type, CMSG_DATA(_cmsg)) : (type*) NULL; \
43 })
44
45 struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t length);
46+void* cmsg_find_and_copy_data(struct msghdr *mh, int level, int type, void *buf, size_t buf_len);
47
48 /* Type-safe, dereferencing version of cmsg_find() */
49 #define CMSG_FIND_DATA(mh, level, type, ctype) \
50 CMSG_TYPED_DATA(cmsg_find(mh, level, type, CMSG_LEN(sizeof(ctype))), ctype)
51
52+/* Type-safe version of cmsg_find_and_copy_data() */
53+#define CMSG_FIND_AND_COPY_DATA(mh, level, type, ctype) \
54+ (ctype*) cmsg_find_and_copy_data(mh, level, type, &(ctype){}, sizeof(ctype))
55+
56 /* Resolves to a type that can carry cmsghdr structures. Make sure things are properly aligned, i.e. the type
57 * itself is placed properly in memory and the size is also aligned to what's appropriate for "cmsghdr"
58 * structures. */
59--- a/src/boot/efi/pe.c
60+++ b/src/boot/efi/pe.c
61@@ -197,7 +197,7 @@ static uint32_t get_compatibility_entry_
62 uint32_t entry_point;
63 } _packed_ LinuxPeCompat1;
64
65- while (size >= sizeof(LinuxPeCompat1) && addr % __alignof__(LinuxPeCompat1) == 0) {
66+ while (size >= sizeof(LinuxPeCompat1) && addr % alignof(LinuxPeCompat1) == 0) {
67 LinuxPeCompat1 *compat = (LinuxPeCompat1 *) ((uint8_t *) dos + addr);
68
69 if (compat->type == 0 || compat->size == 0 || compat->size > size)
70--- a/src/fundamental/macro-fundamental.h
71+++ b/src/fundamental/macro-fundamental.h
72@@ -6,12 +6,13 @@
73 #endif
74
75 #include <limits.h>
76+#include <stdalign.h>
77 #include <stdbool.h>
78 #include <stddef.h>
79 #include <stdint.h>
80
81 #define _align_(x) __attribute__((__aligned__(x)))
82-#define _alignas_(x) __attribute__((__aligned__(__alignof__(x))))
83+#define _alignas_(x) __attribute__((__aligned__(alignof(x))))
84 #define _alignptr_ __attribute__((__aligned__(sizeof(void *))))
85 #define _cleanup_(x) __attribute__((__cleanup__(x)))
86 #define _const_ __attribute__((__const__))
87@@ -346,9 +347,9 @@ static inline size_t ALIGN_TO(size_t l,
88 #endif
89
90 /* Checks if the specified pointer is aligned as appropriate for the specific type */
91-#define IS_ALIGNED16(p) (((uintptr_t) p) % __alignof__(uint16_t) == 0)
92-#define IS_ALIGNED32(p) (((uintptr_t) p) % __alignof__(uint32_t) == 0)
93-#define IS_ALIGNED64(p) (((uintptr_t) p) % __alignof__(uint64_t) == 0)
94+#define IS_ALIGNED16(p) (((uintptr_t) p) % alignof(uint16_t) == 0)
95+#define IS_ALIGNED32(p) (((uintptr_t) p) % alignof(uint32_t) == 0)
96+#define IS_ALIGNED64(p) (((uintptr_t) p) % alignof(uint64_t) == 0)
97
98 /* Same as ALIGN_TO but callable in constant contexts. */
99 #define CONST_ALIGN_TO(l, ali) \
100@@ -366,7 +367,7 @@ static inline size_t ALIGN_TO(size_t l,
101 #define CAST_ALIGN_PTR(t, p) \
102 ({ \
103 const void *_p = (p); \
104- assert(((uintptr_t) _p) % __alignof__(t) == 0); \
105+ assert(((uintptr_t) _p) % alignof(t) == 0); \
106 (t *) _p; \
107 })
108
109--- a/src/network/networkd-nexthop.c
110+++ b/src/network/networkd-nexthop.c
111@@ -894,7 +894,7 @@ int manager_rtnl_process_nexthop(sd_netl
112 return 0;
113 }
114
115- assert((uintptr_t) group % __alignof__(struct nexthop_grp) == 0);
116+ assert((uintptr_t) group % alignof(struct nexthop_grp) == 0);
117
118 n_group = raw_group_size / sizeof(struct nexthop_grp);
119 for (size_t i = 0; i < n_group; i++) {
120--- a/src/test/test-sizeof.c
121+++ b/src/test/test-sizeof.c
122@@ -17,16 +17,16 @@
123 DISABLE_WARNING_TYPE_LIMITS;
124
125 #define info_no_sign(t) \
126- printf("%s → %zu bits, %zu byte alignment\n", STRINGIFY(t), \
127+ printf("%s → %zu bits, %zu byte alignment\n", STRINGIFY(t), \
128 sizeof(t)*CHAR_BIT, \
129- __alignof__(t))
130+ alignof(t))
131
132 #define info(t) \
133- printf("%s → %zu bits%s, %zu byte alignment\n", STRINGIFY(t), \
134+ printf("%s → %zu bits%s, %zu byte alignment\n", STRINGIFY(t), \
135 sizeof(t)*CHAR_BIT, \
136 strstr(STRINGIFY(t), "signed") ? "" : \
137 (t)-1 < (t)0 ? ", signed" : ", unsigned", \
138- __alignof__(t))
139+ alignof(t))
140
141 enum Enum {
142 enum_value,
143@@ -44,7 +44,7 @@ enum BigEnum2 {
144 int main(void) {
145 int (*function_pointer)(void);
146
147- info_no_sign(function_pointer);
148+ info_no_sign(typeof(function_pointer));
149 info_no_sign(void*);
150 info(char*);
151
152--- a/src/basic/socket-util.c
153+++ b/src/basic/socket-util.c
154@@ -1171,6 +1171,18 @@ struct cmsghdr* cmsg_find(struct msghdr
155 return NULL;
156 }
157
158+void* cmsg_find_and_copy_data(struct msghdr *mh, int level, int type, void *buf, size_t buf_len) {
159+ struct cmsghdr *cmsg;
160+
161+ assert(mh);
162+
163+ cmsg = cmsg_find(mh, level, type, buf_len == SIZE_MAX ? (socklen_t) -1 : CMSG_LEN(buf_len));
164+ if (!cmsg)
165+ return NULL;
166+
167+ return memcpy_safe(buf, CMSG_DATA(cmsg), buf_len == SIZE_MAX ? cmsg->cmsg_len : buf_len);
168+}
169+
170 int socket_ioctl_fd(void) {
171 int fd;
172
173--- a/src/journal/journald-server.c
174+++ b/src/journal/journald-server.c
175@@ -1385,7 +1385,7 @@ int server_process_datagram(
176 size_t label_len = 0, m;
177 Server *s = ASSERT_PTR(userdata);
178 struct ucred *ucred = NULL;
179- struct timeval *tv = NULL;
180+ struct timeval tv_buf, *tv = NULL;
181 struct cmsghdr *cmsg;
182 char *label = NULL;
183 struct iovec iovec;
184@@ -1461,10 +1461,10 @@ int server_process_datagram(
185 label = CMSG_TYPED_DATA(cmsg, char);
186 label_len = cmsg->cmsg_len - CMSG_LEN(0);
187 } else if (cmsg->cmsg_level == SOL_SOCKET &&
188- cmsg->cmsg_type == SO_TIMESTAMP &&
189+ cmsg->cmsg_type == SCM_TIMESTAMP &&
190 cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval))) {
191 assert(!tv);
192- tv = CMSG_TYPED_DATA(cmsg, struct timeval);
193+ tv = memcpy(&tv_buf, CMSG_DATA(cmsg), sizeof(struct timeval));
194 } else if (cmsg->cmsg_level == SOL_SOCKET &&
195 cmsg->cmsg_type == SCM_RIGHTS) {
196 assert(!fds);
197--- a/src/libsystemd-network/icmp6-util.c
198+++ b/src/libsystemd-network/icmp6-util.c
199@@ -199,9 +199,11 @@ int icmp6_receive(int fd, void *buffer,
200 }
201
202 if (cmsg->cmsg_level == SOL_SOCKET &&
203- cmsg->cmsg_type == SO_TIMESTAMP &&
204- cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval)))
205- triple_timestamp_from_realtime(&t, timeval_load(CMSG_TYPED_DATA(cmsg, struct timeval)));
206+ cmsg->cmsg_type == SCM_TIMESTAMP &&
207+ cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval))) {
208+ struct timeval *tv = memcpy(&(struct timeval) {}, CMSG_DATA(cmsg), sizeof(struct timeval));
209+ triple_timestamp_from_realtime(&t, timeval_load(tv));
210+ }
211 }
212
213 if (!triple_timestamp_is_set(&t))
214--- a/src/libsystemd-network/sd-dhcp6-client.c
215+++ b/src/libsystemd-network/sd-dhcp6-client.c
216@@ -1276,7 +1276,6 @@ static int client_receive_message(
217 .msg_control = &control,
218 .msg_controllen = sizeof(control),
219 };
220- struct cmsghdr *cmsg;
221 triple_timestamp t = {};
222 _cleanup_free_ DHCP6Message *message = NULL;
223 struct in6_addr *server_address = NULL;
224@@ -1320,12 +1319,9 @@ static int client_receive_message(
225 server_address = &sa.in6.sin6_addr;
226 }
227
228- CMSG_FOREACH(cmsg, &msg) {
229- if (cmsg->cmsg_level == SOL_SOCKET &&
230- cmsg->cmsg_type == SO_TIMESTAMP &&
231- cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval)))
232- triple_timestamp_from_realtime(&t, timeval_load(CMSG_TYPED_DATA(cmsg, struct timeval)));
233- }
234+ struct timeval *tv = CMSG_FIND_AND_COPY_DATA(&msg, SOL_SOCKET, SCM_TIMESTAMP, struct timeval);
235+ if (tv)
236+ triple_timestamp_from_realtime(&t, timeval_load(tv));
237
238 if (client->transaction_id != (message->transaction_id & htobe32(0x00ffffff)))
239 return 0;
240--- a/src/libsystemd-network/sd-dhcp-server.c
241+++ b/src/libsystemd-network/sd-dhcp-server.c
242@@ -407,7 +407,7 @@ static int dhcp_server_send_udp(sd_dhcp_
243 rather than binding the socket. This will be mostly useful
244 when we gain support for arbitrary number of server addresses
245 */
246- pktinfo = (struct in_pktinfo*) CMSG_DATA(cmsg);
247+ pktinfo = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
248 assert(pktinfo);
249
250 pktinfo->ipi_ifindex = server->ifindex;
251@@ -1270,7 +1270,6 @@ static int server_receive_message(sd_eve
252 .msg_control = &control,
253 .msg_controllen = sizeof(control),
254 };
255- struct cmsghdr *cmsg;
256 ssize_t datagram_size, len;
257 int r;
258
259@@ -1306,19 +1305,10 @@ static int server_receive_message(sd_eve
260 if ((size_t) len < sizeof(DHCPMessage))
261 return 0;
262
263- CMSG_FOREACH(cmsg, &msg)
264- if (cmsg->cmsg_level == IPPROTO_IP &&
265- cmsg->cmsg_type == IP_PKTINFO &&
266- cmsg->cmsg_len == CMSG_LEN(sizeof(struct in_pktinfo))) {
267- struct in_pktinfo *info = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
268-
269- /* TODO figure out if this can be done as a filter on
270- * the socket, like for IPv6 */
271- if (server->ifindex != info->ipi_ifindex)
272- return 0;
273-
274- break;
275- }
276+ /* TODO figure out if this can be done as a filter on the socket, like for IPv6 */
277+ struct in_pktinfo *info = CMSG_FIND_DATA(&msg, IPPROTO_IP, IP_PKTINFO, struct in_pktinfo);
278+ if (info && info->ipi_ifindex != server->ifindex)
279+ return 0;
280
281 if (sd_dhcp_server_is_in_relay_mode(server)) {
282 r = dhcp_server_relay_message(server, message, len - sizeof(DHCPMessage), buflen);
283--- a/src/libsystemd/sd-daemon/sd-daemon.c
284+++ b/src/libsystemd/sd-daemon/sd-daemon.c
285@@ -567,7 +567,7 @@ _public_ int sd_pid_notify_with_fds(
286 cmsg->cmsg_type = SCM_CREDENTIALS;
287 cmsg->cmsg_len = CMSG_LEN(sizeof(struct ucred));
288
289- ucred = (struct ucred*) CMSG_DATA(cmsg);
290+ ucred = CMSG_TYPED_DATA(cmsg, struct ucred);
291 ucred->pid = pid != 0 ? pid : getpid_cached();
292 ucred->uid = getuid();
293 ucred->gid = getgid();
294--- a/src/resolve/resolved-manager.c
295+++ b/src/resolve/resolved-manager.c
296@@ -984,7 +984,7 @@ static int manager_ipv4_send(
297 cmsg->cmsg_level = IPPROTO_IP;
298 cmsg->cmsg_type = IP_PKTINFO;
299
300- pi = (struct in_pktinfo*) CMSG_DATA(cmsg);
301+ pi = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
302 pi->ipi_ifindex = ifindex;
303
304 if (source)
305@@ -1040,7 +1040,7 @@ static int manager_ipv6_send(
306 cmsg->cmsg_level = IPPROTO_IPV6;
307 cmsg->cmsg_type = IPV6_PKTINFO;
308
309- pi = (struct in6_pktinfo*) CMSG_DATA(cmsg);
310+ pi = CMSG_TYPED_DATA(cmsg, struct in6_pktinfo);
311 pi->ipi6_ifindex = ifindex;
312
313 if (source)
diff --git a/meta/recipes-core/systemd/systemd/27254.patch b/meta/recipes-core/systemd/systemd/27254.patch
deleted file mode 100644
index 3928088dc6..0000000000
--- a/meta/recipes-core/systemd/systemd/27254.patch
+++ /dev/null
@@ -1,345 +0,0 @@
1From 79dec6f5cc0b72d43dfb0469fa68b5cd023fbaf9 Mon Sep 17 00:00:00 2001
2From: Lennart Poettering <lennart@poettering.net>
3Date: Thu, 13 Apr 2023 10:21:31 +0200
4Subject: [PATCH 1/3] socket-util: tighten aignment check for CMSG_TYPED_DATA()
5
6Apparently CMSG_DATA() alignment is very much undefined. Which is quite
7an ABI fuck-up, but we need to deal with this. CMSG_TYPED_DATA() already
8checks alignment of the specified pointer. Let's also check matching
9alignment of the underlying structures, which we already can do at
10compile-time.
11
12See: #27241
13
14(This does not fix #27241, but should catch such errors already at
15compile-time instead of runtime)
16
17Upstream-Status: Backport [https://github.com/systemd/systemd/pull/27254]
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 src/basic/socket-util.h | 7 +++++++
21 1 file changed, 7 insertions(+)
22
23--- a/src/basic/socket-util.h
24+++ b/src/basic/socket-util.h
25@@ -175,9 +175,16 @@ int flush_accept(int fd);
26 #define CMSG_FOREACH(cmsg, mh) \
27 for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg)))
28
29+/* Returns the cmsghdr's data pointer, but safely cast to the specified type. Does two alignment checks: one
30+ * at compile time, that the requested type has a smaller or same alignment as 'struct cmsghdr', and one
31+ * during runtime, that the actual pointer matches the alignment too. This is supposed to catch cases such as
32+ * 'struct timeval' is embedded into 'struct cmsghdr' on architectures where the alignment of the former is 8
33+ * bytes (because of a 64bit time_t), but of the latter is 4 bytes (because size_t is 32bit), such as
34+ * riscv32. */
35 #define CMSG_TYPED_DATA(cmsg, type) \
36 ({ \
37 struct cmsghdr *_cmsg = cmsg; \
38+ assert_cc(__alignof__(type) <= __alignof__(struct cmsghdr)); \
39 _cmsg ? CAST_ALIGN_PTR(type, CMSG_DATA(_cmsg)) : (type*) NULL; \
40 })
41
42--- a/src/basic/socket-util.c
43+++ b/src/basic/socket-util.c
44@@ -1047,7 +1047,7 @@ ssize_t receive_one_fd_iov(
45 }
46
47 if (found)
48- *ret_fd = *(int*) CMSG_DATA(found);
49+ *ret_fd = *CMSG_TYPED_DATA(found, int);
50 else
51 *ret_fd = -EBADF;
52
53--- a/src/core/manager.c
54+++ b/src/core/manager.c
55@@ -2503,7 +2503,7 @@ static int manager_dispatch_notify_fd(sd
56 if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
57
58 assert(!fd_array);
59- fd_array = (int*) CMSG_DATA(cmsg);
60+ fd_array = CMSG_TYPED_DATA(cmsg, int);
61 n_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
62
63 } else if (cmsg->cmsg_level == SOL_SOCKET &&
64@@ -2511,7 +2511,7 @@ static int manager_dispatch_notify_fd(sd
65 cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred))) {
66
67 assert(!ucred);
68- ucred = (struct ucred*) CMSG_DATA(cmsg);
69+ ucred = CMSG_TYPED_DATA(cmsg, struct ucred);
70 }
71 }
72
73--- a/src/coredump/coredump.c
74+++ b/src/coredump/coredump.c
75@@ -1163,7 +1163,7 @@ static int process_socket(int fd) {
76 }
77
78 assert(input_fd < 0);
79- input_fd = *(int*) CMSG_DATA(found);
80+ input_fd = *CMSG_TYPED_DATA(found, int);
81 break;
82 } else
83 cmsg_close_all(&mh);
84--- a/src/home/homed-manager.c
85+++ b/src/home/homed-manager.c
86@@ -1086,7 +1086,7 @@ static ssize_t read_datagram(
87 cmsg->cmsg_type == SCM_CREDENTIALS &&
88 cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred))) {
89 assert(!sender);
90- sender = (struct ucred*) CMSG_DATA(cmsg);
91+ sender = CMSG_TYPED_DATA(cmsg, struct ucred);
92 }
93
94 if (cmsg->cmsg_level == SOL_SOCKET &&
95@@ -1098,7 +1098,7 @@ static ssize_t read_datagram(
96 }
97
98 assert(passed_fd < 0);
99- passed_fd = *(int*) CMSG_DATA(cmsg);
100+ passed_fd = *CMSG_TYPED_DATA(cmsg, int);
101 }
102 }
103
104--- a/src/journal/journald-server.c
105+++ b/src/journal/journald-server.c
106@@ -1454,21 +1454,21 @@ int server_process_datagram(
107 cmsg->cmsg_type == SCM_CREDENTIALS &&
108 cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred))) {
109 assert(!ucred);
110- ucred = (struct ucred*) CMSG_DATA(cmsg);
111+ ucred = CMSG_TYPED_DATA(cmsg, struct ucred);
112 } else if (cmsg->cmsg_level == SOL_SOCKET &&
113 cmsg->cmsg_type == SCM_SECURITY) {
114 assert(!label);
115- label = (char*) CMSG_DATA(cmsg);
116+ label = CMSG_TYPED_DATA(cmsg, char);
117 label_len = cmsg->cmsg_len - CMSG_LEN(0);
118 } else if (cmsg->cmsg_level == SOL_SOCKET &&
119 cmsg->cmsg_type == SO_TIMESTAMP &&
120 cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval))) {
121 assert(!tv);
122- tv = (struct timeval*) CMSG_DATA(cmsg);
123+ tv = CMSG_TYPED_DATA(cmsg, struct timeval);
124 } else if (cmsg->cmsg_level == SOL_SOCKET &&
125 cmsg->cmsg_type == SCM_RIGHTS) {
126 assert(!fds);
127- fds = (int*) CMSG_DATA(cmsg);
128+ fds = CMSG_TYPED_DATA(cmsg, int);
129 n_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
130 }
131
132--- a/src/libsystemd-network/icmp6-util.c
133+++ b/src/libsystemd-network/icmp6-util.c
134@@ -192,7 +192,7 @@ int icmp6_receive(int fd, void *buffer,
135 if (cmsg->cmsg_level == SOL_IPV6 &&
136 cmsg->cmsg_type == IPV6_HOPLIMIT &&
137 cmsg->cmsg_len == CMSG_LEN(sizeof(int))) {
138- int hops = *(int*) CMSG_DATA(cmsg);
139+ int hops = *CMSG_TYPED_DATA(cmsg, int);
140
141 if (hops != 255)
142 return -EMULTIHOP;
143@@ -201,7 +201,7 @@ int icmp6_receive(int fd, void *buffer,
144 if (cmsg->cmsg_level == SOL_SOCKET &&
145 cmsg->cmsg_type == SO_TIMESTAMP &&
146 cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval)))
147- triple_timestamp_from_realtime(&t, timeval_load((struct timeval*) CMSG_DATA(cmsg)));
148+ triple_timestamp_from_realtime(&t, timeval_load(CMSG_TYPED_DATA(cmsg, struct timeval)));
149 }
150
151 if (!triple_timestamp_is_set(&t))
152--- a/src/libsystemd-network/sd-dhcp-client.c
153+++ b/src/libsystemd-network/sd-dhcp-client.c
154@@ -1981,7 +1981,7 @@ static int client_receive_message_raw(
155
156 cmsg = cmsg_find(&msg, SOL_PACKET, PACKET_AUXDATA, CMSG_LEN(sizeof(struct tpacket_auxdata)));
157 if (cmsg) {
158- struct tpacket_auxdata *aux = (struct tpacket_auxdata*) CMSG_DATA(cmsg);
159+ struct tpacket_auxdata *aux = CMSG_TYPED_DATA(cmsg, struct tpacket_auxdata);
160 checksum = !(aux->tp_status & TP_STATUS_CSUMNOTREADY);
161 }
162
163--- a/src/libsystemd-network/sd-dhcp-server.c
164+++ b/src/libsystemd-network/sd-dhcp-server.c
165@@ -1310,7 +1310,7 @@ static int server_receive_message(sd_eve
166 if (cmsg->cmsg_level == IPPROTO_IP &&
167 cmsg->cmsg_type == IP_PKTINFO &&
168 cmsg->cmsg_len == CMSG_LEN(sizeof(struct in_pktinfo))) {
169- struct in_pktinfo *info = (struct in_pktinfo*)CMSG_DATA(cmsg);
170+ struct in_pktinfo *info = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
171
172 /* TODO figure out if this can be done as a filter on
173 * the socket, like for IPv6 */
174--- a/src/libsystemd/sd-bus/bus-socket.c
175+++ b/src/libsystemd/sd-bus/bus-socket.c
176@@ -604,7 +604,7 @@ static int bus_socket_read_auth(sd_bus *
177 * protocol? Somebody is playing games with
178 * us. Close them all, and fail */
179 j = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
180- close_many((int*) CMSG_DATA(cmsg), j);
181+ close_many(CMSG_TYPED_DATA(cmsg, int), j);
182 return -EIO;
183 } else
184 log_debug("Got unexpected auxiliary data with level=%d and type=%d",
185@@ -1270,18 +1270,18 @@ int bus_socket_read_message(sd_bus *bus)
186 * isn't actually enabled? Close them,
187 * and fail */
188
189- close_many((int*) CMSG_DATA(cmsg), n);
190+ close_many(CMSG_TYPED_DATA(cmsg, int), n);
191 return -EIO;
192 }
193
194 f = reallocarray(bus->fds, bus->n_fds + n, sizeof(int));
195 if (!f) {
196- close_many((int*) CMSG_DATA(cmsg), n);
197+ close_many(CMSG_TYPED_DATA(cmsg, int), n);
198 return -ENOMEM;
199 }
200
201 for (i = 0; i < n; i++)
202- f[bus->n_fds++] = fd_move_above_stdio(((int*) CMSG_DATA(cmsg))[i]);
203+ f[bus->n_fds++] = fd_move_above_stdio(CMSG_TYPED_DATA(cmsg, int)[i]);
204 bus->fds = f;
205 } else
206 log_debug("Got unexpected auxiliary data with level=%d and type=%d",
207--- a/src/resolve/resolved-dns-stream.c
208+++ b/src/resolve/resolved-dns-stream.c
209@@ -147,7 +147,7 @@ static int dns_stream_identify(DnsStream
210 switch (cmsg->cmsg_type) {
211
212 case IPV6_PKTINFO: {
213- struct in6_pktinfo *i = (struct in6_pktinfo*) CMSG_DATA(cmsg);
214+ struct in6_pktinfo *i = CMSG_TYPED_DATA(cmsg, struct in6_pktinfo);
215
216 if (s->ifindex <= 0)
217 s->ifindex = i->ipi6_ifindex;
218@@ -155,7 +155,7 @@ static int dns_stream_identify(DnsStream
219 }
220
221 case IPV6_HOPLIMIT:
222- s->ttl = *(int *) CMSG_DATA(cmsg);
223+ s->ttl = *CMSG_TYPED_DATA(cmsg, int);
224 break;
225 }
226
227@@ -165,7 +165,7 @@ static int dns_stream_identify(DnsStream
228 switch (cmsg->cmsg_type) {
229
230 case IP_PKTINFO: {
231- struct in_pktinfo *i = (struct in_pktinfo*) CMSG_DATA(cmsg);
232+ struct in_pktinfo *i = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
233
234 if (s->ifindex <= 0)
235 s->ifindex = i->ipi_ifindex;
236@@ -173,7 +173,7 @@ static int dns_stream_identify(DnsStream
237 }
238
239 case IP_TTL:
240- s->ttl = *(int *) CMSG_DATA(cmsg);
241+ s->ttl = *CMSG_TYPED_DATA(cmsg, int);
242 break;
243 }
244 }
245--- a/src/resolve/resolved-manager.c
246+++ b/src/resolve/resolved-manager.c
247@@ -801,7 +801,7 @@ int manager_recv(Manager *m, int fd, Dns
248 switch (cmsg->cmsg_type) {
249
250 case IPV6_PKTINFO: {
251- struct in6_pktinfo *i = (struct in6_pktinfo*) CMSG_DATA(cmsg);
252+ struct in6_pktinfo *i = CMSG_TYPED_DATA(cmsg, struct in6_pktinfo);
253
254 if (p->ifindex <= 0)
255 p->ifindex = i->ipi6_ifindex;
256@@ -811,11 +811,11 @@ int manager_recv(Manager *m, int fd, Dns
257 }
258
259 case IPV6_HOPLIMIT:
260- p->ttl = *(int *) CMSG_DATA(cmsg);
261+ p->ttl = *CMSG_TYPED_DATA(cmsg, int);
262 break;
263
264 case IPV6_RECVFRAGSIZE:
265- p->fragsize = *(int *) CMSG_DATA(cmsg);
266+ p->fragsize = *CMSG_TYPED_DATA(cmsg, int);
267 break;
268 }
269 } else if (cmsg->cmsg_level == IPPROTO_IP) {
270@@ -824,7 +824,7 @@ int manager_recv(Manager *m, int fd, Dns
271 switch (cmsg->cmsg_type) {
272
273 case IP_PKTINFO: {
274- struct in_pktinfo *i = (struct in_pktinfo*) CMSG_DATA(cmsg);
275+ struct in_pktinfo *i = CMSG_TYPED_DATA(cmsg, struct in_pktinfo);
276
277 if (p->ifindex <= 0)
278 p->ifindex = i->ipi_ifindex;
279@@ -834,11 +834,11 @@ int manager_recv(Manager *m, int fd, Dns
280 }
281
282 case IP_TTL:
283- p->ttl = *(int *) CMSG_DATA(cmsg);
284+ p->ttl = *CMSG_TYPED_DATA(cmsg, int);
285 break;
286
287 case IP_RECVFRAGSIZE:
288- p->fragsize = *(int *) CMSG_DATA(cmsg);
289+ p->fragsize = *CMSG_TYPED_DATA(cmsg, int);
290 break;
291 }
292 }
293--- a/src/libsystemd/sd-device/device-monitor.c
294+++ b/src/libsystemd/sd-device/device-monitor.c
295@@ -503,7 +503,6 @@ int device_monitor_receive_device(sd_dev
296 .msg_name = &snl,
297 .msg_namelen = sizeof(snl),
298 };
299- struct cmsghdr *cmsg;
300 struct ucred *cred;
301 size_t offset;
302 ssize_t n;
303@@ -559,12 +558,11 @@ int device_monitor_receive_device(sd_dev
304 snl.nl.nl_pid);
305 }
306
307- cmsg = CMSG_FIRSTHDR(&smsg);
308- if (!cmsg || cmsg->cmsg_type != SCM_CREDENTIALS)
309+ cred = CMSG_FIND_DATA(&smsg, SOL_SOCKET, SCM_CREDENTIALS, struct ucred);
310+ if (!cred)
311 return log_monitor_errno(m, SYNTHETIC_ERRNO(EAGAIN),
312 "No sender credentials received, ignoring message.");
313
314- cred = (struct ucred*) CMSG_DATA(cmsg);
315 if (!check_sender_uid(m, cred->uid))
316 return log_monitor_errno(m, SYNTHETIC_ERRNO(EAGAIN),
317 "Sender uid="UID_FMT", message ignored.", cred->uid);
318--- a/src/udev/udev-ctrl.c
319+++ b/src/udev/udev-ctrl.c
320@@ -161,7 +161,6 @@ static int udev_ctrl_connection_event_ha
321 .msg_control = &control,
322 .msg_controllen = sizeof(control),
323 };
324- struct cmsghdr *cmsg;
325 struct ucred *cred;
326 ssize_t size;
327
328@@ -185,15 +184,12 @@ static int udev_ctrl_connection_event_ha
329
330 cmsg_close_all(&smsg);
331
332- cmsg = CMSG_FIRSTHDR(&smsg);
333-
334- if (!cmsg || cmsg->cmsg_type != SCM_CREDENTIALS) {
335+ cred = CMSG_FIND_DATA(&smsg, SOL_SOCKET, SCM_CREDENTIALS, struct ucred);
336+ if (!cred) {
337 log_error("No sender credentials received, ignoring message");
338 return 0;
339 }
340
341- cred = (struct ucred *) CMSG_DATA(cmsg);
342-
343 if (cred->uid != 0) {
344 log_error("Invalid sender uid "UID_FMT", ignoring message", cred->uid);
345 return 0;
diff --git a/meta/recipes-core/systemd/systemd_253.7.bb b/meta/recipes-core/systemd/systemd_254.bb
index 1fd4556afd..6ef148ac36 100644
--- a/meta/recipes-core/systemd/systemd_253.7.bb
+++ b/meta/recipes-core/systemd/systemd_254.bb
@@ -26,8 +26,6 @@ SRC_URI += " \
26 file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ 26 file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
27 file://0008-implment-systemd-sysv-install-for-OE.patch \ 27 file://0008-implment-systemd-sysv-install-for-OE.patch \
28 file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \ 28 file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
29 file://27254.patch \
30 file://27253.patch \
31 " 29 "
32 30
33# patches needed by musl 31# patches needed by musl
@@ -39,7 +37,6 @@ SRC_URI_MUSL = "\
39 file://0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ 37 file://0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
40 file://0013-add-missing-FTW_-macros-for-musl.patch \ 38 file://0013-add-missing-FTW_-macros-for-musl.patch \
41 file://0014-Use-uintmax_t-for-handling-rlim_t.patch \ 39 file://0014-Use-uintmax_t-for-handling-rlim_t.patch \
42 file://0015-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
43 file://0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ 40 file://0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
44 file://0017-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ 41 file://0017-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
45 file://0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ 42 file://0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
@@ -53,6 +50,9 @@ SRC_URI_MUSL = "\
53 file://0001-Adjust-for-musl-headers.patch \ 50 file://0001-Adjust-for-musl-headers.patch \
54 file://0006-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \ 51 file://0006-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
55 file://0003-errno-util-Make-STRERROR-portable-for-musl.patch \ 52 file://0003-errno-util-Make-STRERROR-portable-for-musl.patch \
53 file://0025-include-sys-file.h-for-LOCK_EX.patch \
54 file://0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch \
55 file://0027-include-missing-sys-file.h-for-LOCK_EX.patch \
56 " 56 "
57 57
58PAM_PLUGINS = " \ 58PAM_PLUGINS = " \
@@ -140,8 +140,7 @@ PACKAGECONFIG[default-compression-lz4] = "-Dlz4=true -Ddefault-compression=lz4,,
140PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz" 140PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz"
141PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd" 141PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd"
142PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" 142PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus"
143PACKAGECONFIG[efi] = "-Defi=true,-Defi=false" 143PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=true,-Defi=false -Dbootloader=false,python3-pyelftools"
144PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi"
145PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils" 144PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils"
146PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" 145PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
147PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false" 146PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false"
@@ -552,6 +551,7 @@ FILES:${PN}-extra-utils = "\
552 ${bindir}/systemd-stdio-bridge \ 551 ${bindir}/systemd-stdio-bridge \
553 ${base_bindir}/systemd-ask-password \ 552 ${base_bindir}/systemd-ask-password \
554 ${base_bindir}/systemd-tty-ask-password-agent \ 553 ${base_bindir}/systemd-tty-ask-password-agent \
554 ${base_sbindir}/mount.ddi \
555 ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \ 555 ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \
556 ${systemd_system_unitdir}/systemd-ask-password-console.path \ 556 ${systemd_system_unitdir}/systemd-ask-password-console.path \
557 ${systemd_system_unitdir}/systemd-ask-password-console.service \ 557 ${systemd_system_unitdir}/systemd-ask-password-console.service \
@@ -622,6 +622,8 @@ FILES:${PN} = " ${base_bindir}/* \
622 ${datadir}/polkit-1 \ 622 ${datadir}/polkit-1 \
623 ${datadir}/${BPN} \ 623 ${datadir}/${BPN} \
624 ${datadir}/factory \ 624 ${datadir}/factory \
625 ${sysconfdir}/credstore/ \
626 ${sysconfdir}/credstore.encrypted/ \
625 ${sysconfdir}/dbus-1/ \ 627 ${sysconfdir}/dbus-1/ \
626 ${sysconfdir}/modules-load.d/ \ 628 ${sysconfdir}/modules-load.d/ \
627 ${sysconfdir}/pam.d/ \ 629 ${sysconfdir}/pam.d/ \
@@ -650,6 +652,7 @@ FILES:${PN} = " ${base_bindir}/* \
650 ${bindir}/bootctl \ 652 ${bindir}/bootctl \
651 ${bindir}/oomctl \ 653 ${bindir}/oomctl \
652 ${bindir}/userdbctl \ 654 ${bindir}/userdbctl \
655 ${exec_prefix}/lib/credstore \
653 ${exec_prefix}/lib/tmpfiles.d/*.conf \ 656 ${exec_prefix}/lib/tmpfiles.d/*.conf \
654 ${exec_prefix}/lib/systemd \ 657 ${exec_prefix}/lib/systemd \
655 ${exec_prefix}/lib/modules-load.d \ 658 ${exec_prefix}/lib/modules-load.d \
@@ -685,6 +688,7 @@ RRECOMMENDS:${PN} += "systemd-extra-utils \
685 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \ 688 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
686 os-release \ 689 os-release \
687 systemd-conf \ 690 systemd-conf \
691 ${@bb.utils.contains('PACKAGECONFIG', 'logind', 'pam-plugin-umask', '', d)} \
688" 692"
689 693
690INSANE_SKIP:${PN} += "dev-so libdir" 694INSANE_SKIP:${PN} += "dev-so libdir"
@@ -708,6 +712,7 @@ FILES:udev += "${base_sbindir}/udevd \
708 ${rootlibexecdir}/udev/dmi_memory_id \ 712 ${rootlibexecdir}/udev/dmi_memory_id \
709 ${rootlibexecdir}/udev/fido_id \ 713 ${rootlibexecdir}/udev/fido_id \
710 ${rootlibexecdir}/udev/findkeyboards \ 714 ${rootlibexecdir}/udev/findkeyboards \
715 ${rootlibexecdir}/udev/iocost \
711 ${rootlibexecdir}/udev/keyboard-force-release.sh \ 716 ${rootlibexecdir}/udev/keyboard-force-release.sh \
712 ${rootlibexecdir}/udev/keymap \ 717 ${rootlibexecdir}/udev/keymap \
713 ${rootlibexecdir}/udev/mtd_probe \ 718 ${rootlibexecdir}/udev/mtd_probe \
@@ -719,6 +724,7 @@ FILES:udev += "${base_sbindir}/udevd \
719 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \ 724 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
720 ${rootlibexecdir}/udev/rules.d/60-block.rules \ 725 ${rootlibexecdir}/udev/rules.d/60-block.rules \
721 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \ 726 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \
727 ${rootlibexecdir}/udev/rules.d/60-dmi-id.rules \
722 ${rootlibexecdir}/udev/rules.d/60-drm.rules \ 728 ${rootlibexecdir}/udev/rules.d/60-drm.rules \
723 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \ 729 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
724 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \ 730 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
@@ -746,6 +752,7 @@ FILES:udev += "${base_sbindir}/udevd \
746 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \ 752 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \
747 ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \ 753 ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \
748 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \ 754 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \
755 ${rootlibexecdir}/udev/rules.d/90-iocost.rules \
749 ${rootlibexecdir}/udev/rules.d/README \ 756 ${rootlibexecdir}/udev/rules.d/README \
750 ${sysconfdir}/udev \ 757 ${sysconfdir}/udev \
751 ${sysconfdir}/init.d/systemd-udevd \ 758 ${sysconfdir}/init.d/systemd-udevd \
diff --git a/meta/recipes-extended/pam/libpam_1.5.3.bb b/meta/recipes-extended/pam/libpam_1.5.3.bb
index eafb5aae43..1aa307af4d 100644
--- a/meta/recipes-extended/pam/libpam_1.5.3.bb
+++ b/meta/recipes-extended/pam/libpam_1.5.3.bb
@@ -169,7 +169,7 @@ pkg_postinst:${PN}() {
169} 169}
170 170
171inherit features_check 171inherit features_check
172REQUIRED_DISTRO_FEATURES = "pam" 172ANY_OF_DISTRO_FEATURES = "pam systemd"
173 173
174BBCLASSEXTEND = "nativesdk native" 174BBCLASSEXTEND = "nativesdk native"
175 175