Received: by 10.223.185.116 with SMTP id b49csp4176399wrg; Mon, 26 Feb 2018 12:35:53 -0800 (PST) X-Google-Smtp-Source: AH8x227/QnPd72pih8hy/rVDDVf5PjYc/QEZbN/H525rxcgx9ow/qLwpwElllTDmiCSkSwVRej26 X-Received: by 10.99.116.28 with SMTP id p28mr9442834pgc.306.1519677353041; Mon, 26 Feb 2018 12:35:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519677353; cv=none; d=google.com; s=arc-20160816; b=Zu+u7FZD2+iwhnjijHRr4AJL8ml7WX/lIp3Bjyi+RkuDtrs73XntWcHqB2e+aLKj4A T0MaqExY8rvFlW/Ijr8Oz6BFPmCIDvktdLIJ3thniyltBOy6X6GQnVvWRpDlZQRBrEe9 HIj0U1cA9zepZ0vu8zcBJ9U9GCoqAdBRnFmOOblWMJfP+n+OS63aQQzzxkhQwRf+hTFO wL9SbF4/7fg1HGznav9TIcQo0gp18sUYIaXO4F2Xt0RBsWv0+MDJwhcrkMk88cIVvKsc jWx2QRn9p2vjOFF698e4V39iIbolWqhYN0/sofjUhu/LYdGE9ilfDRJ9k/vPHufupkvZ ibQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cDCsXoa4oU4CGTwdIHDoYV9LmvSIk745MtB2QGmlhnU=; b=ZCqL+nyKTqBfyrB9CBF7NHP3tevE+JBnV6hy7T9FXzdvazVVyaDRSfFLXOlPx0Vb0/ tZ09wietbTm6gjlLwnpN6comT7gCLeDfY7FGbyTANi0QQkirjS36jFLqieQXWJ62Rell IyZvTuunkXjg4GNBsG+Wh3J5wSrTl9ZwUd3OciVro1gPuR30aSgZehNlBt+sD9B9c4Ff F8WbY+AQYCDbhnBl85GbKg4hYo2/RPT/LJGzihnmWJR+XXOTxN201ptBB1lZmHe/WVQD gnZeTMHO5VwolZWZEMbKlKa+DFiX8dtKXTGbWj8b46CAWfm6JtVExr+FJVZlR8px6wzN jERw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si2544922pgu.633.2018.02.26.12.35.36; Mon, 26 Feb 2018 12:35:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932145AbeBZUdo (ORCPT + 99 others); Mon, 26 Feb 2018 15:33:44 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37056 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753880AbeBZU2L (ORCPT ); Mon, 26 Feb 2018 15:28:11 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 439CFE4B; Mon, 26 Feb 2018 20:28:10 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Hauke Mehrtens , "David S. Miller" Subject: [PATCH 4.15 31/64] uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define Date: Mon, 26 Feb 2018 21:22:08 +0100 Message-Id: <20180226202154.777525920@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180226202153.453363333@linuxfoundation.org> References: <20180226202153.453363333@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hauke Mehrtens 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 #include #include int main(void) { return 0; } Fixes: 6926e041a892 ("uapi/if_ether.h: prevent redefinition of struct ethhdr") Reported-by: Guillaume Nault Cc: # 4.15 Signed-off-by: Hauke Mehrtens Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/uapi/linux/if_ether.h | 6 +++++- include/uapi/linux/libc-compat.h | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -23,7 +23,6 @@ #define _UAPI_LINUX_IF_ETHER_H #include -#include /* * 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 */ --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h @@ -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 */