From 5763e3e0fe00cbd9010398e795085ba0377802e8 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Thu, 30 Jan 2025 20:32:47 +0100 Subject: [PATCH] feat: update systemd to 257.2 Bring in latest udev version. Signed-off-by: Dmitry Sharshakov --- Pkgfile | 6 +- .../0001-Do-not-create-var-log-README.patch | 31 ++ ...-musl-headers-compatibility-for-udev.patch | 18 +- ...-missing_type.h-add-comparison_fn_t.patch} | 9 +- ...-parse_printf_format-implementation.patch} | 17 +- ...B_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch} | 13 +- ...7-Use-uintmax_t-for-handling-rlim_t.patch} | 15 +- ...atible-basename-for-non-glibc-syste.patch} | 11 +- ...ffering-when-writing-to-oom_score_a.patch} | 11 +- ...T_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | 98 ------ ...ompliant-strerror_r-from-GNU-specif.patch} | 13 +- ...efinition-of-prctl_mm_map-structure.patch} | 7 +- ...not-disable-buffer-in-writing-files.patch} | 263 +++++++--------- ...atch => 0014-Handle-missing-gshadow.patch} | 33 +- ....h-Define-MIPS-ABI-defines-for-musl.patch} | 11 +- ...tch => 0017-Adjust-for-musl-headers.patch} | 101 +++--- ...util-Make-STRERROR-portable-for-musl.patch | 42 +++ ...ke-malloc_trim-conditional-on-glibc.patch} | 13 +- ...ared-Do-not-use-malloc_info-on-musl.patch} | 11 +- ...2-avoid-missing-LOCK_EX-declaration.patch} | 17 +- ...nal.h-to-avoid-the-undeclared-error.patch} | 17 +- ...eferences-using-stdin-as-a-struct-m.patch} | 11 +- ...clusion-order-to-avoid-redeclaration.patch | 288 ++++++++++++++++++ ...c-avoid-boot-time-segfault-for-musl.patch} | 7 +- ...clusion-order-to-avoid-redeclaration.patch | 75 ----- systemd-udevd/patches/xxx-udev-dynbuf.patch | 201 ++++++++++++ systemd-udevd/pkg.yaml | 49 +-- 27 files changed, 883 insertions(+), 505 deletions(-) create mode 100644 systemd-udevd/patches/0001-Do-not-create-var-log-README.patch rename systemd-udevd/patches/{0004-missing_type.h-add-comparison_fn_t.patch => 0003-missing_type.h-add-comparison_fn_t.patch} (91%) rename systemd-udevd/patches/{0005-add-fallback-parse_printf_format-implementation.patch => 0004-add-fallback-parse_printf_format-implementation.patch} (97%) rename systemd-udevd/patches/{0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch => 0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch} (94%) rename systemd-udevd/patches/{0008-Use-uintmax_t-for-handling-rlim_t.patch => 0007-Use-uintmax_t-for-handling-rlim_t.patch} (93%) rename systemd-udevd/patches/{0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch => 0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch} (82%) rename systemd-udevd/patches/{0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch => 0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch} (83%) delete mode 100644 systemd-udevd/patches/0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch rename systemd-udevd/patches/{0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch => 0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch} (88%) rename systemd-udevd/patches/{0013-avoid-redefinition-of-prctl_mm_map-structure.patch => 0011-avoid-redefinition-of-prctl_mm_map-structure.patch} (83%) rename systemd-udevd/patches/{0014-do-not-disable-buffer-in-writing-files.patch => 0012-do-not-disable-buffer-in-writing-files.patch} (77%) rename systemd-udevd/patches/{0016-Handle-missing-gshadow.patch => 0014-Handle-missing-gshadow.patch} (84%) rename systemd-udevd/patches/{0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch => 0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch} (75%) rename systemd-udevd/patches/{0019-Adjust-for-musl-headers.patch => 0017-Adjust-for-musl-headers.patch} (90%) create mode 100644 systemd-udevd/patches/0019-errno-util-Make-STRERROR-portable-for-musl.patch rename systemd-udevd/patches/{0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch => 0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch} (77%) rename systemd-udevd/patches/{0023-shared-Do-not-use-malloc_info-on-musl.patch => 0021-shared-Do-not-use-malloc_info-on-musl.patch} (86%) rename systemd-udevd/patches/{0024-avoid-missing-LOCK_EX-declaration.patch => 0022-avoid-missing-LOCK_EX-declaration.patch} (78%) rename systemd-udevd/patches/{0025-include-signal.h-to-avoid-the-undeclared-error.patch => 0023-include-signal.h-to-avoid-the-undeclared-error.patch} (51%) rename systemd-udevd/patches/{0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch => 0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch} (84%) create mode 100644 systemd-udevd/patches/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch rename systemd-udevd/patches/{0028-build-path.c-avoid-boot-time-segfault-for-musl.patch => 0026-build-path.c-avoid-boot-time-segfault-for-musl.patch} (85%) delete mode 100644 systemd-udevd/patches/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch create mode 100644 systemd-udevd/patches/xxx-udev-dynbuf.patch diff --git a/Pkgfile b/Pkgfile index 98c05104e..01e40c046 100644 --- a/Pkgfile +++ b/Pkgfile @@ -37,9 +37,9 @@ vars: e2fsprogs_sha512: 1dc86535b72a4ab60e17a547efe5e137054eff6cad9f6cf9cc9485694ec6166687a9d5f50fb47a10e776a70c7690ade5445c0339731f83066abf33c01f70d9c7 # renovate: datasource=github-releases extractVersion=^v(?.*)$ depName=systemd/systemd - systemd_version: 256.8 - systemd_sha256: b3d003b4f6d1ab0bfae0cf7a37c4aa559923c49bc8e9d1331b7459e12ebc357a - systemd_sha512: 0cdd41274b79177705f6999194ea2698e8bccd123d983733972e0fba4ece5467eddefec419a992d1646e93adda7b811810deec163a15f2c9347473caefe2ce09 + systemd_version: 257.2 + systemd_sha256: 7f2bc3253e4f87578132c5e433ef9ff7e8fee01d9eb5a5b7c64376d617f694d0 + systemd_sha512: 4f47fcd9a4148101ee7b85cf5908a04ec9e025dc7a5a2e8e61c05439cfd427851b6d356bb96a0dfae55566bbf6d3c93a13251d220840c09296e94f80bd4a5945 # renovate: datasource=github-releases depName=flannel-io/cni-plugin flannel_cni_version: v1.5.1-flannel3 diff --git a/systemd-udevd/patches/0001-Do-not-create-var-log-README.patch b/systemd-udevd/patches/0001-Do-not-create-var-log-README.patch new file mode 100644 index 000000000..98e7c49af --- /dev/null +++ b/systemd-udevd/patches/0001-Do-not-create-var-log-README.patch @@ -0,0 +1,31 @@ +From 425ad51e727058b48dd4580fd6afe7e51e96a28a Mon Sep 17 00:00:00 2001 +From: Peter Kjellerstedt +Date: Tue, 21 Jan 2025 05:02:00 +0100 +Subject: [PATCH] Do not create /var/log/README + +/var/log/README is a link to /usr/share/doc/systemd/README.logs. The +latter is packaged in systemd-doc and likely not installed, which leaves +/var/log/README as a dead link. Since /var/log/README is not very +useful, just remove it. + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Peter Kjellerstedt +--- + tmpfiles.d/legacy.conf.in | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/tmpfiles.d/legacy.conf.in b/tmpfiles.d/legacy.conf.in +index b475500e58..650c91a8da 100644 +--- a/tmpfiles.d/legacy.conf.in ++++ b/tmpfiles.d/legacy.conf.in +@@ -13,9 +13,6 @@ + + d /run/lock 0755 root root - + L /var/lock - - - - ../run/lock +-{% if CREATE_LOG_DIRS %} +-L$ /var/log/README - - - - ../..{{DOC_DIR}}/README.logs +-{% endif %} + + {% if HAVE_SYSV_COMPAT %} + # /run/lock/subsys is used for serializing SysV service execution, and + diff --git a/systemd-udevd/patches/0001-chore-musl-headers-compatibility-for-udev.patch b/systemd-udevd/patches/0001-chore-musl-headers-compatibility-for-udev.patch index fc7ecd245..c7c7a84f5 100644 --- a/systemd-udevd/patches/0001-chore-musl-headers-compatibility-for-udev.patch +++ b/systemd-udevd/patches/0001-chore-musl-headers-compatibility-for-udev.patch @@ -1,6 +1,6 @@ -From bc049f17be6eca828cc84861877d26092fea71a1 Mon Sep 17 00:00:00 2001 +From 2c02b4a6f5b56f5b6a078c4b0fd0bbaab41f3d55 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov -Date: Sat, 28 Sep 2024 19:09:54 +0200 +Date: Thu, 30 Jan 2025 19:52:11 +0100 Subject: [PATCH] chore: musl headers compatibility for udev Signed-off-by: Dmitry Sharshakov @@ -12,10 +12,10 @@ Signed-off-by: Dmitry Sharshakov 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h -index e79f5c8ceb..7a885ea299 100644 +index b287b2a0bb..2639e69b52 100644 --- a/src/basic/linux/if.h +++ b/src/basic/linux/if.h -@@ -130,10 +130,10 @@ enum net_device_flags { +@@ -129,10 +129,10 @@ enum net_device_flags { #define IFF_LOWER_UP IFF_LOWER_UP #define IFF_DORMANT IFF_DORMANT #define IFF_ECHO IFF_ECHO @@ -28,7 +28,7 @@ index e79f5c8ceb..7a885ea299 100644 #define IF_GET_IFACE 0x0001 /* for querying only */ #define IF_GET_PROTO 0x0002 diff --git a/src/basic/linux/if_ether.h b/src/basic/linux/if_ether.h -index 69e0457eb2..4bf6341acf 100644 +index a1aff8e337..847532aea0 100644 --- a/src/basic/linux/if_ether.h +++ b/src/basic/linux/if_ether.h @@ -166,7 +166,7 @@ @@ -41,10 +41,10 @@ index 69e0457eb2..4bf6341acf 100644 #if __UAPI_DEF_ETHHDR diff --git a/src/basic/linux/libc-compat.h b/src/basic/linux/libc-compat.h -index 8254c937c9..3e06d3eabb 100644 +index e25cd3f486..3bc1776e70 100644 --- a/src/basic/linux/libc-compat.h +++ b/src/basic/linux/libc-compat.h -@@ -172,18 +172,22 @@ +@@ -153,18 +153,22 @@ * unsupported C libraries a way to opt out of any kernel definition. */ #else /* !defined(__GLIBC__) */ @@ -71,7 +71,7 @@ index 8254c937c9..3e06d3eabb 100644 /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS diff --git a/src/basic/linux/netdevice.h b/src/basic/linux/netdevice.h -index f3770c5b0f..6125206f33 100644 +index 86d961c911..97fce6fb17 100644 --- a/src/basic/linux/netdevice.h +++ b/src/basic/linux/netdevice.h @@ -31,7 +31,7 @@ @@ -84,5 +84,5 @@ index f3770c5b0f..6125206f33 100644 /* Initial net device group. All devices belong to group 0 by default. */ -- -2.46.1 +2.48.1 diff --git a/systemd-udevd/patches/0004-missing_type.h-add-comparison_fn_t.patch b/systemd-udevd/patches/0003-missing_type.h-add-comparison_fn_t.patch similarity index 91% rename from systemd-udevd/patches/0004-missing_type.h-add-comparison_fn_t.patch rename to systemd-udevd/patches/0003-missing_type.h-add-comparison_fn_t.patch index bdafe1ff4..f2094eb71 100644 --- a/systemd-udevd/patches/0004-missing_type.h-add-comparison_fn_t.patch +++ b/systemd-udevd/patches/0003-missing_type.h-add-comparison_fn_t.patch @@ -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 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,4 +57,5 @@ index a0b673f65f..29dd2fee16 100644 const char * const catalog_file_dirs[] = { "/usr/local/lib/systemd/catalog/", -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0005-add-fallback-parse_printf_format-implementation.patch b/systemd-udevd/patches/0004-add-fallback-parse_printf_format-implementation.patch similarity index 97% rename from systemd-udevd/patches/0005-add-fallback-parse_printf_format-implementation.patch rename to systemd-udevd/patches/0004-add-fallback-parse_printf_format-implementation.patch index 7262dc19d..f9a45bb40 100644 --- a/systemd-udevd/patches/0005-add-fallback-parse_printf_format-implementation.patch +++ b/systemd-udevd/patches/0004-add-fallback-parse_printf_format-implementation.patch @@ -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 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 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,4 +430,5 @@ index 7d02b57d7b..75e8e08add 100644 #define SNDBUF_SIZE (8*1024*1024) -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/systemd-udevd/patches/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch similarity index 94% rename from systemd-udevd/patches/0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch rename to systemd-udevd/patches/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch index 073f7b26a..1b5e0d54c 100644 --- a/systemd-udevd/patches/0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch +++ b/systemd-udevd/patches/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch @@ -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 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,4 +152,5 @@ index 807925f199..b4f86fc611 100644 int r; -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0008-Use-uintmax_t-for-handling-rlim_t.patch b/systemd-udevd/patches/0007-Use-uintmax_t-for-handling-rlim_t.patch similarity index 93% rename from systemd-udevd/patches/0008-Use-uintmax_t-for-handling-rlim_t.patch rename to systemd-udevd/patches/0007-Use-uintmax_t-for-handling-rlim_t.patch index ed3347fb7..b4a570e1f 100644 --- a/systemd-udevd/patches/0008-Use-uintmax_t-for-handling-rlim_t.patch +++ b/systemd-udevd/patches/0007-Use-uintmax_t-for-handling-rlim_t.patch @@ -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 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 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,4 +102,5 @@ index 513e95e09d..0e269617f8 100644 if (c->ioprio_set) { -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/systemd-udevd/patches/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch similarity index 82% rename from systemd-udevd/patches/0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch rename to systemd-udevd/patches/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch index a13cc0268..22e2ceadc 100644 --- a/systemd-udevd/patches/0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch +++ b/systemd-udevd/patches/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -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 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 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,4 +30,5 @@ index ff5efbcf55..d1a6bb0e76 100644 if (!haystack || !needle) return NULL; -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/systemd-udevd/patches/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch similarity index 83% rename from systemd-udevd/patches/0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch rename to systemd-udevd/patches/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch index 160905d0e..8e3eb15b5 100644 --- a/systemd-udevd/patches/0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +++ b/systemd-udevd/patches/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch @@ -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 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 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,4 +37,5 @@ index c9d968dee0..7d6d3ce7db 100644 int get_oom_score_adjust(int *ret) { -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/systemd-udevd/patches/0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch deleted file mode 100644 index ea18d4023..000000000 --- a/systemd-udevd/patches/0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 8af5d1e3c0dc7e71f7a4aee0f539a5d772d47354 Mon Sep 17 00:00:00 2001 -From: Andre McCurdy -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 ---- - 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 diff --git a/systemd-udevd/patches/0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/systemd-udevd/patches/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch similarity index 88% rename from systemd-udevd/patches/0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch rename to systemd-udevd/patches/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch index 25c767650..0dfb77890 100644 --- a/systemd-udevd/patches/0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +++ b/systemd-udevd/patches/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -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 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 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,4 +72,5 @@ index 75e8e08add..41e5c7c2b8 100644 char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0013-avoid-redefinition-of-prctl_mm_map-structure.patch b/systemd-udevd/patches/0011-avoid-redefinition-of-prctl_mm_map-structure.patch similarity index 83% rename from systemd-udevd/patches/0013-avoid-redefinition-of-prctl_mm_map-structure.patch rename to systemd-udevd/patches/0011-avoid-redefinition-of-prctl_mm_map-structure.patch index ca69bbd47..16d741cf8 100644 --- a/systemd-udevd/patches/0013-avoid-redefinition-of-prctl_mm_map-structure.patch +++ b/systemd-udevd/patches/0011-avoid-redefinition-of-prctl_mm_map-structure.patch @@ -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 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,4 +28,5 @@ index 2c9f9f6c50..65a984b564 100644 #include "macro.h" -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0014-do-not-disable-buffer-in-writing-files.patch b/systemd-udevd/patches/0012-do-not-disable-buffer-in-writing-files.patch similarity index 77% rename from systemd-udevd/patches/0014-do-not-disable-buffer-in-writing-files.patch rename to systemd-udevd/patches/0012-do-not-disable-buffer-in-writing-files.patch index cec5b441a..7c05bde74 100644 --- a/systemd-udevd/patches/0014-do-not-disable-buffer-in-writing-files.patch +++ b/systemd-udevd/patches/0012-do-not-disable-buffer-in-writing-files.patch @@ -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 -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 Signed-off-by: Chen Qi [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)); +@@ -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(target == FREEZER_FROZEN), WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(path, one_zero(target == FREEZER_FROZEN), 0); +- 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) { +@@ -1826,7 +1826,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, +@@ -2564,7 +2564,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); - } - -- 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); +@@ -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; + 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,10 +369,10 @@ 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) { +@@ -498,7 +498,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so * fail gracefully if it doesn't exist and we're only overwriting it with 0. */ @@ -389,7 +381,7 @@ index 7c21157580..06ab74b04c 100644 if (r == -ENOENT) { if (offset != 0) return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), -@@ -511,7 +511,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { +@@ -514,7 +514,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.", offset_str, 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,4 +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 + diff --git a/systemd-udevd/patches/0016-Handle-missing-gshadow.patch b/systemd-udevd/patches/0014-Handle-missing-gshadow.patch similarity index 84% rename from systemd-udevd/patches/0016-Handle-missing-gshadow.patch rename to systemd-udevd/patches/0014-Handle-missing-gshadow.patch index 1428185bb..08d4e384f 100644 --- a/systemd-udevd/patches/0016-Handle-missing-gshadow.patch +++ b/systemd-udevd/patches/0014-Handle-missing-gshadow.patch @@ -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 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 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 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,4 +168,5 @@ index 75dece3442..5628e1410f 100644 return r; -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/systemd-udevd/patches/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch similarity index 75% rename from systemd-udevd/patches/0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch rename to systemd-udevd/patches/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch index a7a641e0a..f0aa3a0bd 100644 --- a/systemd-udevd/patches/0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch +++ b/systemd-udevd/patches/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch @@ -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 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 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 #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 typedef struct BaseFilesystem { const char *dir; /* directory or symlink to create */ +-- +2.34.1 + diff --git a/systemd-udevd/patches/0019-Adjust-for-musl-headers.patch b/systemd-udevd/patches/0017-Adjust-for-musl-headers.patch similarity index 90% rename from systemd-udevd/patches/0019-Adjust-for-musl-headers.patch rename to systemd-udevd/patches/0017-Adjust-for-musl-headers.patch index fde6e1646..5a2bc3c55 100644 --- a/systemd-udevd/patches/0019-Adjust-for-musl-headers.patch +++ b/systemd-udevd/patches/0017-Adjust-for-musl-headers.patch @@ -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 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 [Rebased for v255.1] Signed-off-by: Chen Qi --- + 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 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 + #include +-#include ++#include ++//#include + + #include /* 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 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 #include 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 #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 #include 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 +//#include #include + #include - #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 +//#include - #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 - #include --#include -+#include -+//#include - - #include /* 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,4 +522,5 @@ index 384a1f31cb..c94bb70afb 100644 #include -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0019-errno-util-Make-STRERROR-portable-for-musl.patch b/systemd-udevd/patches/0019-errno-util-Make-STRERROR-portable-for-musl.patch new file mode 100644 index 000000000..791079a19 --- /dev/null +++ b/systemd-udevd/patches/0019-errno-util-Make-STRERROR-portable-for-musl.patch @@ -0,0 +1,42 @@ +From 28fa1d5f56c6ddee9e336e6f2051c55e9f2f98b4 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 23 Jan 2023 23:39:46 -0800 +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 +non-glibc hosts + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj +--- + src/basic/errno-util.h | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h +index 48b76e4bf7..6e7653e2d9 100644 +--- a/src/basic/errno-util.h ++++ b/src/basic/errno-util.h +@@ -15,8 +15,16 @@ + * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks + * + * Note that we use the GNU variant of strerror_r() here. */ +-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN) +- ++static inline const char * STRERROR(int errnum); ++ ++static inline const char * STRERROR(int errnum) { ++#ifdef __GLIBC__ ++ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN); ++#else ++ static __thread char buf[ERRNO_BUF_LEN]; ++ return strerror_r(abs(errnum), buf, ERRNO_BUF_LEN) ? "unknown error" : buf; ++#endif ++} + /* A helper to print an error message or message for functions that return 0 on EOF. + * Note that we can't use ({ … }) to define a temporary variable, so errnum is + * evaluated twice. */ +-- +2.34.1 + diff --git a/systemd-udevd/patches/0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch b/systemd-udevd/patches/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch similarity index 77% rename from systemd-udevd/patches/0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch rename to systemd-udevd/patches/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch index 58b02976b..16df44cd8 100644 --- a/systemd-udevd/patches/0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch +++ b/systemd-udevd/patches/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch @@ -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 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 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,4 +35,5 @@ index a1305ef014..b8a73da2a3 100644 if (r > 0) -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0023-shared-Do-not-use-malloc_info-on-musl.patch b/systemd-udevd/patches/0021-shared-Do-not-use-malloc_info-on-musl.patch similarity index 86% rename from systemd-udevd/patches/0023-shared-Do-not-use-malloc_info-on-musl.patch rename to systemd-udevd/patches/0021-shared-Do-not-use-malloc_info-on-musl.patch index 149254380..7ab56ef8f 100644 --- a/systemd-udevd/patches/0023-shared-Do-not-use-malloc_info-on-musl.patch +++ b/systemd-udevd/patches/0021-shared-Do-not-use-malloc_info-on-musl.patch @@ -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 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 @@ -11,10 +11,10 @@ Signed-off-by: Khem Raj 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,4 +53,5 @@ index 8e70e365dd..9e782caec9 100644 break; } -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0024-avoid-missing-LOCK_EX-declaration.patch b/systemd-udevd/patches/0022-avoid-missing-LOCK_EX-declaration.patch similarity index 78% rename from systemd-udevd/patches/0024-avoid-missing-LOCK_EX-declaration.patch rename to systemd-udevd/patches/0022-avoid-missing-LOCK_EX-declaration.patch index 3cfff7375..d06967f8d 100644 --- a/systemd-udevd/patches/0024-avoid-missing-LOCK_EX-declaration.patch +++ b/systemd-udevd/patches/0022-avoid-missing-LOCK_EX-declaration.patch @@ -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 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 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 #include #include @@ -40,7 +40,7 @@ index ee8db04e76..2aff654f0f 100644 #if HAVE_PAM #include 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,7 +49,8 @@ index 5339bc4e5e..0697495f23 100644 #include +#include - int lock_dev_console(void); + int dev_setup(const char *prefix, uid_t uid, gid_t gid); -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0025-include-signal.h-to-avoid-the-undeclared-error.patch b/systemd-udevd/patches/0023-include-signal.h-to-avoid-the-undeclared-error.patch similarity index 51% rename from systemd-udevd/patches/0025-include-signal.h-to-avoid-the-undeclared-error.patch rename to systemd-udevd/patches/0023-include-signal.h-to-avoid-the-undeclared-error.patch index 646fac172..c8bcd9e35 100644 --- a/systemd-udevd/patches/0025-include-signal.h-to-avoid-the-undeclared-error.patch +++ b/systemd-udevd/patches/0023-include-signal.h-to-avoid-the-undeclared-error.patch @@ -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 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,16 +11,17 @@ Signed-off-by: Chen Qi 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 #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 + diff --git a/systemd-udevd/patches/0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch b/systemd-udevd/patches/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch similarity index 84% rename from systemd-udevd/patches/0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch rename to systemd-udevd/patches/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch index acbb82033..9532e6b9a 100644 --- a/systemd-udevd/patches/0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch +++ b/systemd-udevd/patches/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch @@ -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 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 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,4 +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 + diff --git a/systemd-udevd/patches/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch b/systemd-udevd/patches/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch new file mode 100644 index 000000000..d791ad2da --- /dev/null +++ b/systemd-udevd/patches/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch @@ -0,0 +1,288 @@ +From a90044320eecda424ed678d283ef60806c70fcda Mon Sep 17 00:00:00 2001 +From: Chen Qi +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 +--- + 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 + #include +-#include + #include + #include + #include +@@ -20,6 +19,8 @@ + #include "string-util.h" + #include "strv.h" + ++#include ++ + 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 +-#include +- + #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 ++#include ++ + /* 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 +-#include + #include + #include + +@@ -29,6 +27,9 @@ + #include "strv.h" + #include "unaligned.h" + ++#include ++#include ++ + 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 +-#include +-#include +-#include +- + #include "conf-parser.h" + #include "hashmap.h" + #include "l2tp-tunnel.h" +@@ -17,6 +12,10 @@ + #include "string-table.h" + #include "string-util.h" + ++#include ++#include ++#include ++ + 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 +-#include +- + #include "in-addr-util.h" + #include "netdev.h" + #include "networkd-util.h" + ++#include ++#include ++ + 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 ++#include + //#include + #include +-#include + #include + + #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 +- + #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 ++ + /* 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 +-#include + + #include "netlink-util.h" + #include "networkd-bridge-mdb.h" +@@ -13,6 +12,8 @@ + #include "string-util.h" + #include "vlan-util.h" + ++#include ++ + #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 +-#include +-#include +- + #include "alloc-util.h" + #include "event-util.h" + #include "netlink-util.h" +@@ -21,6 +17,10 @@ + #include "vrf.h" + #include "wireguard.h" + ++#include ++#include ++#include ++ + 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 +-#include + #include + + #include "alloc-util.h" +@@ -12,6 +10,9 @@ + #include "resolved-dns-stream.h" + #include "resolved-manager.h" + ++//#include ++#include ++ + #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 +-#include +-#include + #include + #include + #include +@@ -46,6 +44,9 @@ + #include "utf8.h" + #include "varlink-util.h" + ++#include ++#include ++ + #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 + #include +-#include + #include + #include + #include +@@ -47,6 +46,8 @@ + #include "time-util.h" + #include "utf8.h" + ++#include ++ + DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(config_file_hash_ops_fclose, + char, path_hash_func, path_compare, + FILE, safe_fclose); +-- +2.34.1 + diff --git a/systemd-udevd/patches/0028-build-path.c-avoid-boot-time-segfault-for-musl.patch b/systemd-udevd/patches/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch similarity index 85% rename from systemd-udevd/patches/0028-build-path.c-avoid-boot-time-segfault-for-musl.patch rename to systemd-udevd/patches/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch index 3ce494b15..a7549ee15 100644 --- a/systemd-udevd/patches/0028-build-path.c-avoid-boot-time-segfault-for-musl.patch +++ b/systemd-udevd/patches/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch @@ -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 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,4 +27,5 @@ index b5972658df..4ef551034e 100644 const char *runpath = NULL; -- -2.45.1 +2.34.1 + diff --git a/systemd-udevd/patches/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch b/systemd-udevd/patches/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch deleted file mode 100644 index f3d650e88..000000000 --- a/systemd-udevd/patches/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch +++ /dev/null @@ -1,75 +0,0 @@ -From cf94d43572770007f95b832f477aa5a03624a1e5 Mon Sep 17 00:00:00 2001 -From: Chen Qi -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 ---- - 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 -+#include - //#include - #include --#include - #include - - #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 --#include - - #include "netlink-util.h" - #include "networkd-bridge-mdb.h" -@@ -13,6 +12,8 @@ - #include "string-util.h" - #include "vlan-util.h" - -+#include -+ - #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 --#include -- - #include "alloc-util.h" - #include "event-util.h" - #include "netlink-util.h" -@@ -20,6 +17,9 @@ - #include "vrf.h" - #include "wireguard.h" - -+#include -+#include -+ - static Route* route_detach_impl(Route *route) { - assert(route); - assert(!!route->network + !!route->manager + !!route->wireguard <= 1); --- -2.45.1 diff --git a/systemd-udevd/patches/xxx-udev-dynbuf.patch b/systemd-udevd/patches/xxx-udev-dynbuf.patch new file mode 100644 index 000000000..b39eebd7e --- /dev/null +++ b/systemd-udevd/patches/xxx-udev-dynbuf.patch @@ -0,0 +1,201 @@ +From b4f60ed0752599d2e147d1ab988e91ea481bdc7f Mon Sep 17 00:00:00 2001 +From: q66 +Date: Fri, 6 Dec 2024 15:09:16 +0100 +Subject: [PATCH] dynamically allocate udev spawn result if necessary + +This allows udev not to hang when the helper output exceeds +the 16k it was previously given. +--- + src/udev/test-udev-spawn.c | 2 +- + src/udev/udev-rules.c | 9 ++++---- + src/udev/udev-spawn.c | 44 +++++++++++++++++++++++++++++++------- + src/udev/udev-spawn.h | 2 +- + 4 files changed, 43 insertions(+), 14 deletions(-) + +diff --git a/src/udev/test-udev-spawn.c b/src/udev/test-udev-spawn.c +index 7cbccf3..de8580a 100644 +--- a/src/udev/test-udev-spawn.c ++++ b/src/udev/test-udev-spawn.c +@@ -18,7 +18,7 @@ static void test_event_spawn_core(bool with_pidfd, const char *cmd, char *result + + assert_se(sd_device_new_from_syspath(&dev, "/sys/class/net/lo") >= 0); + assert_se(event = udev_event_new(dev, NULL, EVENT_TEST_SPAWN)); +- assert_se(udev_event_spawn(event, false, cmd, result_buf, buf_size, NULL) == 0); ++ assert_se(udev_event_spawn(event, false, cmd, &result_buf, buf_size, NULL) == 0); + + assert_se(unsetenv("SYSTEMD_PIDFD") >= 0); + } +diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c +index cdf648a..6e130ba 100644 +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -2089,7 +2089,7 @@ static int udev_rule_apply_token_to_event( + return token->op == (match ? OP_MATCH : OP_NOMATCH); + } + case TK_M_PROGRAM: { +- char buf[UDEV_LINE_SIZE], result[UDEV_LINE_SIZE]; ++ char buf[UDEV_LINE_SIZE], result[UDEV_LINE_SIZE], *resultp = result; + bool truncated; + size_t count; + +@@ -2102,7 +2102,7 @@ static int udev_rule_apply_token_to_event( + + log_event_debug(dev, token, "Running PROGRAM=\"%s\"", buf); + +- r = udev_event_spawn(event, /* accept_failure = */ true, buf, result, sizeof(result), NULL); ++ r = udev_event_spawn(event, /* accept_failure = */ true, buf, &resultp, sizeof(result), NULL); + if (r != 0) { + if (r < 0) + log_event_warning_errno(dev, token, r, "Failed to execute \"%s\": %m", buf); +@@ -2174,7 +2174,8 @@ static int udev_rule_apply_token_to_event( + } + case TK_M_IMPORT_PROGRAM: { + _cleanup_strv_free_ char **lines = NULL; +- char buf[UDEV_LINE_SIZE], result[UDEV_LINE_SIZE]; ++ _cleanup_free_ char *result = NULL; ++ char buf[UDEV_LINE_SIZE]; + bool truncated; + + (void) udev_event_apply_format(event, token->value, buf, sizeof(buf), false, &truncated); +@@ -2185,7 +2186,7 @@ static int udev_rule_apply_token_to_event( + + log_event_debug(dev, token, "Importing properties from results of '%s'", buf); + +- r = udev_event_spawn(event, /* accept_failure = */ true, buf, result, sizeof result, &truncated); ++ r = udev_event_spawn(event, /* accept_failure = */ true, buf, &result, 0, &truncated); + if (r != 0) { + if (r < 0) + log_event_warning_errno(dev, token, r, "Failed to execute '%s', ignoring: %m", buf); +diff --git a/src/udev/udev-spawn.c b/src/udev/udev-spawn.c +index 3f867a8..0a4adcb 100644 +--- a/src/udev/udev-spawn.c ++++ b/src/udev/udev-spawn.c +@@ -27,9 +27,10 @@ typedef struct Spawn { + bool accept_failure; + int fd_stdout; + int fd_stderr; +- char *result; ++ char **result; + size_t result_size; + size_t result_len; ++ bool truncate; + bool truncated; + } Spawn; + +@@ -41,17 +42,30 @@ static int on_spawn_io(sd_event_source *s, int fd, uint32_t revents, void *userd + int r; + + assert(fd == spawn->fd_stdout || fd == spawn->fd_stderr); +- assert(!spawn->result || spawn->result_len < spawn->result_size); ++ assert(!spawn->result || spawn->result_len < spawn->result_size || !spawn->truncate); + + if (fd == spawn->fd_stdout && spawn->result) { +- p = spawn->result + spawn->result_len; ++ p = *spawn->result + spawn->result_len; + size = spawn->result_size - spawn->result_len; + } else { + p = buf; + size = sizeof(buf); + } + +- l = read(fd, p, size - (p == buf)); ++ if (size <= 1 && !spawn->truncate) { ++ spawn->result_size *= 2; ++ p = realloc(*spawn->result, spawn->result_size); ++ if (!p) { ++ log_device_error_errno(spawn->device, errno, "Failed to reallocate buffer: %m"); ++ return 0; ++ } ++ *spawn->result = p; ++ p += spawn->result_len; ++ size = spawn->result_size - spawn->result_len; ++ } ++ ++ /* if not truncating, leave at least one character extra for safe intermediate termination */ ++ l = read(fd, p, size - (p == buf || !spawn->truncate)); + if (l < 0) { + if (errno == EAGAIN) + goto reenable; +@@ -62,7 +76,11 @@ static int on_spawn_io(sd_event_source *s, int fd, uint32_t revents, void *userd + return 0; + } + +- if ((size_t) l == size) { ++ if (p != buf && l == (size - 1) && !spawn->truncate) { ++ spawn->result_len += l; ++ p[l] = '\0'; ++ goto reenable; ++ } else if ((size_t) l == size) { + log_device_warning(spawn->device, "Truncating stdout of '%s' up to %zu byte.", + spawn->cmd, spawn->result_size); + l--; +@@ -213,7 +231,7 @@ int udev_event_spawn( + UdevEvent *event, + bool accept_failure, + const char *cmd, +- char *result, ++ char **result, + size_t result_size, + bool *ret_truncated) { + +@@ -223,6 +241,7 @@ int udev_event_spawn( + Spawn spawn; + pid_t pid; + int r; ++ bool trunc = !result || result_size != 0; + + assert(event); + assert(IN_SET(event->event_mode, EVENT_UDEV_WORKER, EVENT_UDEVADM_TEST, EVENT_TEST_RULE_RUNNER, EVENT_TEST_SPAWN)); +@@ -230,10 +249,18 @@ int udev_event_spawn( + assert(cmd); + assert(result || result_size == 0); + ++ /* allocate initial buffer */ ++ if (result && !result_size) { ++ result_size = UDEV_LINE_SIZE; ++ *result = malloc(result_size); ++ if (!*result) ++ return log_device_error_errno(event->dev, errno, "Failed to allocate buffer: %m"); ++ } ++ + if (event->event_mode == EVENT_UDEVADM_TEST && + !STARTSWITH_SET(cmd, "ata_id", "cdrom_id", "dmi_memory_id", "fido_id", "mtd_probe", "scsi_id")) { + log_device_debug(event->dev, "Running in test mode, skipping execution of '%s'.", cmd); +- result[0] = '\0'; ++ (*result)[0] = '\0'; + if (ret_truncated) + *ret_truncated = false; + return 0; +@@ -317,6 +344,7 @@ int udev_event_spawn( + .fd_stderr = errpipe[READ_END], + .result = result, + .result_size = result_size, ++ .truncate = trunc, + }; + r = spawn_wait(&spawn); + if (r < 0) +@@ -324,7 +352,7 @@ int udev_event_spawn( + "Failed to wait for spawned command '%s': %m", cmd); + + if (result) +- result[spawn.result_len] = '\0'; ++ (*result)[spawn.result_len] = '\0'; + + if (ret_truncated) + *ret_truncated = spawn.truncated; +diff --git a/src/udev/udev-spawn.h b/src/udev/udev-spawn.h +index 6b22b68..79b8a53 100644 +--- a/src/udev/udev-spawn.h ++++ b/src/udev/udev-spawn.h +@@ -16,7 +16,7 @@ int udev_event_spawn( + UdevEvent *event, + bool accept_failure, + const char *cmd, +- char *result, ++ char **result, + size_t ressize, + bool *ret_truncated); + void udev_event_execute_run(UdevEvent *event); +-- +2.47.1 + diff --git a/systemd-udevd/pkg.yaml b/systemd-udevd/pkg.yaml index fa1750b4b..70613d241 100644 --- a/systemd-udevd/pkg.yaml +++ b/systemd-udevd/pkg.yaml @@ -29,28 +29,35 @@ steps: # Patches for musl from openembedded-core, MIT licensed # Also replicated by Chimera Linux: https://github.com/chimera-linux/cports/tree/001642bd7691349e95574d93e325bb05d5dcb2c1/main/udev/patches - patch -p1 < /pkg/patches/0004-missing_type.h-add-comparison_fn_t.patch - patch -p1 < /pkg/patches/0005-add-fallback-parse_printf_format-implementation.patch - patch -p1 < /pkg/patches/0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch - patch -p1 < /pkg/patches/0008-Use-uintmax_t-for-handling-rlim_t.patch - patch -p1 < /pkg/patches/0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch - patch -p1 < /pkg/patches/0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch - patch -p1 < /pkg/patches/0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch - patch -p1 < /pkg/patches/0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch - patch -p1 < /pkg/patches/0013-avoid-redefinition-of-prctl_mm_map-structure.patch - patch -p1 < /pkg/patches/0014-do-not-disable-buffer-in-writing-files.patch - patch -p1 < /pkg/patches/0016-Handle-missing-gshadow.patch - patch -p1 < /pkg/patches/0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch - patch -p1 < /pkg/patches/0019-Adjust-for-musl-headers.patch - patch -p1 < /pkg/patches/0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch - patch -p1 < /pkg/patches/0023-shared-Do-not-use-malloc_info-on-musl.patch - patch -p1 < /pkg/patches/0024-avoid-missing-LOCK_EX-declaration.patch - patch -p1 < /pkg/patches/0025-include-signal.h-to-avoid-the-undeclared-error.patch - patch -p1 < /pkg/patches/0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch - patch -p1 < /pkg/patches/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch - patch -p1 < /pkg/patches/0028-build-path.c-avoid-boot-time-segfault-for-musl.patch + patch -p1 < /pkg/patches/0003-missing_type.h-add-comparison_fn_t.patch + patch -p1 < /pkg/patches/0004-add-fallback-parse_printf_format-implementation.patch + patch -p1 < /pkg/patches/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch + patch -p1 < /pkg/patches/0007-Use-uintmax_t-for-handling-rlim_t.patch + patch -p1 < /pkg/patches/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch + patch -p1 < /pkg/patches/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch + patch -p1 < /pkg/patches/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch + patch -p1 < /pkg/patches/0011-avoid-redefinition-of-prctl_mm_map-structure.patch + patch -p1 < /pkg/patches/0012-do-not-disable-buffer-in-writing-files.patch + patch -p1 < /pkg/patches/0014-Handle-missing-gshadow.patch + patch -p1 < /pkg/patches/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch + patch -p1 < /pkg/patches/0017-Adjust-for-musl-headers.patch + patch -p1 < /pkg/patches/0019-errno-util-Make-STRERROR-portable-for-musl.patch + patch -p1 < /pkg/patches/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch + patch -p1 < /pkg/patches/0021-shared-Do-not-use-malloc_info-on-musl.patch + patch -p1 < /pkg/patches/0022-avoid-missing-LOCK_EX-declaration.patch + patch -p1 < /pkg/patches/0023-include-signal.h-to-avoid-the-undeclared-error.patch + patch -p1 < /pkg/patches/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch + patch -p1 < /pkg/patches/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch + patch -p1 < /pkg/patches/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch - # Own patches + # General improvement from OpenEmbedded + patch -p1 < /pkg/patches/0001-Do-not-create-var-log-README.patch + + # Chimera Linux patch for ARM64 VMs, BSD-2-Clause licensed + # https://raw.githubusercontent.com/chimera-linux/cports/dabadf241e1078f5a696d6615622f67f0b1c85ac/main/udev/patches/xxx-udev-dynbuf.patch + patch -p1 < /pkg/patches/xxx-udev-dynbuf.patch + + # Own fixes for musl patch -p1 < /pkg/patches/0001-chore-musl-headers-compatibility-for-udev.patch meson setup build \