systemd: upgrade from 256.9 to 257

Patch changes:
* 0003-coredump-set-ProtectHome-to-read-only.patch is drop as it's a backported patch.
* 0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch is drop as
  AT_SYMLINK_NOFOLLOW has been supportd in musl.
* Other patches are either refreshed or changed to fit the current version.

systemd-boot changes:
* Use src/boot instead src/boot/efi in do_install and do_deploy. See upstream
  change 97318131fd06 (Rename src/boot/efi to just src/boot).

(From OE-Core rev: 4891f47cdaf919033bf1c02cc12e4805e5db99a0)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chen Qi
2024-12-17 15:37:51 +08:00
committed by Richard Purdie
parent 0cc6127cad
commit 4fe8c5de06
33 changed files with 604 additions and 566 deletions

View File

@@ -54,13 +54,13 @@ COMPATIBLE_HOST:x86-x32 = "null"
do_install() {
install -d ${D}${EFI_FILES_PATH}
install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
install ${B}/src/boot/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
}
do_deploy () {
install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR}
install ${B}/src/boot/systemd-boot*.efi ${DEPLOYDIR}
install ${B}/src/boot/linux*.efi.stub ${DEPLOYDIR}
install ${B}/src/boot/addon*.efi.stub ${DEPLOYDIR}
}
addtask deploy before do_build after do_compile

View File

@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
SRCREV = "f15fd96efd5ebdfb18746acb0cbb35a4331b4d8b"
SRCBRANCH = "v256-stable"
SRCREV = "70bae7648f2c18010187c9cf20093155eaa26029"
SRCBRANCH = "v257-stable"
SRC_URI = "git://github.com/systemd/systemd.git;protocol=https;branch=${SRCBRANCH}"
S = "${WORKDIR}/git"

View File

@@ -1,7 +1,7 @@
From ca94c86736ca7917e6c50d09d6c6ba56ba139709 Mon Sep 17 00:00:00 2001
From e5fd143f215f072404c544f694cb026a4231503e Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 21 Feb 2019 16:23:24 +0800
Subject: [PATCH 01/27] binfmt: Don't install dependency links at install time
Subject: [PATCH 01/26] binfmt: Don't install dependency links at install time
for the binfmt services
use [Install] blocks so that they get created when the service is enabled
@@ -25,7 +25,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/units/meson.build b/units/meson.build
index b231341a1f..b613a188a4 100644
index 96f4852741..0a3a4fee67 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -156,7 +156,6 @@ units = [
@@ -75,5 +75,5 @@ index 318bf8efc2..6ef684861d 100644
+[Install]
+WantedBy=sysinit.target
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 40ae40de3db990a7e56694f24fc625b1b71a98f7 Mon Sep 17 00:00:00 2001
From fab8c573d06340868f070446118673b1c23584c5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 5 Sep 2015 06:31:47 +0000
Subject: [PATCH 02/27] implment systemd-sysv-install for OE
Subject: [PATCH 02/26] implment systemd-sysv-install for OE
Use update-rc.d for enabling/disabling and status command
to check the status of the sysv service
@@ -39,5 +39,5 @@ index cb58d8243b..000bdf6165 100755
*)
usage ;;
--
2.45.1
2.34.1

View File

@@ -1,38 +0,0 @@
From 4ac1755be2d6c141fae7e57c42936e507c5b54e3 Mon Sep 17 00:00:00 2001
From: Etienne Cordonnier <ecordonnier@snap.com>
Date: Fri, 6 Sep 2024 10:36:28 +0200
Subject: [PATCH] coredump: set ProtectHome to read-only
In https://github.com/systemd/systemd/pull/5283/commits/924453c22599cc246746a0233b2f52a27ade0819
ProtectHome was set to true for systemd-coredump in order to reduce risk, since an attacker could craft a malicious binary in order to compromise systemd-coredump.
At that point the object analysis was done in the main systemd-coredump process.
Because of this systemd-coredump is unable to product symbolicated call-stacks for binaries running under /home ("n/a" is shown instead of function names).
However, later in https://github.com/systemd/systemd/commit/61aea456c12c54f49c4a76259af130e576130ce9 systemd-coredump was changed to do the object analysis in a forked process,
covering those security concerns.
Let's set ProtectHome to read-only so that systemd-coredump produces symbolicated call-stacks for processes running under /home.
Upstream-Status: Backport [https://github.com/systemd/systemd/commit/4ac1755be2d6c141fae7e57c42936e507c5b54e3]
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
---
units/systemd-coredump@.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-coredump@.service.in b/units/systemd-coredump@.service.in
index 012c60d2f6..fa3206d07b 100644
--- a/units/systemd-coredump@.service.in
+++ b/units/systemd-coredump@.service.in
@@ -28,7 +28,7 @@ PrivateDevices=yes
PrivateNetwork=yes
PrivateTmp=yes
ProtectControlGroups=yes
-ProtectHome=yes
+ProtectHome=read-only
ProtectHostname=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
--
2.43.0

View File

@@ -1,7 +1,7 @@
From 34b7e1ed3b9a896db6fad435fd141c385c7337d1 Mon Sep 17 00:00:00 2001
From f99ef6c4407b56e8d15455fe27eb732ada87215b Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 25 Feb 2019 13:55:12 +0800
Subject: [PATCH 04/27] missing_type.h: add comparison_fn_t
Subject: [PATCH 03/26] missing_type.h: add comparison_fn_t
Make it work with musl where comparison_fn_t and is not provided.
@@ -45,7 +45,7 @@ index 9c818bd747..ef10c8be2c 100644
/* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
* external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
index a0b673f65f..29dd2fee16 100644
index 7dcc35d8d5..87b8d6aad6 100644
--- a/src/libsystemd/sd-journal/catalog.c
+++ b/src/libsystemd/sd-journal/catalog.c
@@ -29,6 +29,7 @@
@@ -57,5 +57,5 @@ index a0b673f65f..29dd2fee16 100644
const char * const catalog_file_dirs[] = {
"/usr/local/lib/systemd/catalog/",
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 4a4005583e2debe491850229aa5ae2a97770532d Mon Sep 17 00:00:00 2001
From 34fe809cf686c1a81db5f3f027e33fece350ba0b Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Sat, 22 May 2021 20:26:24 +0200
Subject: [PATCH 05/27] add fallback parse_printf_format implementation
Subject: [PATCH 04/26] add fallback parse_printf_format implementation
Upstream-Status: Inappropriate [musl specific]
@@ -22,22 +22,22 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
create mode 100644 src/basic/parse-printf-format.h
diff --git a/meson.build b/meson.build
index 52723bef09..e20bf3af8a 100644
index bffda86845..4146f4beef 100644
--- a/meson.build
+++ b/meson.build
@@ -753,6 +753,7 @@ foreach header : ['crypt.h',
@@ -773,6 +773,7 @@ foreach header : ['crypt.h',
'linux/ioprio.h',
'linux/memfd.h',
'linux/time_types.h',
'linux/vm_sockets.h',
+ 'printf.h',
'sys/auxv.h',
'sys/sdt.h',
'threads.h',
diff --git a/src/basic/meson.build b/src/basic/meson.build
index 9a214575a5..b49b6ade56 100644
index e02f787c75..9435df895d 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
@@ -189,6 +189,11 @@ endforeach
@@ -188,6 +188,11 @@ endforeach
basic_sources += generated_gperf_headers
@@ -430,5 +430,5 @@ index 7d02b57d7b..75e8e08add 100644
#define SNDBUF_SIZE (8*1024*1024)
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From ed836c3478e1193e99e37d50db96d124796a3322 Mon Sep 17 00:00:00 2001
From d368a0317c747961f69a455a09a3de3fd13410a2 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 25 Feb 2019 14:56:21 +0800
Subject: [PATCH 06/27] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not
Subject: [PATCH 05/26] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not
defined
If the standard library doesn't provide brace
@@ -115,7 +115,7 @@ index 49d71f15c7..0a49ebcc17 100644
(void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 807925f199..b4f86fc611 100644
index 86bf16356d..da552dbaab 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -73,6 +73,12 @@
@@ -131,7 +131,7 @@ index 807925f199..b4f86fc611 100644
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
* them in the file system. This is intended to be used to create
* properly owned directories beneath /tmp, /var/tmp, /run, which are
@@ -2570,7 +2576,9 @@ finish:
@@ -2573,7 +2579,9 @@ finish:
static int glob_item(Context *c, Item *i, action_t action) {
_cleanup_globfree_ glob_t g = {
@@ -141,7 +141,7 @@ index 807925f199..b4f86fc611 100644
};
int r;
@@ -2598,7 +2606,9 @@ static int glob_item_recursively(
@@ -2601,7 +2609,9 @@ static int glob_item_recursively(
fdaction_t action) {
_cleanup_globfree_ glob_t g = {
@@ -152,5 +152,5 @@ index 807925f199..b4f86fc611 100644
int r;
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 8320725f1a9088623da8753c7077473b98a63107 Mon Sep 17 00:00:00 2001
From 54b6e10aea2b0fb52782c3a71f06654a89b46bff Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 25 Feb 2019 15:00:06 +0800
Subject: [PATCH 07/27] add missing FTW_ macros for musl
Subject: [PATCH 06/26] add missing FTW_ macros for musl
This is to avoid build failures like below for musl.
@@ -40,5 +40,5 @@ index 8684d064ec..70fc2b5376 100644
static char **list_nftw = NULL;
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 41abe1a4136babfe5df63e9561dcf29d3c8fe6e9 Mon Sep 17 00:00:00 2001
From 85d8c4c27e855d54c1740902a836c8f2aea9bebc Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 25 Feb 2019 15:12:41 +0800
Subject: [PATCH 08/27] Use uintmax_t for handling rlim_t
Subject: [PATCH 07/26] Use uintmax_t for handling rlim_t
PRIu{32,64} is not right format to represent rlim_t type
therefore use %ju and typecast the rlim_t variables to
@@ -27,10 +27,10 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
3 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/basic/format-util.h b/src/basic/format-util.h
index ba7cff6a8b..2736abb07b 100644
index b528c005ca..41c4c095be 100644
--- a/src/basic/format-util.h
+++ b/src/basic/format-util.h
@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
@@ -41,13 +41,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
# error Unknown timex member size
#endif
@@ -86,10 +86,10 @@ index a9f7b87f28..059c67731d 100644
return 1;
}
diff --git a/src/core/execute.c b/src/core/execute.c
index 513e95e09d..0e269617f8 100644
index 3d55b0b772..4824ff159e 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
@@ -1162,9 +1162,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
for (unsigned i = 0; i < RLIM_NLIMITS; i++)
if (c->rlimit[i]) {
fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
@@ -102,5 +102,5 @@ index 513e95e09d..0e269617f8 100644
if (c->ioprio_set) {
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From ea8e85d92f67a7af8577a4ce7c67c7aaee65d10c Mon Sep 17 00:00:00 2001
From f4cd939c7cc1ce0a59bab2693768f2c95d9ced00 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 27 May 2018 08:36:44 -0700
Subject: [PATCH 10/27] Define glibc compatible basename() for non-glibc
Subject: [PATCH 08/26] Define glibc compatible basename() for non-glibc
systems
Fixes builds with musl, even though systemd is adamant about
@@ -15,10 +15,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 4 insertions(+)
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
index ff5efbcf55..d1a6bb0e76 100644
index cc6aa183c0..0b035125cd 100644
--- a/src/basic/string-util.h
+++ b/src/basic/string-util.h
@@ -26,6 +26,10 @@
@@ -27,6 +27,10 @@
#define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */
#define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */
@@ -30,5 +30,5 @@ index ff5efbcf55..d1a6bb0e76 100644
if (!haystack || !needle)
return NULL;
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 7c8634c441401b034cd4bcf4b916a7042076fca8 Mon Sep 17 00:00:00 2001
From 6959db351fdd551d46e22667deec6032552b2662 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Wed, 4 Jul 2018 15:00:44 +0800
Subject: [PATCH 11/27] Do not disable buffering when writing to oom_score_adj
Subject: [PATCH 09/26] Do not disable buffering when writing to oom_score_adj
On musl, disabling buffering when writing to oom_score_adj will
cause the following error.
@@ -24,10 +24,10 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index c9d968dee0..7d6d3ce7db 100644
index 3253a9c3fb..772c4082a1 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -1816,7 +1816,7 @@ int set_oom_score_adjust(int value) {
@@ -1848,7 +1848,7 @@ int set_oom_score_adjust(int value) {
xsprintf(t, "%i", value);
return write_string_file("/proc/self/oom_score_adj", t,
@@ -37,5 +37,5 @@ index c9d968dee0..7d6d3ce7db 100644
int get_oom_score_adjust(int *ret) {
--
2.45.1
2.34.1

View File

@@ -1,99 +0,0 @@
From 8af5d1e3c0dc7e71f7a4aee0f539a5d772d47354 Mon Sep 17 00:00:00 2001
From: Andre McCurdy <armccurdy@gmail.com>
Date: Tue, 10 Oct 2017 14:33:30 -0700
Subject: [PATCH 09/27] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right
thing to do and it's not portable (not supported by musl). See:
http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
http://www.openwall.com/lists/musl/2015/02/05/2
Note that laccess() is never passing AT_EACCESS so a lot of the
discussion in the links above doesn't apply. Note also that
(currently) all systemd callers of laccess() pass mode as F_OK, so
only check for existence of a file, not access permissions.
Therefore, in this case, the only distiction between faccessat()
with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour
for broken symlinks; laccess() on a broken symlink will succeed with
(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
The laccess() macros was added to systemd some time ago and it's not
clear if or why it needs to return success for broken symlinks. Maybe
just historical and not actually necessary or desired behaviour?
Upstream-Status: Inappropriate [musl specific]
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
---
src/basic/fs-util.h | 21 ++++++++++++++++++++-
src/shared/base-filesystem.c | 6 +++---
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
index 3e2db95304..d5747416b0 100644
--- a/src/basic/fs-util.h
+++ b/src/basic/fs-util.h
@@ -49,8 +49,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
int fd_warn_permissions(const char *path, int fd);
int stat_warn_permissions(const char *path, const struct stat *st);
+/*
+ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to
+ do and it's not portable (not supported by musl). See:
+
+ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
+ http://www.openwall.com/lists/musl/2015/02/05/2
+
+ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in
+ the links above doesn't apply. Note also that (currently) all systemd callers
+ of laccess() pass mode as F_OK, so only check for existence of a file, not
+ access permissions. Therefore, in this case, the only distiction between
+ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the
+ behaviour for broken symlinks; laccess() on a broken symlink will succeed
+ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
+
+ The laccess() macros was added to systemd some time ago and it's not clear if
+ or why it needs to return success for broken symlinks. Maybe just historical
+ and not actually necessary or desired behaviour?
+*/
#define laccess(path, mode) \
- RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW))
+ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0))
int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index a4e2dae245..67aa8ea1f2 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -145,7 +145,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
/* The "root" parameter is decoration only it's only used as part of log messages */
for (size_t i = 0; i < ELEMENTSOF(table); i++) {
- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0)
continue;
if (table[i].target) { /* Create as symlink? */
@@ -153,7 +153,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
/* check if one of the targets exists */
NULSTR_FOREACH(s, table[i].target) {
- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
+ if (faccessat(fd, s, F_OK, 0) < 0)
continue;
/* check if a specific file exists at the target path */
@@ -164,7 +164,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
if (!p)
return log_oom();
- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
+ if (faccessat(fd, p, F_OK, 0) < 0)
continue;
}
--
2.45.1

View File

@@ -1,7 +1,7 @@
From 4a2df0bba1741914617ca1271e2bc68a5d9e5dac Mon Sep 17 00:00:00 2001
From b7f6c245b4ae72999f23eecc2bbb6d6fb8db667c Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 10 Jul 2018 15:40:17 +0800
Subject: [PATCH 12/27] distinguish XSI-compliant strerror_r from GNU-specifi
Subject: [PATCH 10/26] distinguish XSI-compliant strerror_r from GNU-specifi
strerror_r
XSI-compliant strerror_r and GNU-specifi strerror_r are different.
@@ -24,10 +24,10 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
index f415797700..a5c6e9a3bd 100644
index 58c24d25c0..69a0d09d42 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
@@ -405,7 +405,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
return;
errno = 0;
@@ -40,7 +40,7 @@ index f415797700..a5c6e9a3bd 100644
if (errno == ERANGE || strlen(x) >= k - 1) {
free(m);
k *= 2;
@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
@@ -590,8 +595,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
if (e && e->message)
return e->message;
@@ -72,5 +72,5 @@ index 75e8e08add..41e5c7c2b8 100644
char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 846b8f16cf07d9187261e06701a75eb208caa707 Mon Sep 17 00:00:00 2001
From 43b0269e850a2fbcb6ca615258aa8f8a9b4f6a9d Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 25 Feb 2019 15:44:54 +0800
Subject: [PATCH 13/27] avoid redefinition of prctl_mm_map structure
Subject: [PATCH 11/26] avoid redefinition of prctl_mm_map structure
Fix the following compile failure:
error: redefinition of 'struct prctl_mm_map'
@@ -28,5 +28,5 @@ index 2c9f9f6c50..65a984b564 100644
#include "macro.h"
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 88694101bcac461c39049962ce97ce579cc07e13 Mon Sep 17 00:00:00 2001
From eaf26fdad00448b8cd336eb5db51e0baa8d8e588 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Fri, 1 Mar 2019 15:22:15 +0800
Subject: [PATCH 14/27] do not disable buffer in writing files
Date: Mon, 16 Dec 2024 14:37:25 +0800
Subject: [PATCH 12/26] do not disable buffer in writing files
Do not disable buffer in writing files, otherwise we get
failure at boot for musl like below.
@@ -22,35 +22,34 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
[rebased for systemd 255.1]
---
src/basic/cgroup-util.c | 12 ++++++------
src/basic/cgroup-util.c | 4 ++--
src/basic/namespace-util.c | 4 ++--
src/basic/procfs-util.c | 4 ++--
src/basic/sysctl-util.c | 2 +-
src/binfmt/binfmt.c | 6 +++---
src/core/cgroup.c | 2 +-
src/core/ipe-setup.c | 2 +-
src/core/main.c | 2 +-
src/core/smack-setup.c | 8 ++++----
src/core/smack-setup.c | 6 +++---
src/home/homework.c | 2 +-
src/libsystemd/sd-device/sd-device.c | 2 +-
src/nspawn/nspawn-cgroup.c | 2 +-
src/nspawn/nspawn.c | 6 +++---
src/shared/binfmt-util.c | 2 +-
src/shared/cgroup-setup.c | 6 +++---
src/shared/coredump-util.c | 4 ++--
src/shared/cgroup-setup.c | 12 ++++++------
src/shared/coredump-util.c | 2 +-
src/shared/hibernate-util.c | 4 ++--
src/shared/smack-util.c | 2 +-
src/shared/watchdog.c | 2 +-
src/sleep/sleep.c | 4 ++--
src/sleep/sleep.c | 2 +-
src/storagetm/storagetm.c | 24 ++++++++++++------------
src/udev/udev-rules.c | 1 -
src/vconsole/vconsole-setup.c | 2 +-
22 files changed, 51 insertions(+), 52 deletions(-)
21 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 553ee6075a..a3704baf6a 100644
index 309dccb45a..7aec5072a0 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -457,7 +457,7 @@ int cg_kill_kernel_sigkill(const char *path) {
@@ -495,7 +495,7 @@ int cg_kill_kernel_sigkill(const char *path) {
if (r < 0)
return r;
@@ -59,43 +58,7 @@ index 553ee6075a..a3704baf6a 100644
if (r < 0)
return log_debug_errno(r, "Failed to write to cgroup.kill for cgroup '%s': %m", path);
@@ -885,7 +885,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
sc = strstrip(contents);
if (isempty(sc)) {
- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, agent, 0);
if (r < 0)
return r;
} else if (!path_equal(sc, agent))
@@ -903,7 +903,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
sc = strstrip(contents);
if (streq(sc, "0")) {
- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, "1", 0);
if (r < 0)
return r;
@@ -930,7 +930,7 @@ int cg_uninstall_release_agent(const char *controller) {
if (r < 0)
return r;
- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, "0", 0);
if (r < 0)
return r;
@@ -940,7 +940,7 @@ int cg_uninstall_release_agent(const char *controller) {
if (r < 0)
return r;
- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, "", 0);
if (r < 0)
return r;
@@ -1833,7 +1833,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
@@ -1721,7 +1721,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
if (r < 0)
return r;
@@ -105,10 +68,10 @@ index 553ee6075a..a3704baf6a 100644
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
index 5b4e43f921..42a84ded55 100644
index 332e8cdfd5..804498127d 100644
--- a/src/basic/namespace-util.c
+++ b/src/basic/namespace-util.c
@@ -325,12 +325,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
@@ -354,12 +354,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
freeze();
xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
@@ -144,15 +107,15 @@ index d7cfcd9105..58fb5918a3 100644
uint64_t threads_max;
diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
index 9a1933f579..7d6fc65ee1 100644
index 2feb4917d7..4c74620a00 100644
--- a/src/basic/sysctl-util.c
+++ b/src/basic/sysctl-util.c
@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) {
log_debug("Setting '%s' to '%s'", p, value);
@@ -97,7 +97,7 @@ int sysctl_write_full(const char *property, const char *value, Hashmap **shadow)
if (r < 0)
return r;
- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0 | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
}
int sysctl_writef(const char *property, const char *format, ...) {
@@ -188,23 +151,36 @@ index d21f3f79ff..258607cc7e 100644
log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
else
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 34fd2a250c..cb1a6d01eb 100644
index 6933aae54d..ab6fccc0e4 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -5173,7 +5173,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
freezer_state_to_string(u->freezer_state),
freezer_state_to_string(next));
- r = write_string_file(path, one_zero(target == FREEZER_FROZEN), WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(path, one_zero(target == FREEZER_FROZEN), 0);
@@ -5167,7 +5167,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
if (r < 0)
return r;
- r = write_string_file(path, one_zero(objective == FREEZER_FROZEN), WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(path, one_zero(objective == FREEZER_FROZEN), 0);
if (r < 0)
return r;
diff --git a/src/core/ipe-setup.c b/src/core/ipe-setup.c
index 4648d43829..80d03d87d4 100644
--- a/src/core/ipe-setup.c
+++ b/src/core/ipe-setup.c
@@ -94,7 +94,7 @@ int ipe_setup(void) {
if (!activate_path)
return log_oom();
- r = write_string_file(activate_path, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(activate_path, "1", 0);
if (r == -ESTALE) {
log_debug_errno(r,
"IPE policy %s is already loaded with a version that is equal or higher, skipping.",
diff --git a/src/core/main.c b/src/core/main.c
index 4b8a315d86..051a31ba84 100644
index 172742c769..e68ce2a6d8 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1789,7 +1789,7 @@ static void initialize_core_pattern(bool skip_setup) {
@@ -1812,7 +1812,7 @@ static void initialize_core_pattern(bool skip_setup) {
if (getpid_cached() != 1)
return;
@@ -214,7 +190,7 @@ index 4b8a315d86..051a31ba84 100644
log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
arg_early_core_pattern);
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index 7ea902b6f9..1aef2988d0 100644
index 7ea902b6f9..ee4cd56023 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -321,17 +321,17 @@ int mac_smack_setup(bool *loaded_policy) {
@@ -230,8 +206,7 @@ index 7ea902b6f9..1aef2988d0 100644
if (r < 0)
log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
r = write_string_file("/sys/fs/smackfs/netlabel",
- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
"0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
@@ -240,24 +215,23 @@ index 7ea902b6f9..1aef2988d0 100644
log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
#endif
diff --git a/src/home/homework.c b/src/home/homework.c
index 482db23dbc..ed6b8d271f 100644
index 00e74894b3..7457113efe 100644
--- a/src/home/homework.c
+++ b/src/home/homework.c
@@ -302,8 +302,8 @@ static void drop_caches_now(void) {
/* Drop file system caches now. See https://docs.kernel.org/admin-guide/sysctl/vm.html
@@ -304,7 +304,7 @@ static void drop_caches_now(void) {
* for details. We write "3" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
* not more. */
+ r = write_string_file("/proc/sys/vm/drop_caches", "3\n", 0);
- r = write_string_file("/proc/sys/vm/drop_caches", "3\n", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file("/proc/sys/vm/drop_caches", "3\n", 0);
if (r < 0)
log_warning_errno(r, "Failed to drop caches, ignoring: %m");
else
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index d8d151835c..268cb65ec7 100644
index 01fa90b1ff..83ab655bf4 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -2499,7 +2499,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
@@ -2563,7 +2563,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
if (!value)
return -ENOMEM;
@@ -267,7 +241,7 @@ index d8d151835c..268cb65ec7 100644
/* On failure, clear cache entry, as we do not know how it fails. */
device_remove_cached_sysattr_value(device, sysattr);
diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
index 4f28b4a225..c93c2c33b5 100644
index 4f28b4a225..c899c218b2 100644
--- a/src/nspawn/nspawn-cgroup.c
+++ b/src/nspawn/nspawn-cgroup.c
@@ -93,7 +93,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
@@ -275,15 +249,15 @@ index 4f28b4a225..c93c2c33b5 100644
sprintf(pid_string, PID_FMT, pid);
- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
+ r = write_string_file(fn, pid_string, 0|WRITE_STRING_FILE_MKDIR_0755);
if (r < 0) {
log_error_errno(r, "Failed to move process: %m");
goto finish;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 5842d3ba8f..44ff9d946c 100644
index 500725d35f..745b6815db 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2741,7 +2741,7 @@ static int reset_audit_loginuid(void) {
@@ -2857,7 +2857,7 @@ static int reset_audit_loginuid(void) {
if (streq(p, "4294967295"))
return 0;
@@ -292,7 +266,7 @@ index 5842d3ba8f..44ff9d946c 100644
if (r < 0) {
log_error_errno(r,
"Failed to reset audit login UID. This probably means that your kernel is too\n"
@@ -4450,7 +4450,7 @@ static int setup_uid_map(
@@ -4588,7 +4588,7 @@ static int setup_uid_map(
return log_oom();
xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
@@ -301,7 +275,7 @@ index 5842d3ba8f..44ff9d946c 100644
if (r < 0)
return log_error_errno(r, "Failed to write UID map: %m");
@@ -4460,7 +4460,7 @@ static int setup_uid_map(
@@ -4598,7 +4598,7 @@ static int setup_uid_map(
return log_oom();
xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
@@ -324,10 +298,10 @@ index a26175474b..1413a9c72c 100644
return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");
diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
index 093b6d0d22..89d0ac612b 100644
index 49d40f60d8..0f4aa8512a 100644
--- a/src/shared/cgroup-setup.c
+++ b/src/shared/cgroup-setup.c
@@ -364,7 +364,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
@@ -369,7 +369,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
xsprintf(c, PID_FMT "\n", pid);
@@ -336,7 +310,7 @@ index 093b6d0d22..89d0ac612b 100644
if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0)
/* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
return -EUCLEAN;
@@ -395,7 +395,7 @@ int cg_fd_attach(int fd, pid_t pid) {
@@ -399,7 +399,7 @@ int cg_fd_attach(int fd, pid_t pid) {
xsprintf(c, PID_FMT "\n", pid);
@@ -345,28 +319,46 @@ index 093b6d0d22..89d0ac612b 100644
}
int cg_attach_fallback(const char *controller, const char *path, pid_t pid) {
@@ -974,7 +974,7 @@ int cg_enable_everywhere(
return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
}
@@ -1049,7 +1049,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
sc = strstrip(contents);
if (isempty(sc)) {
- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, agent, 0);
if (r < 0)
return r;
} else if (!path_equal(sc, agent))
@@ -1067,7 +1067,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
sc = strstrip(contents);
if (streq(sc, "0")) {
- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, "1", 0);
if (r < 0)
return r;
@@ -1094,7 +1094,7 @@ int cg_uninstall_release_agent(const char *controller) {
if (r < 0)
return r;
- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, "0", 0);
if (r < 0)
return r;
@@ -1104,7 +1104,7 @@ int cg_uninstall_release_agent(const char *controller) {
if (r < 0)
return r;
- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file(fs, "", 0);
if (r < 0)
return r;
- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_stream(f, s, 0);
if (r < 0) {
log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
index 805503f366..01a7ccb291 100644
index 805503f366..3234a1d76e 100644
--- a/src/shared/coredump-util.c
+++ b/src/shared/coredump-util.c
@@ -163,7 +163,7 @@ int set_coredump_filter(uint64_t value) {
xsprintf(t, "0x%"PRIx64, value);
return write_string_file("/proc/self/coredump_filter", t,
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
+ 0);
}
/* Turn off core dumps but only if we're running outside of a container. */
@@ -173,7 +173,7 @@ void disable_coredumps(void) {
if (detect_container() > 0)
return;
@@ -377,7 +369,7 @@ index 805503f366..01a7ccb291 100644
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}
diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c
index 7c21157580..06ab74b04c 100644
index 1213fdc2c7..4c26e6a4ee 100644
--- a/src/shared/hibernate-util.c
+++ b/src/shared/hibernate-util.c
@@ -495,7 +495,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
@@ -399,7 +391,7 @@ index 7c21157580..06ab74b04c 100644
return log_error_errno(r,
"Failed to write device '%s' (%s) to /sys/power/resume: %m",
diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
index 1f88e724d0..feb18b320a 100644
index d0a79b2635..0c82d9943a 100644
--- a/src/shared/smack-util.c
+++ b/src/shared/smack-util.c
@@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
@@ -411,33 +403,11 @@ index 1f88e724d0..feb18b320a 100644
if (r < 0)
return r;
diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c
index 810c5b5206..be0d127ff3 100644
--- a/src/shared/watchdog.c
+++ b/src/shared/watchdog.c
@@ -93,7 +93,7 @@ static int watchdog_set_pretimeout_governor(const char *governor) {
r = write_string_file(sys_fn,
governor,
- WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
if (r < 0)
return log_error_errno(r, "Failed to set watchdog pretimeout_governor to '%s': %m", governor);
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 0402bb07f3..a6cbb45340 100644
index 181bb4ccef..2dbb3f4bc6 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -139,7 +139,7 @@ static int write_state(int fd, char * const *states) {
if (k < 0)
return RET_GATHER(r, k);
- k = write_string_stream(f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
+ k = write_string_stream(f, *state, 0);
if (k >= 0) {
log_debug("Using sleep state '%s'.", *state);
return 0;
@@ -157,7 +157,7 @@ static int write_mode(const char *path, char * const *modes) {
@@ -158,7 +158,7 @@ static int write_mode(const char *path, char * const *modes) {
assert(path);
STRV_FOREACH(mode, modes) {
@@ -447,10 +417,10 @@ index 0402bb07f3..a6cbb45340 100644
log_debug("Using sleep mode '%s' for %s.", *mode, path);
return 0;
diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c
index 1bb8eec316..cf9b4c4a21 100644
index ca8e886d37..5c27c54f09 100644
--- a/src/storagetm/storagetm.c
+++ b/src/storagetm/storagetm.c
@@ -186,7 +186,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) {
@@ -197,7 +197,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) {
if (!enable_fn)
return log_oom();
@@ -459,7 +429,7 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
log_warning_errno(r, "Failed to disable namespace '%s' of NVME subsystem '%s', ignoring: %m", e->d_name, s->name);
@@ -254,7 +254,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
@@ -265,7 +265,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
_cleanup_free_ char *truncated = strndup(w, 40); /* kernel refuses more than 40 chars (as per nvme spec) */
/* The default string stored in 'attr_model' is "Linux" btw. */
@@ -468,7 +438,7 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", w);
}
@@ -268,7 +268,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
@@ -279,7 +279,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
return log_oom();
/* The default string stored in 'attr_firmware' is `uname -r` btw, but truncated to 8 chars. */
@@ -477,7 +447,7 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", truncated);
}
@@ -295,7 +295,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
@@ -306,7 +306,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
if (!truncated)
return log_oom();
@@ -486,7 +456,7 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
log_warning_errno(r, "Failed to set serial of subsystem to '%s', ignoring: %m", truncated);
}
@@ -345,7 +345,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co
@@ -356,7 +356,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co
id = id128_digest(j, l);
}
@@ -495,7 +465,7 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
log_warning_errno(r, "Failed to set uuid of namespace to '%s', ignoring: %m", SD_ID128_TO_UUID_STRING(id));
@@ -408,7 +408,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
@@ -419,7 +419,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
if (subsystem_fd < 0)
return log_error_errno(subsystem_fd, "Failed to create NVME subsystem '%s': %m", j);
@@ -504,7 +474,7 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
return log_error_errno(r, "Failed to set 'attr_allow_any_host' flag: %m");
@@ -423,11 +423,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
@@ -434,11 +434,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
/* We use /proc/$PID/fd/$FD rather than /proc/self/fd/$FD, because this string is visible to others
* via configfs, and by including the PID it's clear to who the stuff belongs. */
@@ -518,7 +488,7 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
return log_error_errno(r, "Failed to write 'enable' attribute: %m");
@@ -557,19 +557,19 @@ static int nvme_port_add_portnr(
@@ -568,19 +568,19 @@ static int nvme_port_add_portnr(
return 0;
}
@@ -542,18 +512,6 @@ index 1bb8eec316..cf9b4c4a21 100644
if (r < 0)
return log_error_errno(r, "Failed to set IP address on NVME port %" PRIu16 ": %m", portnr);
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 581bbaf345..cdf648a2d1 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2706,7 +2706,6 @@ static int udev_rule_apply_token_to_event(
log_event_debug(dev, token, "Writing ATTR{'%s'}=\"%s\".", buf, value);
r = write_string_file(buf, value,
WRITE_STRING_FILE_VERIFY_ON_FAILURE |
- WRITE_STRING_FILE_DISABLE_BUFFER |
WRITE_STRING_FILE_AVOID_NEWLINE |
WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
if (r < 0)
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index ba742dda69..6f20e81615 100644
--- a/src/vconsole/vconsole-setup.c
@@ -568,5 +526,5 @@ index ba742dda69..6f20e81615 100644
return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From c1cbec8571855b8480d56dcad2ab81aea0782bd4 Mon Sep 17 00:00:00 2001
From ab4fda874b26542de96720db58cb0e8704a40108 Mon Sep 17 00:00:00 2001
From: Scott Murray <scott.murray@konsulko.com>
Date: Fri, 13 Sep 2019 19:26:27 -0400
Subject: [PATCH 15/27] Handle __cpu_mask usage
Subject: [PATCH 13/26] Handle __cpu_mask usage
Fixes errors:
@@ -24,7 +24,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
index 618fe1b0a3..46c92077b0 100644
index 2c477d8a01..c026ce77a6 100644
--- a/src/shared/cpu-set-util.h
+++ b/src/shared/cpu-set-util.h
@@ -6,6 +6,8 @@
@@ -56,5 +56,5 @@ index ea0c58770e..b65c0bd370 100644
/* Print information about various types. Useful when diagnosing
* gcc diagnostics on an unfamiliar architecture. */
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 8b540d8240bbc3f917de9ca8d3b62f28c3424d91 Mon Sep 17 00:00:00 2001
From c5165f6adf8a9cfe8c0784c598b87d7d7e8b7d1a Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alex.kiernan@gmail.com>
Date: Tue, 10 Mar 2020 11:05:20 +0000
Subject: [PATCH 16/27] Handle missing gshadow
Subject: [PATCH 14/26] Handle missing gshadow
gshadow usage is now present in the userdb code. Mask all uses of it to
allow compilation on musl
@@ -17,7 +17,7 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
index ffb5721466..4d01815c8c 100644
index 9223a2e6ca..f9eb1a5b64 100644
--- a/src/shared/user-record-nss.c
+++ b/src/shared/user-record-nss.c
@@ -286,8 +286,10 @@ int nss_group_to_group_record(
@@ -45,9 +45,9 @@ index ffb5721466..4d01815c8c 100644
}
+#endif
r = json_build(&g->json, JSON_BUILD_OBJECT(
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
@@ -344,6 +348,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
r = sd_json_buildo(
&g->json,
@@ -345,6 +349,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
assert(ret_sgrp);
assert(ret_buffer);
@@ -55,7 +55,7 @@ index ffb5721466..4d01815c8c 100644
for (;;) {
_cleanup_free_ char *buf = NULL;
struct sgrp sgrp, *result;
@@ -372,6 +377,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
@@ -373,6 +378,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
buflen *= 2;
buf = mfree(buf);
}
@@ -65,7 +65,7 @@ index ffb5721466..4d01815c8c 100644
}
int nss_group_record_by_name(
@@ -382,7 +390,9 @@ int nss_group_record_by_name(
@@ -383,7 +391,9 @@ int nss_group_record_by_name(
_cleanup_free_ char *sbuf = NULL;
_cleanup_free_ struct group *result = NULL;
bool incomplete = false;
@@ -75,7 +75,7 @@ index ffb5721466..4d01815c8c 100644
int r;
assert(name);
@@ -391,6 +401,7 @@ int nss_group_record_by_name(
@@ -392,6 +402,7 @@ int nss_group_record_by_name(
if (r < 0)
return r;
@@ -83,7 +83,7 @@ index ffb5721466..4d01815c8c 100644
if (with_shadow) {
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
if (r < 0) {
@@ -402,6 +413,9 @@ int nss_group_record_by_name(
@@ -403,6 +414,9 @@ int nss_group_record_by_name(
incomplete = true;
r = nss_group_to_group_record(result, sresult, ret);
@@ -93,7 +93,7 @@ index ffb5721466..4d01815c8c 100644
if (r < 0)
return r;
@@ -418,13 +432,16 @@ int nss_group_record_by_gid(
@@ -419,13 +433,16 @@ int nss_group_record_by_gid(
_cleanup_free_ char *sbuf = NULL;
_cleanup_free_ struct group *result = NULL;
bool incomplete = false;
@@ -110,7 +110,7 @@ index ffb5721466..4d01815c8c 100644
if (with_shadow) {
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
if (r < 0) {
@@ -436,6 +453,9 @@ int nss_group_record_by_gid(
@@ -437,6 +454,9 @@ int nss_group_record_by_gid(
incomplete = true;
r = nss_group_to_group_record(result, sresult, ret);
@@ -137,10 +137,10 @@ index 22ab04d6ee..4e52e7a911 100644
#include <shadow.h>
diff --git a/src/shared/userdb.c b/src/shared/userdb.c
index 75dece3442..5628e1410f 100644
index ff83d4bf90..54d36cc706 100644
--- a/src/shared/userdb.c
+++ b/src/shared/userdb.c
@@ -1038,13 +1038,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
@@ -1041,13 +1041,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
if (gr) {
_cleanup_free_ char *buffer = NULL;
bool incomplete = false;
@@ -157,7 +157,7 @@ index 75dece3442..5628e1410f 100644
if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
r = nss_sgrp_for_group(gr, &sgrp, &buffer);
if (r < 0) {
@@ -1057,6 +1059,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
@@ -1060,6 +1062,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
}
r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
@@ -168,5 +168,5 @@ index 75dece3442..5628e1410f 100644
return r;
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 45bb63a1727097683acad23f270968026671ec6a Mon Sep 17 00:00:00 2001
From ef9ad83759f78de983d2d7c4f95bc48b83bb8f66 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 12 Apr 2021 23:44:53 -0700
Subject: [PATCH 17/27] missing_syscall.h: Define MIPS ABI defines for musl
Subject: [PATCH 15/26] missing_syscall.h: Define MIPS ABI defines for musl
musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64
unlike glibc where these are provided by libc headers, therefore define
@@ -15,6 +15,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
src/shared/base-filesystem.c | 1 +
2 files changed, 7 insertions(+)
diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
index e2cd8b4e35..f2fe489de7 100644
--- a/src/basic/missing_syscall.h
+++ b/src/basic/missing_syscall.h
@@ -20,6 +20,12 @@
@@ -30,6 +32,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
#include "macro.h"
#include "missing_keyctl.h"
#include "missing_sched.h"
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index 389c77eee0..e3627c4603 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -20,6 +20,7 @@
@@ -40,3 +44,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
typedef struct BaseFilesystem {
const char *dir; /* directory or symlink to create */
--
2.34.1

View File

@@ -1,7 +1,7 @@
From 78a59a540d425e677d5652d9b72d7b175e36f4dd Mon Sep 17 00:00:00 2001
From 9079b158779a9c395c24f882f72a1c734795045d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 21 Jan 2022 15:15:11 -0800
Subject: [PATCH 18/27] pass correct parameters to getdents64
Subject: [PATCH 16/26] pass correct parameters to getdents64
Fixes
../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types]
@@ -20,7 +20,7 @@ Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
index 776733148b..d37419658c 100644
index 378fd92b06..5b567b457d 100644
--- a/src/basic/recurse-dir.c
+++ b/src/basic/recurse-dir.c
@@ -56,7 +56,7 @@ int readdir_all(int dir_fd,
@@ -33,5 +33,5 @@ index 776733148b..d37419658c 100644
return -errno;
if (n == 0)
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 585e04673da62a8bf50e00fd6c1ae9ffc66c3b2f Mon Sep 17 00:00:00 2001
From be9d8f221ab9d31c0df8b2b3e66172bb9bc0f71f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 21 Jan 2022 22:19:37 -0800
Subject: [PATCH 19/27] Adjust for musl headers
Subject: [PATCH 17/26] Adjust for musl headers
Upstream-Status: Inappropriate [musl specific]
@@ -10,6 +10,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
[Rebased for v255.1]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/basic/linux/ethtool.h | 3 ++-
src/libsystemd-network/sd-dhcp6-client.c | 2 +-
src/network/netdev/bareudp.c | 2 +-
src/network/netdev/batadv.c | 2 +-
@@ -43,11 +44,24 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
src/network/networkd-ndisc.c | 2 +-
src/network/networkd-setlink.c | 2 +-
src/network/networkd-sysctl.c | 2 +-
src/shared/linux/ethtool.h | 3 ++-
src/shared/netif-util.c | 2 +-
src/udev/udev-builtin-net_id.c | 2 +-
36 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/src/basic/linux/ethtool.h b/src/basic/linux/ethtool.h
index a32293ba20..2aad67e9c0 100644
--- a/src/basic/linux/ethtool.h
+++ b/src/basic/linux/ethtool.h
@@ -16,7 +16,8 @@
#include <linux/const.h>
#include <linux/types.h>
-#include <linux/if_ether.h>
+#include <netinet/if_ether.h>
+//#include <linux/if_ether.h>
#include <limits.h> /* for INT_MAX */
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 3e992d7cad..c7e1ff4dbf 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
@@ -62,7 +76,7 @@ index 3e992d7cad..c7e1ff4dbf 100644
#include "sd-dhcp6-client.h"
diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
index 1df886573b..c8b6714726 100644
index e122abd97f..c120c2969b 100644
--- a/src/network/netdev/bareudp.c
+++ b/src/network/netdev/bareudp.c
@@ -2,7 +2,7 @@
@@ -75,7 +89,7 @@ index 1df886573b..c8b6714726 100644
#include "bareudp.h"
#include "netlink-util.h"
diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
index 26da0231d4..2e8002af8c 100644
index 9806d8eb7c..19c3d881c2 100644
--- a/src/network/netdev/batadv.c
+++ b/src/network/netdev/batadv.c
@@ -3,7 +3,7 @@
@@ -88,7 +102,7 @@ index 26da0231d4..2e8002af8c 100644
#include "batadv.h"
#include "fileio.h"
diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
index 52a7f126b6..74ca0812db 100644
index b866940b7a..a0eaf0a866 100644
--- a/src/network/netdev/bond.c
+++ b/src/network/netdev/bond.c
@@ -1,7 +1,7 @@
@@ -101,7 +115,7 @@ index 52a7f126b6..74ca0812db 100644
#include "alloc-util.h"
#include "bond.h"
diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
index d426c0c501..14432adb95 100644
index d3ba4989d9..4f7301c4f1 100644
--- a/src/network/netdev/bridge.c
+++ b/src/network/netdev/bridge.c
@@ -2,7 +2,8 @@
@@ -115,7 +129,7 @@ index d426c0c501..14432adb95 100644
#include <netinet/in.h>
diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
index 00df1d2787..77b506b422 100644
index 8b2893d5b4..412123f036 100644
--- a/src/network/netdev/dummy.c
+++ b/src/network/netdev/dummy.c
@@ -1,6 +1,6 @@
@@ -127,7 +141,7 @@ index 00df1d2787..77b506b422 100644
#include "dummy.h"
diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
index 22c2b00e1b..1d762c4911 100644
index 1d68be9bc8..539151c49e 100644
--- a/src/network/netdev/geneve.c
+++ b/src/network/netdev/geneve.c
@@ -2,7 +2,7 @@
@@ -153,7 +167,7 @@ index d7ff44cb9e..e037629ae4 100644
#include "ifb.h"
diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
index d5fe299b7b..c9c8002eac 100644
index 6932c62e2a..fc458da9e8 100644
--- a/src/network/netdev/ipoib.c
+++ b/src/network/netdev/ipoib.c
@@ -1,6 +1,6 @@
@@ -165,7 +179,7 @@ index d5fe299b7b..c9c8002eac 100644
#include "ipoib.h"
diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
index 51ae64341d..46460efabd 100644
index 6e50f72aaa..49acfee25e 100644
--- a/src/network/netdev/ipvlan.c
+++ b/src/network/netdev/ipvlan.c
@@ -3,7 +3,7 @@
@@ -178,7 +192,7 @@ index 51ae64341d..46460efabd 100644
#include "conf-parser.h"
#include "ipvlan.h"
diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
index 4b9f19cc95..6c4951a7e6 100644
index 6dd434f803..f9fbe9f51a 100644
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -1,7 +1,7 @@
@@ -191,7 +205,7 @@ index 4b9f19cc95..6c4951a7e6 100644
#include <linux/if_macsec.h>
#include <linux/genetlink.h>
diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
index 21933d3970..a4ace19dc6 100644
index fd112b58e1..b038740bda 100644
--- a/src/network/netdev/macvlan.c
+++ b/src/network/netdev/macvlan.c
@@ -3,7 +3,7 @@
@@ -204,7 +218,7 @@ index 21933d3970..a4ace19dc6 100644
#include "conf-parser.h"
#include "macvlan.h"
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index 2b411425ba..fe00200135 100644
index c2986aafb5..147f1c95d0 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -3,7 +3,7 @@
@@ -217,7 +231,7 @@ index 2b411425ba..fe00200135 100644
#include "alloc-util.h"
diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
index 15d5c132f9..a3ffa48b15 100644
index 59958c3bbe..61169016b0 100644
--- a/src/network/netdev/netdevsim.c
+++ b/src/network/netdev/netdevsim.c
@@ -1,6 +1,6 @@
@@ -241,7 +255,7 @@ index ff372092e6..eef66811f4 100644
#include "nlmon.h"
diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
index db84e7cf6e..93d5642962 100644
index af05cfda81..f659bed3a6 100644
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -2,7 +2,7 @@
@@ -266,7 +280,7 @@ index 380547ee1e..137c1adf8a 100644
#include "vcan.h"
diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
index 78555286d1..e7eff072e4 100644
index 54d3b59734..f3f75e22b5 100644
--- a/src/network/netdev/veth.c
+++ b/src/network/netdev/veth.c
@@ -3,7 +3,7 @@
@@ -292,7 +306,7 @@ index 60e49a5b8a..266fd58813 100644
#include "parse-util.h"
diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
index 24079a7203..33ff17ea82 100644
index c35419f859..4d1d3ef141 100644
--- a/src/network/netdev/vrf.c
+++ b/src/network/netdev/vrf.c
@@ -2,8 +2,8 @@
@@ -306,7 +320,7 @@ index 24079a7203..33ff17ea82 100644
#include "vrf.h"
diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
index c0343f45b6..f9e718f40b 100644
index 2de89b8e24..ce1b8f9b69 100644
--- a/src/network/netdev/vxcan.c
+++ b/src/network/netdev/vxcan.c
@@ -1,7 +1,7 @@
@@ -319,7 +333,7 @@ index c0343f45b6..f9e718f40b 100644
#include "vxcan.h"
diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
index 37f65967a6..bdd8848a02 100644
index d8a066370d..8f94eeb763 100644
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -3,7 +3,7 @@
@@ -332,7 +346,7 @@ index 37f65967a6..bdd8848a02 100644
#include "conf-parser.h"
#include "alloc-util.h"
diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
index fed1be8d11..94b659fd23 100644
index 8d1dddf828..5182783f45 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -5,7 +5,7 @@
@@ -357,7 +371,7 @@ index 905bfc0bdf..39e34dbb3b 100644
#include "missing_network.h"
#include "xfrm.h"
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
index 9f0268d934..8cd605ab4a 100644
index 8b64dfe8f0..caa2885728 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -1,7 +1,8 @@
@@ -371,7 +385,7 @@ index 9f0268d934..8cd605ab4a 100644
#include "bus-error.h"
#include "bus-locator.h"
diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
index 2e660b7763..b8dd6240a0 100644
index 16426de981..3d8efc05f1 100644
--- a/src/network/networkd-dhcp-prefix-delegation.c
+++ b/src/network/networkd-dhcp-prefix-delegation.c
@@ -1,6 +1,5 @@
@@ -381,7 +395,7 @@ index 2e660b7763..b8dd6240a0 100644
#include "dhcp6-lease-internal.h"
#include "hashmap.h"
@@ -20,6 +19,8 @@
@@ -21,6 +20,8 @@
#include "strv.h"
#include "tunnel.h"
@@ -404,7 +418,7 @@ index c35102af74..3be469ae16 100644
#include "sd-dhcp-server.h"
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 4dd6044b18..15a598f9db 100644
index d94ac1a213..b8fe82cb6a 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -3,7 +3,7 @@
@@ -415,9 +429,9 @@ index 4dd6044b18..15a598f9db 100644
+//#include <linux/if_arp.h>
#include "alloc-util.h"
#include "dhcp-client-internal.h"
#include "device-private.h"
diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
index 32229a3fc7..662a345d6e 100644
index 04f51ab530..c4580754f7 100644
--- a/src/network/networkd-ipv6ll.c
+++ b/src/network/networkd-ipv6ll.c
@@ -1,7 +1,7 @@
@@ -430,7 +444,7 @@ index 32229a3fc7..662a345d6e 100644
#include "in-addr-util.h"
#include "networkd-address.h"
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 6b0f09926a..81f44f6e6a 100644
index 3c042e6c18..05fe2cb900 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -4,7 +4,7 @@
@@ -443,7 +457,7 @@ index 6b0f09926a..81f44f6e6a 100644
#include <linux/netdevice.h>
#include <sys/socket.h>
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index 7cafe1f6a3..07c293c9a6 100644
index 33e86fb04e..51292871fc 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -6,7 +6,7 @@
@@ -456,7 +470,7 @@ index 7cafe1f6a3..07c293c9a6 100644
#include "sd-ndisc.h"
diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
index 058bc00ba1..bb0a430a0b 100644
index 8519e6e7a0..7aca2bbecc 100644
--- a/src/network/networkd-setlink.c
+++ b/src/network/networkd-setlink.c
@@ -2,7 +2,7 @@
@@ -466,10 +480,10 @@ index 058bc00ba1..bb0a430a0b 100644
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_bridge.h>
#include <linux/ipv6.h>
#include "missing_network.h"
diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
index 68c23e0eb7..e177c49d9b 100644
index 10a35bc44b..84c6b68ee4 100644
--- a/src/network/networkd-sysctl.c
+++ b/src/network/networkd-sysctl.c
@@ -2,7 +2,7 @@
@@ -479,24 +493,10 @@ index 68c23e0eb7..e177c49d9b 100644
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "af-list.h"
#include "missing_network.h"
diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
index 3d1da515c0..3fca9a4faf 100644
--- a/src/shared/linux/ethtool.h
+++ b/src/shared/linux/ethtool.h
@@ -16,7 +16,8 @@
#include <linux/const.h>
#include <linux/types.h>
-#include <linux/if_ether.h>
+#include <netinet/if_ether.h>
+//#include <linux/if_ether.h>
#include <limits.h> /* for INT_MAX */
#include "sd-messages.h"
diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
index 8adc2c89c8..1977e28d7f 100644
index 978ce42341..899b5f613f 100644
--- a/src/shared/netif-util.c
+++ b/src/shared/netif-util.c
@@ -1,7 +1,7 @@
@@ -509,7 +509,7 @@ index 8adc2c89c8..1977e28d7f 100644
#include "arphrd-util.h"
#include "device-util.h"
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 384a1f31cb..c94bb70afb 100644
index 09c04b9a7f..4686897dbf 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -19,7 +19,7 @@
@@ -522,5 +522,5 @@ index 384a1f31cb..c94bb70afb 100644
#include <linux/pci_regs.h>
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From e01f0c444423eb65d176713735ff8cefb3068f3d Mon Sep 17 00:00:00 2001
From 349f9a0f9ecfc6575a3d9eeaffe89536e6a43914 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 8 Nov 2022 13:31:34 -0800
Subject: [PATCH 20/27] test-bus-error: strerror() is assumed to be GNU
Subject: [PATCH 18/26] test-bus-error: strerror() is assumed to be GNU
specific version mark it so
Upstream-Status: Inappropriate [Upstream systemd only supports glibc]
@@ -48,5 +48,5 @@ index ab463bd1b3..e2ebcaaf33 100644
TEST(PROTECT_ERRNO) {
errno = 12;
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From d2f632dd6a8cca0fbdd6568ce84004335c004f58 Mon Sep 17 00:00:00 2001
From 28fa1d5f56c6ddee9e336e6f2051c55e9f2f98b4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 23 Jan 2023 23:39:46 -0800
Subject: [PATCH 21/27] errno-util: Make STRERROR portable for musl
Subject: [PATCH 19/26] errno-util: Make STRERROR portable for musl
Sadly, systemd has decided to use yet another GNU extention in a macro
lets make this such that we can use XSI compliant strerror_r() for
@@ -38,5 +38,5 @@ index 48b76e4bf7..6e7653e2d9 100644
* Note that we can't use ({ … }) to define a temporary variable, so errnum is
* evaluated twice. */
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 4a3ed5aaaf108d3a07f24997698906e801ba2412 Mon Sep 17 00:00:00 2001
From 66de8a53849f76f5596327c38ae5f002b9f534cd Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 12:06:27 -0700
Subject: [PATCH 22/27] sd-event: Make malloc_trim() conditional on glibc
Subject: [PATCH 20/26] sd-event: Make malloc_trim() conditional on glibc
musl does not have this API
@@ -12,10 +12,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index a1305ef014..b8a73da2a3 100644
index 7aea7d2581..d3f4001f53 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit(
@@ -1881,7 +1881,7 @@ _public_ int sd_event_add_exit(
}
_public_ int sd_event_trim_memory(void) {
@@ -24,7 +24,7 @@ index a1305ef014..b8a73da2a3 100644
/* A default implementation of a memory pressure callback. Simply releases our own allocation caches
* and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) {
@@ -1895,7 +1895,9 @@ _public_ int sd_event_trim_memory(void) {
usec_t before_timestamp = now(CLOCK_MONOTONIC);
hashmap_trim_pools();
@@ -35,5 +35,5 @@ index a1305ef014..b8a73da2a3 100644
if (r > 0)
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From d3880d167d8dfafbb8ee62f7737a869f9525f303 Mon Sep 17 00:00:00 2001
From 93d13363c605fb2de484f38f3726f8fbad1c3540 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 12:20:40 -0700
Subject: [PATCH 23/27] shared: Do not use malloc_info on musl
Subject: [PATCH 21/26] shared: Do not use malloc_info on musl
Upstream-Status: Inappropriate [musl-specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
@@ -11,10 +11,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 30f9602b1e..5308f168db 100644
index ff80e580fc..a628a29d0c 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
@@ -787,15 +787,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
_cleanup_close_ int fd = -EBADF;
size_t dump_size;
FILE *f;
@@ -53,5 +53,5 @@ index 8e70e365dd..9e782caec9 100644
break;
}
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From ca2a736627f8ee8dd9dbbf5b3149d4c8493833ff Mon Sep 17 00:00:00 2001
From 5b8df64993b68a5a4af0f214d8cae77f4e716593 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 2 Jan 2024 11:03:27 +0800
Subject: [PATCH 24/27] avoid missing LOCK_EX declaration
Subject: [PATCH 22/26] avoid missing LOCK_EX declaration
This only happens on MUSL. Include sys/file.h to avoid compilation
error about missing LOCK_EX declaration.
@@ -16,7 +16,7 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
3 files changed, 3 insertions(+)
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index af17481dd8..fa20bfa30f 100644
index 93b254c680..5f0b1a816d 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -6,6 +6,7 @@
@@ -28,10 +28,10 @@ index af17481dd8..fa20bfa30f 100644
#include "macro.h"
#include "missing_fcntl.h"
diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c
index ee8db04e76..2aff654f0f 100644
index 9d636f5529..6be43caa57 100644
--- a/src/core/exec-invoke.c
+++ b/src/core/exec-invoke.c
@@ -4,6 +4,7 @@
@@ -5,6 +5,7 @@
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/prctl.h>
@@ -40,7 +40,7 @@ index ee8db04e76..2aff654f0f 100644
#if HAVE_PAM
#include <security/pam_appl.h>
diff --git a/src/shared/dev-setup.h b/src/shared/dev-setup.h
index 5339bc4e5e..0697495f23 100644
index 92ba6cf764..ba01a0ae55 100644
--- a/src/shared/dev-setup.h
+++ b/src/shared/dev-setup.h
@@ -2,6 +2,7 @@
@@ -49,8 +49,8 @@ index 5339bc4e5e..0697495f23 100644
#include <sys/types.h>
+#include <sys/file.h>
int lock_dev_console(void);
int dev_setup(const char *prefix, uid_t uid, gid_t gid);
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From ecf124ab2e488a71741fe443ff4863f7ed172968 Mon Sep 17 00:00:00 2001
From e39afec7e5a2f3a9de7202affab4d0340ba879d7 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 2 Jul 2024 22:18:47 -0700
Subject: [PATCH 25/27] include signal.h to avoid the 'undeclared' error
Subject: [PATCH 23/26] include signal.h to avoid the 'undeclared' error
Upstream-Status: Inappropriate [musl specific]
@@ -11,17 +11,17 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
1 file changed, 1 insertion(+)
diff --git a/src/basic/pidref.h b/src/basic/pidref.h
index 9920ebb9b3..2fdd4ff50f 100644
index 42ddf4e50b..b9cf53680f 100644
--- a/src/basic/pidref.h
+++ b/src/basic/pidref.h
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
@@ -3,6 +3,7 @@
typedef struct PidRef PidRef;
+#include <signal.h>
#include "macro.h"
#include "process-util.h"
/* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
--
2.45.1
2.34.1

View File

@@ -1,7 +1,7 @@
From 787606c6ff822fb3fe41ba951ee289bbf6d4def3 Mon Sep 17 00:00:00 2001
From 5a4334fde21b896cd75b2d1a56e06a4f365e9c4d Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 2 Jul 2024 22:44:31 -0700
Subject: [PATCH 26/27] undef stdin for references using stdin as a struct
Subject: [PATCH 24/26] undef stdin for references using stdin as a struct
member
In musl stdio.h, we have:
@@ -18,7 +18,7 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
2 files changed, 4 insertions(+)
diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
index cfb2828f4e..1794a7b269 100644
index e37609c2e1..1b212ae7b4 100644
--- a/src/shared/edit-util.c
+++ b/src/shared/edit-util.c
@@ -3,6 +3,8 @@
@@ -31,7 +31,7 @@ index cfb2828f4e..1794a7b269 100644
#include "copy.h"
#include "edit-util.h"
diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
index 15398f8364..e7d53ca9a1 100644
index c42a31153d..7695ceeead 100644
--- a/src/systemctl/systemctl-edit.c
+++ b/src/systemctl/systemctl-edit.c
@@ -13,6 +13,8 @@
@@ -44,5 +44,5 @@ index 15398f8364..e7d53ca9a1 100644
_cleanup_hashmap_free_ Hashmap *cached_id_map = NULL, *cached_name_map = NULL;
_cleanup_(lookup_paths_done) LookupPaths lp = {};
--
2.45.1
2.34.1

View File

@@ -0,0 +1,288 @@
From a90044320eecda424ed678d283ef60806c70fcda Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 2 Jul 2024 23:23:57 -0700
Subject: [PATCH 25/26] adjust header inclusion order to avoid redeclaration
Upstream-Status: Inappropriate [musl specific]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/basic/parse-util.c | 3 ++-
src/libsystemd-network/ndisc-option.c | 6 +++---
src/libsystemd-network/sd-radv.c | 5 +++--
src/network/netdev/l2tp-tunnel.c | 9 ++++-----
src/network/netdev/l2tp-tunnel.h | 6 +++---
src/network/netdev/wireguard.c | 2 +-
src/network/networkctl-link-info.c | 4 ++--
src/network/networkd-bridge-mdb.c | 3 ++-
src/network/networkd-route.c | 8 ++++----
src/resolve/resolved-dns-stream.c | 5 +++--
src/resolve/resolved-manager.c | 5 +++--
src/shared/conf-parser.c | 3 ++-
12 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
index faa5344921..0fc9d12c89 100644
--- a/src/basic/parse-util.c
+++ b/src/basic/parse-util.c
@@ -2,7 +2,6 @@
#include <errno.h>
#include <inttypes.h>
-#include <linux/ipv6.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
@@ -20,6 +19,8 @@
#include "string-util.h"
#include "strv.h"
+#include <linux/ipv6.h>
+
int parse_boolean(const char *v) {
if (!v)
return -EINVAL;
diff --git a/src/libsystemd-network/ndisc-option.c b/src/libsystemd-network/ndisc-option.c
index 3aab51f51b..feeb4c78e5 100644
--- a/src/libsystemd-network/ndisc-option.c
+++ b/src/libsystemd-network/ndisc-option.c
@@ -1,8 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/ipv6.h>
-#include <netinet/icmp6.h>
-
#include "dns-resolver-internal.h"
#include "dns-domain.h"
#include "ether-addr-util.h"
@@ -16,6 +13,9 @@
#include "strv.h"
#include "unaligned.h"
+#include <linux/ipv6.h>
+#include <netinet/icmp6.h>
+
/* RFC does not say anything about the maximum number of options, but let's limit the number of options for
* safety. Typically, the number of options in an ICMPv6 message should be only a few. */
#define MAX_OPTIONS 128
diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c
index f241929ad5..7cef3c3f71 100644
--- a/src/libsystemd-network/sd-radv.c
+++ b/src/libsystemd-network/sd-radv.c
@@ -3,8 +3,6 @@
Copyright © 2017 Intel Corporation. All rights reserved.
***/
-#include <linux/ipv6.h>
-#include <netinet/icmp6.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -29,6 +27,9 @@
#include "strv.h"
#include "unaligned.h"
+#include <linux/ipv6.h>
+#include <netinet/icmp6.h>
+
int sd_radv_new(sd_radv **ret) {
_cleanup_(sd_radv_unrefp) sd_radv *ra = NULL;
diff --git a/src/network/netdev/l2tp-tunnel.c b/src/network/netdev/l2tp-tunnel.c
index c87e44797b..437b40c114 100644
--- a/src/network/netdev/l2tp-tunnel.c
+++ b/src/network/netdev/l2tp-tunnel.c
@@ -1,10 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <netinet/in.h>
-#include <linux/if_arp.h>
-#include <linux/l2tp.h>
-#include <linux/genetlink.h>
-
#include "conf-parser.h"
#include "hashmap.h"
#include "l2tp-tunnel.h"
@@ -17,6 +12,10 @@
#include "string-table.h"
#include "string-util.h"
+#include <netinet/in.h>
+#include <linux/l2tp.h>
+#include <linux/genetlink.h>
+
static const char* const l2tp_l2spec_type_table[_NETDEV_L2TP_L2SPECTYPE_MAX] = {
[NETDEV_L2TP_L2SPECTYPE_NONE] = "none",
[NETDEV_L2TP_L2SPECTYPE_DEFAULT] = "default",
diff --git a/src/network/netdev/l2tp-tunnel.h b/src/network/netdev/l2tp-tunnel.h
index c558ed49de..8419ef34c5 100644
--- a/src/network/netdev/l2tp-tunnel.h
+++ b/src/network/netdev/l2tp-tunnel.h
@@ -1,13 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <netinet/in.h>
-#include <linux/l2tp.h>
-
#include "in-addr-util.h"
#include "netdev.h"
#include "networkd-util.h"
+#include <netinet/in.h>
+#include <linux/l2tp.h>
+
typedef enum L2tpL2specType {
NETDEV_L2TP_L2SPECTYPE_NONE = L2TP_L2SPECTYPE_NONE,
NETDEV_L2TP_L2SPECTYPE_DEFAULT = L2TP_L2SPECTYPE_DEFAULT,
diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
index 5182783f45..79b21cb4ba 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -5,9 +5,9 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <netinet/in.h>
//#include <linux/if_arp.h>
#include <linux/ipv6_route.h>
-#include <netinet/in.h>
#include <sys/ioctl.h>
#include "sd-resolve.h"
diff --git a/src/network/networkctl-link-info.c b/src/network/networkctl-link-info.c
index f356d3c231..216c442de1 100644
--- a/src/network/networkctl-link-info.c
+++ b/src/network/networkctl-link-info.c
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_tunnel.h>
-
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-util.h"
@@ -16,6 +14,8 @@
#include "strxcpyx.h"
#include "wifi-util.h"
+#include <linux/if_tunnel.h>
+
/* use 128 kB for receive socket kernel queue, we shouldn't need more here */
#define RCVBUF_SIZE (128*1024)
diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
index 358ca4d294..fe87f7c093 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -2,7 +2,6 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
-#include <linux/if_bridge.h>
#include "netlink-util.h"
#include "networkd-bridge-mdb.h"
@@ -13,6 +12,8 @@
#include "string-util.h"
#include "vlan-util.h"
+#include <linux/if_bridge.h>
+
#define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U
/* remove MDB entry. */
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 0f3f79ec4f..325743bebf 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1,9 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if.h>
-#include <linux/ipv6_route.h>
-#include <linux/nexthop.h>
-
#include "alloc-util.h"
#include "event-util.h"
#include "netlink-util.h"
@@ -21,6 +17,10 @@
#include "vrf.h"
#include "wireguard.h"
+#include <linux/if.h>
+#include <linux/ipv6_route.h>
+#include <linux/nexthop.h>
+
static Route* route_detach_impl(Route *route) {
assert(route);
assert(!!route->network + !!route->manager + !!route->wireguard <= 1);
diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c
index e57af66221..f66d8f0606 100644
--- a/src/resolve/resolved-dns-stream.c
+++ b/src/resolve/resolved-dns-stream.c
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
-#include <netinet/tcp.h>
#include <unistd.h>
#include "alloc-util.h"
@@ -12,6 +10,9 @@
#include "resolved-dns-stream.h"
#include "resolved-manager.h"
+//#include <linux/if_arp.h>
+#include <netinet/tcp.h>
+
#define DNS_STREAMS_MAX 128
#define DNS_QUERIES_PER_STREAM 32
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index dbaad81734..b988e75851 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -1,8 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
-#include <linux/ipv6.h>
-#include <netinet/in.h>
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
@@ -46,6 +44,9 @@
#include "utf8.h"
#include "varlink-util.h"
+#include <linux/ipv6.h>
+#include <netinet/in.h>
+
#define SEND_TIMEOUT_USEC (200 * USEC_PER_MSEC)
static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index eaa8a5f11c..03379e7474 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -2,7 +2,6 @@
#include <errno.h>
#include <limits.h>
-#include <linux/ipv6.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -47,6 +46,8 @@
#include "time-util.h"
#include "utf8.h"
+#include <linux/ipv6.h>
+
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(config_file_hash_ops_fclose,
char, path_hash_func, path_compare,
FILE, safe_fclose);
--
2.34.1

View File

@@ -1,7 +1,7 @@
From 0e4379088b1cf607b605b785f6f23943ebeb6584 Mon Sep 17 00:00:00 2001
From f2a7cf1d2a2bc2516a180809efd85c828cd9c7f4 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Wed, 3 Jul 2024 07:18:42 -0700
Subject: [PATCH 28/28] build-path.c: avoid boot time segfault for musl
Subject: [PATCH 26/26] build-path.c: avoid boot time segfault for musl
This function, at runtime, should return -ENOEXEC. For musl, it
somehow segfaults. I think it's related to getauxval, but it's
@@ -27,5 +27,5 @@ index b5972658df..4ef551034e 100644
const char *runpath = NULL;
--
2.45.1
2.34.1

View File

@@ -1,76 +0,0 @@
From cf94d43572770007f95b832f477aa5a03624a1e5 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 2 Jul 2024 23:23:57 -0700
Subject: [PATCH 27/27] adjust header inclusion order to avoid redeclaration
Upstream-Status: Inappropriate [musl specific]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/network/netdev/wireguard.c | 2 +-
src/network/networkd-bridge-mdb.c | 3 ++-
src/network/networkd-route.c | 6 +++---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
index 94b659fd23..a78ad5762d 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -5,9 +5,9 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <netinet/in.h>
//#include <linux/if_arp.h>
#include <linux/ipv6_route.h>
-#include <netinet/in.h>
#include <sys/ioctl.h>
#include "sd-resolve.h"
diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
index 7ff4a18846..fe1a9cf888 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -2,7 +2,6 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
-#include <linux/if_bridge.h>
#include "netlink-util.h"
#include "networkd-bridge-mdb.h"
@@ -13,6 +12,8 @@
#include "string-util.h"
#include "vlan-util.h"
+#include <linux/if_bridge.h>
+
#define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U
/* remove MDB entry. */
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index d596fd81e6..0dc0d2a7a3 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1,8 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/ipv6_route.h>
-#include <linux/nexthop.h>
-
#include "alloc-util.h"
#include "event-util.h"
#include "netlink-util.h"
@@ -20,6 +17,9 @@
#include "vrf.h"
#include "wireguard.h"
+#include <linux/ipv6_route.h>
+#include <linux/nexthop.h>
+
static Route* route_detach_impl(Route *route) {
assert(route);
assert(!!route->network + !!route->manager + !!route->wireguard <= 1);
--
2.45.1

View File

@@ -28,37 +28,35 @@ SRC_URI += " \
file://systemd-pager.sh \
file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
file://0002-implment-systemd-sysv-install-for-OE.patch \
file://0003-coredump-set-ProtectHome-to-read-only.patch \
"
# patches needed by musl
SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}"
SRC_URI_MUSL = "\
file://0004-missing_type.h-add-comparison_fn_t.patch \
file://0005-add-fallback-parse_printf_format-implementation.patch \
file://0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
file://0007-add-missing-FTW_-macros-for-musl.patch \
file://0008-Use-uintmax_t-for-handling-rlim_t.patch \
file://0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
file://0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
file://0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
file://0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
file://0013-avoid-redefinition-of-prctl_mm_map-structure.patch \
file://0014-do-not-disable-buffer-in-writing-files.patch \
file://0015-Handle-__cpu_mask-usage.patch \
file://0016-Handle-missing-gshadow.patch \
file://0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \
file://0018-pass-correct-parameters-to-getdents64.patch \
file://0019-Adjust-for-musl-headers.patch \
file://0020-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
file://0021-errno-util-Make-STRERROR-portable-for-musl.patch \
file://0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch \
file://0023-shared-Do-not-use-malloc_info-on-musl.patch \
file://0024-avoid-missing-LOCK_EX-declaration.patch \
file://0025-include-signal.h-to-avoid-the-undeclared-error.patch \
file://0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch \
file://0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch \
file://0028-build-path.c-avoid-boot-time-segfault-for-musl.patch \
file://0003-missing_type.h-add-comparison_fn_t.patch \
file://0004-add-fallback-parse_printf_format-implementation.patch \
file://0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
file://0006-add-missing-FTW_-macros-for-musl.patch \
file://0007-Use-uintmax_t-for-handling-rlim_t.patch \
file://0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
file://0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
file://0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
file://0011-avoid-redefinition-of-prctl_mm_map-structure.patch \
file://0012-do-not-disable-buffer-in-writing-files.patch \
file://0013-Handle-__cpu_mask-usage.patch \
file://0014-Handle-missing-gshadow.patch \
file://0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \
file://0016-pass-correct-parameters-to-getdents64.patch \
file://0017-Adjust-for-musl-headers.patch \
file://0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
file://0019-errno-util-Make-STRERROR-portable-for-musl.patch \
file://0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch \
file://0021-shared-Do-not-use-malloc_info-on-musl.patch \
file://0022-avoid-missing-LOCK_EX-declaration.patch \
file://0023-include-signal.h-to-avoid-the-undeclared-error.patch \
file://0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch \
file://0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch \
file://0026-build-path.c-avoid-boot-time-segfault-for-musl.patch \
"
PAM_PLUGINS = " \