Patch "uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define" has been added to the 4.15-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
uapi-if_ether.h-move-__uapi_def_ethhdr-libc-define.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
da360299b6734135a5f66d7db458dcc7801c826aMon Sep 17 00:00:00 2001
From: Hauke Mehrtens <[email protected]>
Date: Mon, 12 Feb 2018 23:59:51 +0100
Subject: uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define
From: Hauke Mehrtens <[email protected]>
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 mixes 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;
}--- include/uapi/linux/if_ether.h | 6 +++++- include/uapi/linux/libc-compat.h | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-)
include/uapi/linux/if_ether.h +5 -1
@@ -23,7 +23,6 @@#define _UAPI_LINUX_IF_ETHER_H#include <linux/types.h> -#include <linux/libc-compat.h> /* * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
@@ -150,6 +149,11 @@* This is an Ethernet frame header. */ +/* allow libcs like musl to deactivate this, glibc does not implement this. */ +#ifndef __UAPI_DEF_ETHHDR +#define __UAPI_DEF_ETHHDR 1 +#endif + #if __UAPI_DEF_ETHHDR struct ethhdr { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
include/uapi/linux/libc-compat.h +0 -6
@@ -264,10 +264,4 @@#endif /* __GLIBC__ */ -/* Definitions for if_ether.h */ -/* allow libcs like musl to deactivate this, glibc does not implement this. */ -#ifndef __UAPI_DEF_ETHHDR -#define __UAPI_DEF_ETHHDR 1 -#endif -#endif /* _UAPI_LIBC_COMPAT_H */
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/uapi-if_ether.h-move-__uapi_def_ethhdr-libc-define.patch