Message ID | 20251016011104.145401-1-Qi.Chen@windriver.com |
---|---|
State | New |
Headers | show |
Series | [V2,1/3] musl: avoid redefinition error on ethhdr | expand |
On Wed, Oct 15, 2025 at 6:11 PM Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > > From: Chen Qi <Qi.Chen@windriver.com> > > 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. > I think this patch is not on sound footing. I do not like us patching libc APIs unless its something upstream accepts. We can cause unintended behavioural changes on yocto based musl systems in future and we have to support this forever. Perhaps it's better to fix systemd even if the patch to systemd will be a bit bigger. > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > ...if_ether.h-define-__UAPI_DEF_ETHHDR-.patch | 39 +++++++++++++++++++ > meta/recipes-core/musl/musl_git.bb | 3 +- > 2 files changed, 41 insertions(+), 1 deletion(-) > create mode 100644 meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch > > diff --git a/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch > new file mode 100644 > index 0000000000..800273612d > --- /dev/null > +++ b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch > @@ -0,0 +1,39 @@ > +From 5ab64f7e08ea0325d83d446dd4015f82b4c179dd Mon Sep 17 00:00:00 2001 > +From: Chen Qi <Qi.Chen@windriver.com> > +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 <Qi.Chen@windriver.com> > +--- > + 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 > + > diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb > index 3f5fa37fba..254774f57e 100644 > --- a/meta/recipes-core/musl/musl_git.bb > +++ b/meta/recipes-core/musl/musl_git.bb > @@ -14,7 +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 \ > + " > > PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" > > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#224909): https://lists.openembedded.org/g/openembedded-core/message/224909 > Mute This Topic: https://lists.openembedded.org/mt/115782554/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
Hi Khem, Thanks for your review. I'll follow your suggestion and drop this patch in V3. Regards, Qi -----Original Message----- From: Khem Raj <raj.khem@gmail.com> Sent: Thursday, October 16, 2025 9:46 AM To: Chen, Qi <Qi.Chen@windriver.com> Cc: openembedded-core@lists.openembedded.org Subject: Re: [OE-core][PATCH V2 1/3] musl: avoid redefinition error on ethhdr On Wed, Oct 15, 2025 at 6:11 PM Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > > From: Chen Qi <Qi.Chen@windriver.com> > > 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. > I think this patch is not on sound footing. I do not like us patching libc APIs unless its something upstream accepts. We can cause unintended behavioural changes on yocto based musl systems in future and we have to support this forever. Perhaps it's better to fix systemd even if the patch to systemd will be a bit bigger. > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > ...if_ether.h-define-__UAPI_DEF_ETHHDR-.patch | 39 +++++++++++++++++++ > meta/recipes-core/musl/musl_git.bb | 3 +- > 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 > meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__U > API_DEF_ETHHDR-.patch > > diff --git > a/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-_ > _UAPI_DEF_ETHHDR-.patch > b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-_ > _UAPI_DEF_ETHHDR-.patch > new file mode 100644 > index 0000000000..800273612d > --- /dev/null > +++ b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-defi > +++ ne-__UAPI_DEF_ETHHDR-.patch > @@ -0,0 +1,39 @@ > +From 5ab64f7e08ea0325d83d446dd4015f82b4c179dd Mon Sep 17 00:00:00 > +2001 > +From: Chen Qi <Qi.Chen@windriver.com> > +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 <Qi.Chen@windriver.com> > +--- > + 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 > + > diff --git a/meta/recipes-core/musl/musl_git.bb > b/meta/recipes-core/musl/musl_git.bb > index 3f5fa37fba..254774f57e 100644 > --- a/meta/recipes-core/musl/musl_git.bb > +++ b/meta/recipes-core/musl/musl_git.bb > @@ -14,7 +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 \ > + " > > PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" > > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#224909): > https://lists.openembedded.org/g/openembedded-core/message/224909 > Mute This Topic: https://lists.openembedded.org/mt/115782554/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub > [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch new file mode 100644 index 0000000000..800273612d --- /dev/null +++ b/meta/recipes-core/musl/musl/0001-include-netinet-if_ether.h-define-__UAPI_DEF_ETHHDR-.patch @@ -0,0 +1,39 @@ +From 5ab64f7e08ea0325d83d446dd4015f82b4c179dd Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +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 <Qi.Chen@windriver.com> +--- + 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 + diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 3f5fa37fba..254774f57e 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb @@ -14,7 +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 \ + " PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"