While we don't normally follow all the -stable updates for libc-headers, there
was one userspace header that was broken in the 4.15 cycle, and it has now
been fixed in -stable.

The offending header breaks the build for several packages, so we update to
pick up this change:

   Author: Hauke Mehrtens <ha...@hauke-m.de>
   Date:   Mon Feb 12 23:59:51 2018 +0100

       uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define

       commit da360299b6734135a5f66d7db458dcc7801c826a upstream.

       This fixes a compile problem of some user space applications by not
       including linux/libc-compat.h in uapi/if_ether.h.

       linux/libc-compat.h checks which "features" the header files, included
       from the libc, provide to make the Linux kernel uapi header files only
          provide no conflicting structures and enums. If a user application 
       kernel headers and libc headers it could happen that linux/libc-compat.h
       gets included too early where not all other libc headers are included
       yet. Then the linux/libc-compat.h would not prevent all the
       redefinitions and we run into compile problems.
       This patch removes the include of linux/libc-compat.h from
       uapi/if_ether.h to fix the recently introduced case, but not all as this
       is more or less impossible.

       It is no problem to do the check directly in the if_ether.h file and not
       in libc-compat.h as this does not need any fancy glibc header detection
       as glibc never provided struct ethhdr and should define
       __UAPI_DEF_ETHHDR by them self when they will provide this.

       The following test program did not compile correctly any more:

       #include <linux/if_ether.h>
       #include <netinet/in.h>
       #include <linux/in.h>

       int main(void)
           return 0;

       Fixes: 6926e041a892 ("uapi/if_ether.h: prevent redefinition of struct 
       Reported-by: Guillaume Nault <g.na...@alphalink.fr>
       Cc: <sta...@vger.kernel.org> # 4.15
       Signed-off-by: Hauke Mehrtens <ha...@hauke-m.de>
       Signed-off-by: David S. Miller <da...@davemloft.net>
       Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

We also add a new muslc patch to adjust the ethhdr change in the uapi. As is
suggested in the kernel commit, we can protect musl directly in if_ether itself.

Signed-off-by: Bruce Ashfield <bruce.ashfi...@windriver.com>
 ...move-muslc-ethhdr-protection-to-uapi-file.patch | 30 ++++++++++++++++++++++
 ...eaders_4.15.bb => linux-libc-headers_4.15.7.bb} |  6 +++--
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 
 rename meta/recipes-kernel/linux-libc-headers/{linux-libc-headers_4.15.bb => 
linux-libc-headers_4.15.7.bb} (62%)

diff --git 
new file mode 100644
index 000000000000..2e04701699c8
--- /dev/null
@@ -0,0 +1,30 @@
+From 897736166fd709906a5fdf16eb23f8fddff770b5 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfi...@windriver.com>
+Date: Thu, 1 Mar 2018 18:31:01 -0500
+Subject: [PATCH] if_ether: move muslc ethhdr protection to uapi file
+Signed-off-by: Bruce Ashfield <bruce.ashfi...@windriver.com>
+ include/uapi/linux/if_ether.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
+index 153c9c2..7b69b73 100644
+--- a/include/uapi/linux/if_ether.h
++++ b/include/uapi/linux/if_ether.h
+@@ -149,6 +149,12 @@
+  *    This is an Ethernet frame header.
+  */
++#ifdef _NETINET_IF_ETHER_H /* musl */
++#define __UAPI_DEF_ETHHDR 0
++#else /* glibc uses __NETINET_IF_ETHER_H, and includes the kernel header. */
++#define __UAPI_DEF_ETHHDR 1
+ /* allow libcs like musl to deactivate this, glibc does not implement this. */
+ #ifndef __UAPI_DEF_ETHHDR
+ #define __UAPI_DEF_ETHHDR             1
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.15.bb 
similarity index 62%
rename from meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.15.bb
rename to meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.15.7.bb
index b511cd118105..a7db4c9c015a 100644
--- a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.15.bb
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.15.7.bb
@@ -5,7 +5,9 @@ SRC_URI_append_libc-musl = "\
     file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
     file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
     file://0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch \
+    file://0001-if_ether-move-muslc-ethhdr-protection-to-uapi-file.patch \
-SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b"
-SRC_URI[sha256sum] = 
+SRC_URI[md5sum] = "8186ce63c489199b58b6a58ad2a24a94"
+SRC_URI[sha256sum] = 

Openembedded-core mailing list

Reply via email to