From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Weimer Subject: Re: [PATCH] y2038: fix socket.h header inclusion Date: Fri, 15 Mar 2019 22:20:04 +0100 Message-ID: <87a7hvded7.fsf@mid.deneb.enyo.de> References: <20190311153857.563743-1-arnd@arndb.de> <87k1h1fgkk.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: (Arnd Bergmann's message of "Fri, 15 Mar 2019 21:30:25 +0100") Sender: linux-kernel-owner@vger.kernel.org To: Arnd Bergmann Cc: "David S . Miller" , Deepa Dinamani , Willem de Bruijn , alpha , linux-arch , linux-mips@vger.kernel.org, Parisc List , sparclinux , Laura Abbott , Networking , Linux Kernel Mailing List , Linux API List-Id: linux-arch.vger.kernel.org * Arnd Bergmann: > On Thu, Mar 14, 2019 at 7:41 PM Florian Weimer wrote: >> >> * Arnd Bergmann: >> >> > diff --git a/arch/alpha/include/uapi/asm/socket.h >> > b/arch/alpha/include/uapi/asm/socket.h >> > index 0d0fddb7e738..976e89b116e5 100644 >> > --- a/arch/alpha/include/uapi/asm/socket.h >> > +++ b/arch/alpha/include/uapi/asm/socket.h >> > @@ -2,8 +2,8 @@ >> > #ifndef _UAPI_ASM_SOCKET_H >> > #define _UAPI_ASM_SOCKET_H >> > >> > +#include >> > #include >> > -#include >> >> This breaks POSIX conformance in glibc because the >> header is not namespace clean. It contains the >> identifiers fds_bits and val: >> >> unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; >> >> int val[2]; > > What is problematic about the struct members here? I had thought that > only the struct names have to be in a namespace to be usable here, > but not the members. According POSIX, a user can do this: #define fds_bits 1024 before including the header file. Similarly for val. Since glibc pulls in indirectly, the result is a parse error, even though the programmer did nothing wrong (fds_bits is not an identifier used by POSIX, nor is it in the implementation namespace, ans is a POSIX header). > We could use asm/posix_types.h instead of linux/posix_types.h, > would that address your concern? It should fix the fds_bits case, I think. But still uses val, so that part of the issue remains. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from albireo.enyo.de ([5.158.152.32]:58866 "EHLO albireo.enyo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726213AbfCOVUL (ORCPT ); Fri, 15 Mar 2019 17:20:11 -0400 From: Florian Weimer Subject: Re: [PATCH] y2038: fix socket.h header inclusion References: <20190311153857.563743-1-arnd@arndb.de> <87k1h1fgkk.fsf@mid.deneb.enyo.de> Date: Fri, 15 Mar 2019 22:20:04 +0100 In-Reply-To: (Arnd Bergmann's message of "Fri, 15 Mar 2019 21:30:25 +0100") Message-ID: <87a7hvded7.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-arch-owner@vger.kernel.org List-ID: To: Arnd Bergmann Cc: "David S . Miller" , Deepa Dinamani , Willem de Bruijn , alpha , linux-arch , linux-mips@vger.kernel.org, Parisc List , sparclinux , Laura Abbott , Networking , Linux Kernel Mailing List , Linux API Message-ID: <20190315212004.7Mh1aqywURsTKVyb64Q2Qi5Nlkg1OVAg_82tV8XBCvo@z> * Arnd Bergmann: > On Thu, Mar 14, 2019 at 7:41 PM Florian Weimer wrote: >> >> * Arnd Bergmann: >> >> > diff --git a/arch/alpha/include/uapi/asm/socket.h >> > b/arch/alpha/include/uapi/asm/socket.h >> > index 0d0fddb7e738..976e89b116e5 100644 >> > --- a/arch/alpha/include/uapi/asm/socket.h >> > +++ b/arch/alpha/include/uapi/asm/socket.h >> > @@ -2,8 +2,8 @@ >> > #ifndef _UAPI_ASM_SOCKET_H >> > #define _UAPI_ASM_SOCKET_H >> > >> > +#include >> > #include >> > -#include >> >> This breaks POSIX conformance in glibc because the >> header is not namespace clean. It contains the >> identifiers fds_bits and val: >> >> unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; >> >> int val[2]; > > What is problematic about the struct members here? I had thought that > only the struct names have to be in a namespace to be usable here, > but not the members. According POSIX, a user can do this: #define fds_bits 1024 before including the header file. Similarly for val. Since glibc pulls in indirectly, the result is a parse error, even though the programmer did nothing wrong (fds_bits is not an identifier used by POSIX, nor is it in the implementation namespace, ans is a POSIX header). > We could use asm/posix_types.h instead of linux/posix_types.h, > would that address your concern? It should fix the fds_bits case, I think. But still uses val, so that part of the issue remains.