musl: avoid redefinition error on ethhdr
PATCH 1/2 musl: avoid redefinition error on ethhdr
From: Chen Qi <[email protected]>
This __UAPI_DEF_ETHHDR macro should be defined right after the definition of 'struct ethhdr', otherwise, we'll get re-definition error in some case. This is because the lines under 'struct ethhdr' definition are header file inclusion lines and those header files might also check __UAPI_DEF_ETHHDR and define ethhdr, resulting in redefinition error.
Another problem is that if_ether.h in musl should also consider the possibility that other header files included before it also defines struct ethhdr and __UAPI_DEF_ETHHDR.
--- ...if_ether.h-define-__UAPI_DEF_ETHHDR-.patch | 39 +++++++++++++++++++ ...if_ether.h-guard-ethhdr-definition-t.patch | 39 +++++++++++++++++++ meta/recipes-core/musl/musl_git.bb | 2 + 3 files changed, 80 insertions(+) create mode 100644 meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch create mode 100644 meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch
meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 5ab64f7e08ea0325d83d446dd4015f82b4c179dd Mon Sep 17 00:00:00 2001 +From: Chen Qi <[email protected]> +Date: Mon, 29 Sep 2025 21:39:01 +0800 +Subject: [PATCH] include/netinet/if_ether.h: define __UAPI_DEF_ETHHDR early + +After 'struct ethhdr' is defined, we should immediately define +__UAPI_DEF_ETHHDR. Because the following lines are header inclusion +lines which might introduce header files checking __UAPI_DEF_ETHHDR. +If we don't define this macro early, we will get redefinition error. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/1] + +Signed-off-by: Chen Qi <[email protected]> +--- + include/netinet/if_ether.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h +index 3479f511..b1646f6f 100644 +--- a/include/netinet/if_ether.h ++++ b/include/netinet/if_ether.h +@@ -117,6 +117,7 @@ struct ethhdr { + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; + }; ++#define __UAPI_DEF_ETHHDR 0 + + #include <net/ethernet.h> + #include <net/if_arp.h> +@@ -144,6 +145,4 @@ do { \ + (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \ + } while(0) + +-#define __UAPI_DEF_ETHHDR 0 +- + #endif +-- +2.34.1 +
meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 67976391887c3c65138a3b6fc306f2f5b490aeb4 Mon Sep 17 00:00:00 2001 +From: Chen Qi <[email protected]> +Date: Tue, 30 Sep 2025 10:42:51 +0800 +Subject: [PATCH] include/netinet/if_ether.h: guard ethhdr definition to better + work with other header files + +The unconditional definition of 'struct ethhdr' has the implicit +requirement on this header file, that is, it needs to be included +before other header files defining ethhdr. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/2] + +Signed-off-by: Chen Qi <[email protected]> +--- + include/netinet/if_ether.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h +index b1646f6f..e5a1ebd0 100644 +--- a/include/netinet/if_ether.h ++++ b/include/netinet/if_ether.h +@@ -112,12 +112,14 @@ + #define ETH_P_XDSA 0x00F8 + #define ETH_P_MAP 0x00F9 + ++#ifndef __UAPI_DEF_ETHHDR + struct ethhdr { + uint8_t h_dest[ETH_ALEN]; + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; + }; + #define __UAPI_DEF_ETHHDR 0 ++#endif + + #include <net/ethernet.h> + #include <net/if_arp.h> +-- +2.34.1 +
meta/recipes-core/musl/musl_git.bb +2 -0
@@ -14,6 +14,8 @@ SRC_URI = "git://git.musl-libc.org/musl;branch=master \ file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ file://0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch \ + file://0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch \ + file://0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch \ " PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"
Signature · 1 line
2.34.1
PATCH 2/2 systemd: upgrade from 257.8 to 258
From: Chen Qi <[email protected]>
258 Release Changes:
https://github.com/systemd/systemd/releases/tag/v258
The 'runlevel', 'initctl', 'telinit' related contents are removed because they are offically removed in v258.
Disable tests explicitly. This is because we're not installing any tests. There's no point building them out. And this puts extra burden on making things compile for musl.
musl changes:
1. The -D__UAPI_DEF_ETHHDR=0 is removed from TARGET_CC_ARCH. The __UAIP_DEF_ETHHDR is defined as 0 in netinet/if_ether.h in musl. There's no need to explicitly define it in compiler commandline. And such explicit definition will break the logic of the header files in systemd, resulting in extra patches.
2. All patches are re-evaluated.
This version of systemd introduces big changes in header files and other places. So the previous musl patches are re-evaluated one by one. Those that are dropped are considered not needed. A few new ones are added. There are some notable ones. 0012-do-not-disable-buffer-in-writing-files.patch is dropped because there is not runtime error. 0016-Fix-the-segfault-for-glob-related-codes-and-define-d.patch is added because this version of systemd uses strv_free to free gl_pathv instead of relying on globfree provided by libc.
3. The 'struct ethhdr' re-definition error is solved in musl recipe. If musl upstream does not accept the patches, we'll need to use previous method and change quite a few files.
https://www.openwall.com/lists/musl/2025/09/30/1
https://www.openwall.com/lists/musl/2025/09/30/2
---
...ve_257.8.bb => systemd-boot-native_258.bb} | 0
...temd-boot_257.8.bb => systemd-boot_258.bb} | 0
...7.8.bb => systemd-systemctl-native_258.bb} | 0
meta/recipes-core/systemd/systemd.inc | 4 +-
...tall-dependency-links-at-install-tim.patch | 10 +-
...implment-systemd-sysv-install-for-OE.patch | 13 +-
...> 0003-Do-not-create-var-log-README.patch} | 9 +-
...3-missing_type.h-add-comparison_fn_t.patch | 61 --
...ntroduce-header-file-and-add-__THROW.patch | 61 ++
...-parse_printf_format-implementation.patch} | 79 +--
...OB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | 156 ------
...info-related-contents-glibc-specific.patch | 117 ++++
...006-add-missing-FTW_-macros-for-musl.patch | 44 --
...07-Use-uintmax_t-for-handling-rlim_t.patch | 106 ----
...override-sys-prctl.h-to-avoid-redefi.patch | 43 ++
...patible-basename-for-non-glibc-syste.patch | 34 --
...ompliant-strerror_r-from-GNU-specif.patch} | 20 +-
...uffering-when-writing-to-oom_score_a.patch | 41 --
...til-Make-STRERROR-portable-for-musl.patch} | 17 +-
...-util.h-define-RLIM_FMT-to-fit-musl-.patch | 40 ++
...definition-of-prctl_mm_map-structure.patch | 32 --
...ride-malloc.h-define-dummy-malloc_tr.patch | 41 ++
...-not-disable-buffer-in-writing-files.patch | 530 ------------------
...tion.c-avoid-using-glibc-ConditionVe.patch | 47 ++
.../0013-Handle-__cpu_mask-usage.patch | 60 --
...c-avoid-boot-time-segfault-for-musl.patch} | 8 +-
...014-Handle-missing-gshadow-for-musl.patch} | 77 +--
.../0015-Avoid-sequence-point-error.patch | 35 ++
...l.h-Define-MIPS-ABI-defines-for-musl.patch | 42 --
...-for-glob-related-codes-and-define-d.patch | 409 ++++++++++++++
...ass-correct-parameters-to-getdents64.patch | 37 --
.../0017-Adjust-for-musl-headers.patch | 526 -----------------
...trerror-is-assumed-to-be-GNU-specifi.patch | 52 --
...ake-malloc_trim-conditional-on-glibc.patch | 39 --
...hared-Do-not-use-malloc_info-on-musl.patch | 57 --
...22-avoid-missing-LOCK_EX-declaration.patch | 56 --
...gnal.h-to-avoid-the-undeclared-error.patch | 27 -
...references-using-stdin-as-a-struct-m.patch | 48 --
...clusion-order-to-avoid-redeclaration.patch | 288 ----------
.../{systemd_257.8.bb => systemd_258.bb} | 66 +--
40 files changed, 926 insertions(+), 2406 deletions(-)
rename meta/recipes-core/systemd/{systemd-boot-native_257.8.bb => systemd-boot-native_258.bb} (100%)
rename meta/recipes-core/systemd/{systemd-boot_257.8.bb => systemd-boot_258.bb} (100%)
rename meta/recipes-core/systemd/{systemd-systemctl-native_257.8.bb => systemd-systemctl-native_258.bb} (100%)
rename meta/recipes-core/systemd/systemd/{0001-Do-not-create-var-log-README.patch => 0003-Do-not-create-var-log-README.patch} (84%)
delete mode 100644 meta/recipes-core/systemd/systemd/0003-missing_type.h-add-comparison_fn_t.patch
create mode 100644 meta/recipes-core/systemd/systemd/0004-musl.h-introduce-header-file-and-add-__THROW.patch
rename meta/recipes-core/systemd/systemd/{0004-add-fallback-parse_printf_format-implementation.patch => 0005-add-fallback-parse_printf_format-implementation.patch} (88%)
delete mode 100644 meta/recipes-core/systemd/systemd/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
create mode 100644 meta/recipes-core/systemd/systemd/0006-Make-mallinfo-related-contents-glibc-specific.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0006-add-missing-FTW_-macros-for-musl.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0007-Use-uintmax_t-for-handling-rlim_t.patch
create mode 100644 meta/recipes-core/systemd/systemd/0007-add-src-include-override-sys-prctl.h-to-avoid-redefi.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch
rename meta/recipes-core/systemd/systemd/{0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch => 0008-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch} (77%)
delete mode 100644 meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
rename meta/recipes-core/systemd/systemd/{0019-errno-util-Make-STRERROR-portable-for-musl.patch => 0009-errno-util-Make-STRERROR-portable-for-musl.patch} (72%)
create mode 100644 meta/recipes-core/systemd/systemd/0010-src-basic-format-util.h-define-RLIM_FMT-to-fit-musl-.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch
create mode 100644 meta/recipes-core/systemd/systemd/0011-src-include-override-malloc.h-define-dummy-malloc_tr.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch
create mode 100644 meta/recipes-core/systemd/systemd/0012-src-shared-condition.c-avoid-using-glibc-ConditionVe.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch
rename meta/recipes-core/systemd/systemd/{0026-build-path.c-avoid-boot-time-segfault-for-musl.patch => 0013-build-path.c-avoid-boot-time-segfault-for-musl.patch} (77%)
rename meta/recipes-core/systemd/systemd/{0014-Handle-missing-gshadow.patch => 0014-Handle-missing-gshadow-for-musl.patch} (71%)
create mode 100644 meta/recipes-core/systemd/systemd/0015-Avoid-sequence-point-error.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
create mode 100644 meta/recipes-core/systemd/systemd/0016-Fix-the-segfault-for-glob-related-codes-and-define-d.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0023-include-signal.h-to-avoid-the-undeclared-error.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch
delete mode 100644 meta/recipes-core/systemd/systemd/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch
rename meta/recipes-core/systemd/{systemd_257.8.bb => systemd_258.bb} (92%)meta/recipes-core/systemd/systemd-boot-native_258.bb renamed from meta/recipes-core/systemd/systemd-boot-native_257.8.bb +0 -0
meta/recipes-core/systemd/systemd-boot_258.bb renamed from meta/recipes-core/systemd/systemd-boot_257.8.bb +0 -0
meta/recipes-core/systemd/systemd-systemctl-native_258.bb renamed from meta/recipes-core/systemd/systemd-systemctl-native_257.8.bb +0 -0
meta/recipes-core/systemd/systemd.inc +2 -2
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later" LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" -SRCREV = "5e38d199a623563698ab4a69acbbe3afa9135198" -SRCBRANCH = "v257-stable" +SRCREV = "781d9d0789379d1ea1f2ecefb804d41e9c8b6c38" +SRCBRANCH = "v258-stable" SRC_URI = "git://github.com/systemd/systemd.git;protocol=https;branch=${SRCBRANCH};tag=v${PV}" CVE_PRODUCT = "systemd"
meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch +5 -5
@@ -1,7 +1,7 @@ -From e5fd143f215f072404c544f694cb026a4231503e Mon Sep 17 00:00:00 2001 +From b1ab58d3b4a8164e5978409706d6769f5cfde404 Mon Sep 17 00:00:00 2001 From: Chen Qi <[email protected]> Date: Thu, 21 Feb 2019 16:23:24 +0800 -Subject: [PATCH 01/26] binfmt: Don't install dependency links at install time +Subject: [PATCH 01/16] binfmt: Don't install dependency links at install time for the binfmt services use [Install] blocks so that they get created when the service is enabled
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]> 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/units/meson.build b/units/meson.build -index 96f4852741..0a3a4fee67 100644 +index 4f47a3b2bd..237870025b 100644 --- a/units/meson.build +++ b/units/meson.build -@@ -156,7 +156,6 @@ units = [ +@@ -154,7 +154,6 @@ units = [ { 'file' : 'proc-sys-fs-binfmt_misc.automount', 'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index 96f4852741..0a3a4fee67 100644 }, { 'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -258,7 +257,6 @@ units = [ +@@ -263,7 +262,6 @@ units = [ { 'file' : 'systemd-binfmt.service.in', 'conditions' : ['ENABLE_BINFMT'],
meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch +8 -5
@@ -1,7 +1,7 @@ -From 4a5602ede9881fd8e578a3c8bc40dd5df7c4d802 Mon Sep 17 00:00:00 2001 +From 08ab9f1eaa86ca2c6a0bb45219a0153495708acb Mon Sep 17 00:00:00 2001 From: Khem Raj <[email protected]> Date: Sat, 5 Sep 2015 06:31:47 +0000 -Subject: [PATCH] implement systemd-sysv-install for OE +Subject: [PATCH 02/16] implment systemd-sysv-install for OE Use update-rc.d for enabling/disabling and status command to check the status of the sysv service
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <[email protected]> 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON -index cb58d8243b..eff3f5f579 100755 +index cb58d8243b..000bdf6165 100755 --- a/src/systemctl/systemd-sysv-install.SKELETON +++ b/src/systemctl/systemd-sysv-install.SKELETON @@ -34,17 +34,17 @@ case "$1" in
@@ -22,13 +22,13 @@ index cb58d8243b..eff3f5f579 100755 # call the command to enable SysV init script $NAME here # (consider optional $ROOT) - echo "IMPLEMENT ME: enabling SysV init.d script $NAME" -+ update-rc.d ${ROOT:+-r $ROOT} -f $NAME defaults ++ update-rc.d -f $NAME defaults ;; disable) # call the command to disable SysV init script $NAME here # (consider optional $ROOT) - echo "IMPLEMENT ME: disabling SysV init.d script $NAME" -+ update-rc.d ${ROOT:+-r $ROOT} -f $NAME remove ++ update-rc.d -f $NAME remove ;; is-enabled) # exit with 0 if $NAME is enabled, non-zero if it is disabled
@@ -38,3 +38,6 @@ index cb58d8243b..eff3f5f579 100755 ;; *) usage ;; +-- +2.34.1 +
meta/recipes-core/systemd/systemd/0003-Do-not-create-var-log-README.patch renamed from meta/recipes-core/systemd/systemd/0001-Do-not-create-var-log-README.patch +6 -3
@@ -1,7 +1,7 @@ -From 425ad51e727058b48dd4580fd6afe7e51e96a28a Mon Sep 17 00:00:00 2001 +From a7f6a296707642d05463aec22ea3dfce7d06c989 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt <[email protected]> Date: Tue, 21 Jan 2025 05:02:00 +0100 -Subject: [PATCH] Do not create /var/log/README +Subject: [PATCH 03/16] 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
@@ -15,7 +15,7 @@ Signed-off-by: Peter Kjellerstedt <[email protected]> 1 file changed, 3 deletions(-) diff --git a/tmpfiles.d/legacy.conf.in b/tmpfiles.d/legacy.conf.in -index b475500e58..650c91a8da 100644 +index cdef21fa9b..03798c953e 100644 --- a/tmpfiles.d/legacy.conf.in +++ b/tmpfiles.d/legacy.conf.in @@ -13,9 +13,6 @@
@@ -28,3 +28,6 @@ index b475500e58..650c91a8da 100644 {% if HAVE_SYSV_COMPAT %} # /run/lock/subsys is used for serializing SysV service execution, and +-- +2.34.1 +
meta/recipes-core/systemd/systemd/0003-missing_type.h-add-comparison_fn_t.patch deleted +0 -61
61 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0004-musl.h-introduce-header-file-and-add-__THROW.patch new file +61 -0
61 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0005-add-fallback-parse_printf_format-implementation.patch renamed from meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch +28 -51
138 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch deleted +0 -156
156 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0006-Make-mallinfo-related-contents-glibc-specific.patch new file +117 -0
117 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0006-add-missing-FTW_-macros-for-musl.patch deleted +0 -44
44 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0007-Use-uintmax_t-for-handling-rlim_t.patch deleted +0 -106
106 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0007-add-src-include-override-sys-prctl.h-to-avoid-redefi.patch new file +43 -0
43 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch deleted +0 -34
@@ -1,34 +0,0 @@ -From f4cd939c7cc1ce0a59bab2693768f2c95d9ced00 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sun, 27 May 2018 08:36:44 -0700 -Subject: [PATCH 08/26] Define glibc compatible basename() for non-glibc - systems - -Fixes builds with musl, even though systemd is adamant about -using non-posix basename implementation, we have a way out - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <[email protected]> ---- - src/basic/string-util.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/basic/string-util.h b/src/basic/string-util.h -index cc6aa183c0..0b035125cd 100644 ---- a/src/basic/string-util.h -+++ b/src/basic/string-util.h -@@ -27,6 +27,10 @@ - #define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */ - #define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */ - -+#if !defined(__GLIBC__) -+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) -+#endif -+ - static inline char* strstr_ptr(const char *haystack, const char *needle) { - if (!haystack || !needle) - return NULL; --- -2.34.1 -
meta/recipes-core/systemd/systemd/0008-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch renamed from meta/recipes-core/systemd/systemd/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +10 -10
@@ -1,10 +1,10 @@ -From b7f6c245b4ae72999f23eecc2bbb6d6fb8db667c Mon Sep 17 00:00:00 2001 +From bbe0096367618026fe5ebb81c266fd50084f113a Mon Sep 17 00:00:00 2001 From: Chen Qi <[email protected]> Date: Tue, 10 Jul 2018 15:40:17 +0800 -Subject: [PATCH 10/26] distinguish XSI-compliant strerror_r from GNU-specifi +Subject: [PATCH 08/16] distinguish XSI-compliant strerror_r from GNU-specific strerror_r -XSI-compliant strerror_r and GNU-specifi strerror_r are different. +XSI-compliant strerror_r and GNU-specific strerror_r are different. int strerror_r(int errnum, char *buf, size_t buflen); /* XSI-compliant */
@@ -24,10 +24,10 @@ Signed-off-by: Chen Qi <[email protected]> 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 58c24d25c0..69a0d09d42 100644 +index bc0164c1b4..e69ffe4f75 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c -@@ -405,7 +405,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { +@@ -400,7 +400,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { return; errno = 0;
@@ -40,25 +40,25 @@ index 58c24d25c0..69a0d09d42 100644 if (errno == ERANGE || strlen(x) >= k - 1) { free(m); k *= 2; -@@ -590,8 +595,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static +@@ -585,8 +590,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static if (e && e->message) return e->message; - +#ifndef __GLIBC__ -+ strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++ strerror_r(ABS(error), buf, ERRNO_BUF_LEN); + return buf; +#else - return strerror_r(abs(error), buf, ERRNO_BUF_LEN); + return strerror_r(ABS(error), buf, ERRNO_BUF_LEN); +#endif } static bool map_ok(const sd_bus_error_map *map) { diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c -index 75e8e08add..41e5c7c2b8 100644 +index e838e7e0d7..28b6e014c0 100644 --- a/src/libsystemd/sd-journal/journal-send.c +++ b/src/libsystemd/sd-journal/journal-send.c -@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove +@@ -338,7 +338,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove char* j; errno = 0;
meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch deleted +0 -41
41 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0009-errno-util-Make-STRERROR-portable-for-musl.patch renamed from meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch +10 -7
@@ -1,7 +1,7 @@ -From 28fa1d5f56c6ddee9e336e6f2051c55e9f2f98b4 Mon Sep 17 00:00:00 2001 +From 7ce68a17deeda43c31a5de5956bad4c92481f1ca Mon Sep 17 00:00:00 2001 From: Khem Raj <[email protected]> Date: Mon, 23 Jan 2023 23:39:46 -0800 -Subject: [PATCH 19/26] errno-util: Make STRERROR portable for musl +Subject: [PATCH 09/16] 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
@@ -10,27 +10,30 @@ non-glibc hosts Upstream-Status: Inappropriate [musl specific] Signed-off-by: Khem Raj <[email protected]> + +Rebased for v258 +Signed-off-by: Chen Qi <[email protected]> --- src/basic/errno-util.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h -index 48b76e4bf7..6e7653e2d9 100644 +index 5fe337cfb1..dee34167cb 100644 --- a/src/basic/errno-util.h +++ b/src/basic/errno-util.h -@@ -15,8 +15,16 @@ +@@ -13,8 +13,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) +-#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); ++ 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; ++ 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.
meta/recipes-core/systemd/systemd/0010-src-basic-format-util.h-define-RLIM_FMT-to-fit-musl-.patch new file +40 -0
@@ -0,0 +1,40 @@ +From adf7bd6cf6305f5454cfb1ad4f1755880e831f7e Mon Sep 17 00:00:00 2001 +From: Chen Qi <[email protected]> +Date: Mon, 29 Sep 2025 14:41:52 +0800 +Subject: [PATCH 10/16] src/basic/format-util.h: define RLIM_FMT to fit musl's + rlim_t definition + +musl always defines rlim_t to be "unsigned long long". + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <[email protected]> +--- + src/basic/format-util.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/basic/format-util.h b/src/basic/format-util.h +index e42f788ce6..9275f9615d 100644 +--- a/src/basic/format-util.h ++++ b/src/basic/format-util.h +@@ -39,6 +39,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); + # error Unknown timex member size + #endif + ++#ifdef __GLIBC__ + #if SIZEOF_RLIM_T == 8 + # define RLIM_FMT "%" PRIu64 + #elif SIZEOF_RLIM_T == 4 +@@ -46,6 +47,9 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); + #else + # error Unknown rlim_t size + #endif ++#else ++#define RLIM_FMT "%llu" ++#endif + + #if SIZEOF_DEV_T == 8 + # define DEV_FMT "%" PRIu64 +-- +2.34.1 +
meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch deleted +0 -32
@@ -1,32 +0,0 @@ -From 43b0269e850a2fbcb6ca615258aa8f8a9b4f6a9d Mon Sep 17 00:00:00 2001 -From: Chen Qi <[email protected]> -Date: Mon, 25 Feb 2019 15:44:54 +0800 -Subject: [PATCH 11/26] avoid redefinition of prctl_mm_map structure - -Fix the following compile failure: -error: redefinition of 'struct prctl_mm_map' - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <[email protected]> ---- - src/basic/missing_prctl.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h -index 2c9f9f6c50..65a984b564 100644 ---- a/src/basic/missing_prctl.h -+++ b/src/basic/missing_prctl.h -@@ -1,7 +1,9 @@ - /* SPDX-License-Identifier: LGPL-2.1-or-later */ - #pragma once - -+#ifdef __GLIBC__ - #include <linux/prctl.h> -+#endif - - #include "macro.h" - --- -2.34.1 -
meta/recipes-core/systemd/systemd/0011-src-include-override-malloc.h-define-dummy-malloc_tr.patch new file +41 -0
41 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch deleted +0 -530
530 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0012-src-shared-condition.c-avoid-using-glibc-ConditionVe.patch new file +47 -0
47 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch deleted +0 -60
60 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0013-build-path.c-avoid-boot-time-segfault-for-musl.patch renamed from meta/recipes-core/systemd/systemd/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch +4 -4
@@ -1,7 +1,7 @@ -From f2a7cf1d2a2bc2516a180809efd85c828cd9c7f4 Mon Sep 17 00:00:00 2001 +From a4b921b8d408e0f1c9d035a3ec93c3da3fe42352 Mon Sep 17 00:00:00 2001 From: Chen Qi <[email protected]> Date: Wed, 3 Jul 2024 07:18:42 -0700 -Subject: [PATCH 26/26] build-path.c: avoid boot time segfault for musl +Subject: [PATCH 13/16] 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
@@ -15,10 +15,10 @@ Signed-off-by: Chen Qi <[email protected]> 1 file changed, 1 insertion(+) diff --git a/src/basic/build-path.c b/src/basic/build-path.c -index b5972658df..4ef551034e 100644 +index 577ff72bce..3a7876798c 100644 --- a/src/basic/build-path.c +++ b/src/basic/build-path.c -@@ -151,6 +151,7 @@ int get_build_exec_dir(char **ret) { +@@ -152,6 +152,7 @@ int get_build_exec_dir(char **ret) { */ static int runpath_cached = -ERRNO_MAX-1;
meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow-for-musl.patch renamed from meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch +40 -37
162 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0015-Avoid-sequence-point-error.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 5dbeaee2085d3edcf20983fce4208eb174e46422 Mon Sep 17 00:00:00 2001 +From: Chen Qi <[email protected]> +Date: Thu, 9 Oct 2025 15:19:09 +0800 +Subject: [PATCH 15/16] Avoid sequence-point error + +See https://www.openwall.com/lists/musl/2025/09/30/4 + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <[email protected]> +--- + src/shared/cpu-set-util.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/shared/cpu-set-util.c b/src/shared/cpu-set-util.c +index 7a155c12d4..a9c57fc31c 100644 +--- a/src/shared/cpu-set-util.c ++++ b/src/shared/cpu-set-util.c +@@ -97,9 +97,11 @@ char* cpu_set_to_mask_string(const CPUSet *c) { + for (size_t i = c->allocated * 8; i > 0; ) { + uint32_t m = 0; + +- for (int j = (i % 32 ?: 32) - 1; j >= 0; j--) +- if (CPU_ISSET_S(--i, c->allocated, c->set)) ++ for (int j = (i % 32 ?: 32) - 1; j >= 0; j--) { ++ --i; ++ if (CPU_ISSET_S(i, c->allocated, c->set)) + SET_BIT(m, j); ++ } + + if (!found_nonzero) { + if (m == 0) +-- +2.34.1 +
meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch deleted +0 -42
42 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0016-Fix-the-segfault-for-glob-related-codes-and-define-d.patch new file +409 -0
409 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch deleted +0 -37
@@ -1,37 +0,0 @@ -From 9079b158779a9c395c24f882f72a1c734795045d Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Fri, 21 Jan 2022 15:15:11 -0800 -Subject: [PATCH 16/26] pass correct parameters to getdents64 - -Fixes -../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] - n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] - n = getdents64(fd, &buffer, sizeof(buffer)); - ^~~~~~~ - -Upstream-Status: Inappropriate [musl specific] -Signed-off-by: Khem Raj <[email protected]> -Signed-off-by: Jiaqing Zhao <[email protected]> ---- - src/basic/recurse-dir.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c -index 378fd92b06..5b567b457d 100644 ---- a/src/basic/recurse-dir.c -+++ b/src/basic/recurse-dir.c -@@ -56,7 +56,7 @@ int readdir_all(int dir_fd, - bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX); - assert(bs > de->buffer_size); - -- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); -+ n = getdents64(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size); - if (n < 0) - return -errno; - if (n == 0) --- -2.34.1 -
meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch deleted +0 -526
526 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch deleted +0 -52
18 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch deleted +0 -39
Lines of this file are not shown. View the raw message.
meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch deleted +0 -57
57 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch deleted +0 -56
56 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0023-include-signal.h-to-avoid-the-undeclared-error.patch deleted +0 -27
Lines of this file are not shown. View the raw message.
meta/recipes-core/systemd/systemd/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch deleted +0 -48
48 lines not on this page · raw message
meta/recipes-core/systemd/systemd/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch deleted +0 -288
288 lines not on this page · raw message
meta/recipes-core/systemd/systemd_258.bb renamed from meta/recipes-core/systemd/systemd_257.8.bb +20 -46
66 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
Re: [OE-core][PATCH 2/2] systemd: upgrade from 257.8 to 258
Quoted 34 lines · Chen Qi via lists.openembedded.org
From: Chen Qi <[email protected]>
258 Release Changes:
https://github.com/systemd/systemd/releases/tag/v258The 'runlevel', 'initctl', 'telinit' related contents are removed because they are offically removed in v258.
Disable tests explicitly. This is because we're not installing any tests. There's no point building them out. And this puts extra burden on making things compile for musl.
musl changes:
1. The -D__UAPI_DEF_ETHHDR=0 is removed fromTARGET_CC_ARCH. The__UAIP_DEF_ETHHDRis defined as 0 innetinet/if_ether.hin musl. There's no need to explicitly define it in compiler commandline. And such explicit definition will break the logic of the header files in systemd, resulting in extra patches.
2. All patches are re-evaluated.
This version of systemd introduces big changes in header files and other places. So the previous musl patches are re-evaluated one by one. Those that are dropped are considered not needed. A few new ones are added. There are some notable ones. 0012-do-not-disable-buffer-in-writing-files.patch is dropped because there is not runtime error. 0016-Fix-the-segfault-for-glob-related-codes-and-define-d.patch is added because this version of systemd usesstrv_freeto freegl_pathvinstead of relying on globfree provided by libc.
3. The 'struct ethhdr' re-definition error is solved in musl recipe. If musl upstream does not accept the patches, we'll need to use previous method and change quite a few files.
https://www.openwall.com/lists/musl/2025/09/30/1
https://www.openwall.com/lists/musl/2025/09/30/2
Quoted 2 lines
Signed-off-by Chen Qi <[email protected]>---
Hi Chen,
I saw your message saying this is not ready to merge, but I already had this in testing and got some warnings:
WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: Group clock has never been defined
https://autobuilder.yoctoproject.org/valkyrie/#/builders/20/builds/2560
They do appear while building with poky-altcfg distro, for all machines and probably all images. It was confirmed here with core-image-minimal.
Can you investigate this before your next iteration?
Thanks,
Mathieu
Signature · 3 lines
Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [OE-core][PATCH 2/2] systemd: upgrade from 257.8 to 258
Quoted 42 lines · Mathieu Dubois-Briand
Quoted 34 lines · Chen Qi via lists.openembedded.org
From: Chen Qi <[email protected]>
258 Release Changes:
https://github.com/systemd/systemd/releases/tag/v258The 'runlevel', 'initctl', 'telinit' related contents are removed because they are offically removed in v258.
Disable tests explicitly. This is because we're not installing any tests. There's no point building them out. And this puts extra burden on making things compile for musl.
musl changes:
1. The -D__UAPI_DEF_ETHHDR=0 is removed fromTARGET_CC_ARCH. The__UAIP_DEF_ETHHDRis defined as 0 innetinet/if_ether.hin musl. There's no need to explicitly define it in compiler commandline. And such explicit definition will break the logic of the header files in systemd, resulting in extra patches.
2. All patches are re-evaluated.
This version of systemd introduces big changes in header files and other places. So the previous musl patches are re-evaluated one by one. Those that are dropped are considered not needed. A few new ones are added. There are some notable ones. 0012-do-not-disable-buffer-in-writing-files.patch is dropped because there is not runtime error. 0016-Fix-the-segfault-for-glob-related-codes-and-define-d.patch is added because this version of systemd usesstrv_freeto freegl_pathvinstead of relying on globfree provided by libc.
3. The 'struct ethhdr' re-definition error is solved in musl recipe. If musl upstream does not accept the patches, we'll need to use previous method and change quite a few files.
https://www.openwall.com/lists/musl/2025/09/30/1
https://www.openwall.com/lists/musl/2025/09/30/2Quoted 2 lines
Signed-off-by Chen Qi <[email protected]>---
Hi Chen,
I saw your message saying this is not ready to merge, but I already had this in testing and got some warnings:
Quoted 8 lines
WARNING: core-image-full-cmdline-1.0-r0
do_rootfs: Group clock has never been definedhttps://autobuilder.yoctoproject.org/valkyrie/#/builders/20/builds/2560
They do appear while building with poky-altcfg distro, for all machines and probably all images. It was confirmed here with core-image-minimal.
Can you investigate this before your next iteration?
Yes, I will. Thanks for telling me this.
Regards,
Qi
Quoted 4 lines
Thanks,
Mathieu
Sorry for the inconvenience.
But please don't merge these two patches.
I just got a clear message from musl community that the second patch is not appropriate.
https://www.openwall.com/lists/musl/2025/10/14/2
I'll re-work on musl and systemd upgrade and send out V2.
Regards,
Qi
Quoted 134 lines · Chen Qi via lists.openembedded.org
From: Chen Qi <[email protected]>
This
__UAPI_DEF_ETHHDRmacro should be defined right after the definition of 'struct ethhdr', otherwise, we'll get re-definition error in some case. This is because the lines under 'struct ethhdr' definition are header file inclusion lines and those header files might also check__UAPI_DEF_ETHHDRand define ethhdr, resulting in redefinition error.Another problem is that
if_ether.hin musl should also consider the possibility that other header files included before it also defines struct ethhdr and__UAPI_DEF_ETHHDR.Signed-off-by Chen Qi <[email protected]>--- ...if_ether.h-define-__UAPI_DEF_ETHHDR-.patch | 39 +++++++++++++++++++ ...if_ether.h-guard-ethhdr-definition-t.patch | 39 +++++++++++++++++++ meta/recipes-core/musl/musl_git.bb | 2 + 3 files changed, 80 insertions(+)create mode 100644
meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patchcreate mode 100644meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patchmeta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch new file +39
-0@@ -0,0 +1,39 @@ +From 5ab64f7e08ea0325d83d446dd4015f82b4c179dd Mon Sep 17 00:00:00 2001 +From: Chen Qi <[email protected]> +Date: Mon, 29 Sep 2025 21:39:01 +0800 +Subject: [PATCH] include/netinet/if_ether.h: define __UAPI_DEF_ETHHDR early + +After 'struct ethhdr' is defined, we should immediately define +__UAPI_DEF_ETHHDR. Because the following lines are header inclusion +lines which might introduce header files checking __UAPI_DEF_ETHHDR. +If we don't define this macro early, we will get redefinition error. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/1] + +Signed-off-by: Chen Qi <[email protected]> +--- + include/netinet/if_ether.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h +index 3479f511..b1646f6f 100644 +--- a/include/netinet/if_ether.h ++++ b/include/netinet/if_ether.h +@@ -117,6 +117,7 @@ struct ethhdr { + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; + }; ++#define __UAPI_DEF_ETHHDR 0 + + #include <net/ethernet.h> + #include <net/if_arp.h> +@@ -144,6 +145,4 @@ do { \ + (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \ + } while(0) + +-#define __UAPI_DEF_ETHHDR 0 +- + #endif +-- +2.34.1 +meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch new file +39
-0@@ -0,0 +1,39 @@ +From 67976391887c3c65138a3b6fc306f2f5b490aeb4 Mon Sep 17 00:00:00 2001 +From: Chen Qi <[email protected]> +Date: Tue, 30 Sep 2025 10:42:51 +0800 +Subject: [PATCH] include/netinet/if_ether.h: guard ethhdr definition to better + work with other header files + +The unconditional definition of 'struct ethhdr' has the implicit +requirement on this header file, that is, it needs to be included +before other header files defining ethhdr. + +Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/09/30/2] + +Signed-off-by: Chen Qi <[email protected]> +--- + include/netinet/if_ether.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h +index b1646f6f..e5a1ebd0 100644 +--- a/include/netinet/if_ether.h ++++ b/include/netinet/if_ether.h +@@ -112,12 +112,14 @@ + #define ETH_P_XDSA 0x00F8 + #define ETH_P_MAP 0x00F9 + ++#ifndef __UAPI_DEF_ETHHDR + struct ethhdr { + uint8_t h_dest[ETH_ALEN]; + uint8_t h_source[ETH_ALEN]; + uint16_t h_proto; + }; + #define __UAPI_DEF_ETHHDR 0 ++#endif + + #include <net/ethernet.h> + #include <net/if_arp.h> +-- +2.34.1 +meta/recipes-core/musl/musl_git.bb +2
-1@@ -14,6 +14,8 @@ SRC_URI = "git://git.musl-libc.org/musl;branch=master \ file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ file://0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch \ + file://0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch \ + file://0001-include-netinet-if_ether.h-guard-ethhdr-definition-t.patch \ " PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#224817): https://lists.openembedded.org/g/openembedded-core/message/224817
Mute This Topic: https://lists.openembedded.org/mt/115751322/7304865
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-