Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp223380img; Mon, 18 Mar 2019 01:29:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7zir+tVSha1MyuPRXWYAy9SIQSiC/4Oy4zr3+g3LU6YI8+nFR98IXt+bwhemDgdOJNnja X-Received: by 2002:a65:62d4:: with SMTP id m20mr16686632pgv.416.1552897745984; Mon, 18 Mar 2019 01:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552897745; cv=none; d=google.com; s=arc-20160816; b=iMHIQrMtLW5yVWl/NbpXojy5/KwxqxpyRJ55bMvijMBW3zm+JYZzmur2oWdPkMBMu7 8TvA9bMDRSeR///WOP+DgtSRomS+W7Dgd+ImUfBF0fGO9lBrasIHLFEDf+8S+htMyPVY sT3NKG64zzFCSLuou2WFkYa0DyMI7nqN3y0wSoS0OP8xKHpxDzDPS/AUK93ctKKQp1ZA 31MJzOb27DGaVV/vBqrgrOAy5T3q2+qG1gThLKkyFVY148AVNtHMRc31xM3VCGaSk9jZ fuGGB/oOvuClwIeL2jqfY7viaMDUxbAOcLv3pCqE9DaBioSwNz/UWfgXc5U9s/b0HZwi TD9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=4f6/vJQVu39aS3HwEd/+DTkaIedt/YxrIiDh3jSmPPU=; b=0nuBJng9o1rFSaT/u/ueXqrzQIag9TLqN7jWxSo6S5W2DXUKe4WRPPtGGMLo9O1O4v 9UYtaVGCXPE/xoHz9NURVGLeMMTvysQ41K09oqMQzAWJGbY0fJMDp1X2+TTFsI11k8cz 3va/trpTVZqBn4NteIbW4azNEObb1OHdHMZ/oNL+4E8g5vvzPtCz7M8tCrdfvDS9uMnM X91uTmzD3toPjpow/yS5dkzDSiW00Q9+N3zSoMMNyCLBPqcPiYQO6Zb5wbNDnPOoLvjF kkgTi7EpRSFhBtWE9WP58W9vYCvIDY5WLxbMygP1Q5oiw79LktwTRxDPHRIAcLdS5GoX ZG/Q== 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 s78si8906685pfa.161.2019.03.18.01.28.48; Mon, 18 Mar 2019 01:29:05 -0700 (PDT) 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 S1726861AbfCRI2G (ORCPT + 99 others); Mon, 18 Mar 2019 04:28:06 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:46600 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbfCRI2F (ORCPT ); Mon, 18 Mar 2019 04:28:05 -0400 Received: by mail-qk1-f196.google.com with SMTP id i5so9076143qkd.13; Mon, 18 Mar 2019 01:28:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4f6/vJQVu39aS3HwEd/+DTkaIedt/YxrIiDh3jSmPPU=; b=G/2HiBBP51Wx+i6cZzL4Kma65mwyvW/Wti2dBq/BcGSCX8JLWngXcxErw3Ae8GuyuB dWLczHlbEXvYU2/iNBu3Bk27tWaML6HpWBy+TrEKxBH8iZf2nu08kYx3inJOxAqK5A1Z 2akZidEELTtajejniATIqeMB0zHhuDFAOFkxmMomTWw5wYcxisMhABTuSJOTdsTwpdjt ZAFrB9Ft5xcngP93euSCpSCasTI2cQHQYENpHeSZfCkoyGotCYihLv/aFWOYH3/CQxb8 xOSjNMClWebdx3jxNwnJU6w5rtu90ON+Sh4yLXxP+34bLBw82RntrWGvjs6T2G92PvqA gXLQ== X-Gm-Message-State: APjAAAXc64NXnqHT3V9GlGRf7os4PZu7T8YXqm+1rkWvkMxr2n+Iv8Dh Wyx8fshv9GrrjNN4aBQcG6oXuRzCfLT+j0VA0XU= X-Received: by 2002:a05:620a:133b:: with SMTP id p27mr11956706qkj.173.1552897683269; Mon, 18 Mar 2019 01:28:03 -0700 (PDT) MIME-Version: 1.0 References: <20190311153857.563743-1-arnd@arndb.de> <87k1h1fgkk.fsf@mid.deneb.enyo.de> <87a7hvded7.fsf@mid.deneb.enyo.de> In-Reply-To: From: Arnd Bergmann Date: Mon, 18 Mar 2019 09:27:46 +0100 Message-ID: Subject: Re: [PATCH] y2038: fix socket.h header inclusion To: Deepa Dinamani Cc: Florian Weimer , "David S . Miller" , Willem de Bruijn , alpha , linux-arch , linux-mips@vger.kernel.org, Parisc List , sparclinux , Laura Abbott , Networking , Linux Kernel Mailing List , Linux API , Josh Boyer , Linus Torvalds , Jeff Law 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 On Sun, Mar 17, 2019 at 7:20 PM Deepa Dinamani wrote: > On Fri, Mar 15, 2019 at 2:20 PM Florian Weimer wrote: > > > On Thu, Mar 14, 2019 at 7:41 PM Florian Weimer wrote: > > >> > 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). Ok, I see. Thanks for the explanation! > > > 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. > > Would moving kernel namespace types(__kernel prefix) to a different > header file(kernel_types.h?) and then including this from > linux/posix_types.h. > And, for socket.h just including kernel_types.h make sense? I fear we have considered linux/posix_types.h to be something that can be included anywhere for a long time, so it may be better to ensure that this is actually the case, and avoid the problem with those two structures but leave the rest untouched. I think we can move __kernel_fsid_t into include/uapi/asm-generic/statfs.h, which is the only thing that needs it anyway. We have two definitions of it today, the non-generic one being for mips32, but incidentally there was a patch the other day to remove that and use the generic one instead. With that done, we can change asm/socket.h to just use asm/posix_types.h. I would still prefer to solve the problem for linux/posix_types.h as well, but I'm not sure even how __kernel_fd_set is used today in user space, if at all. Commit 8ded2bbc1845 ("posix_types.h: Cleanup stale __NFDBITS and related definitions") removed most of the fd_set definition after a long discussion [1], and since then it has been basically impossible to use 'struct fd_set' from the kernel in a meaningful way without including the libc headers or duplicating them. Should we just remove __kernel_fd_set from the exported headers and define the internal fd_set directly in include/linux/types.h? (Adding the folks from the old thread to Cc). Arnd [1] https://lore.kernel.org/lkml/20120724181209.GA10534@zod.bos.redhat.com/t/