Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933527AbbFWUpH (ORCPT ); Tue, 23 Jun 2015 16:45:07 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:56649 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933264AbbFWUo6 (ORCPT ); Tue, 23 Jun 2015 16:44:58 -0400 From: Arnd Bergmann To: Andy Lutomirski Cc: Michael Kerrisk-manpages , Andy Lutomirski , "linux-kernel@vger.kernel.org" , Linux API , David Woodhouse Subject: Re: UAPI headers including non-UAPI headers by accident? Date: Tue, 23 Jun 2015 22:44:50 +0200 Message-ID: <5721321.xeloEYqQC1@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <9141492.JqTlmk9dHk@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:PaQDd3Rc2xTtsL7J3nLBq5EBW3J0yfJOXqg5E6x+dXA8aCg3T1L 8Ak+YhxKfj5CQy0JrKQebnqMhCCCp6VqmDeZ/qGIQUlB6h/CZeBHlh4ArTIMGZ6SWHbD7jX ENwmRFBV77BrHkhc1WURl7MdelkPXRAzwAD2a3QjosbusAWGTmo9njrAqQbYQI/hJRyAO7r mLAN2W6kP8LHZ/aYjIaWA== X-UI-Out-Filterresults: notjunk:1;V01:K0:SC/vGO4I84Y=:O2iRBJOs6T6QkyYmi9lHPM zuHREG4D3yDdxCWefv9dl7WPOEH4rJ2DjtSNzmU3JuWQeeeY5kyUfEfv4sX7vpHeAT9YM3ATe SgwPs18xZK+bAXelABmEw0zy6m4jCDRCdVdPpj/eB/15o5grnanwoQbUNYQ4Kf5rlrXzPcqzr wZVjbsPiYWKaiPGVvlc84AxYC1EOMJovFoy0ZHGa1YPDS6mMqkSAJ+U6FaZDs+tLgr1pW/m9D 1sElit2GZtUDhme8jUJk9ntp5m6GM3DLy7dnlD0DlIzn3417W7uJaCv2J3aB9F1H458hZ8XYE 0Bi65ZJfFM1PSo8V31Uc3wGVGgE9reqUOgrSiTjHl6czHACwHkyswg6eDwKaiCXDpI3Insmj1 bnZMu6PtNckOPPjriN5fWR1Zt0bCryp0ObzL/6qd5CYVVLTefAKyAeb2+o5ARZ00e8cLtn9h+ smmxUYfZ/WYjO96kAQdPbdeQbqUaMavMNu5WRS6KFBCizpx4gqttoPWeiuQpJlZbDplXdfFMW pS0GdUne1N0WTdR5Yxr63Lhh9eqqUjqeFxAbehRmkOx3700uV76ZAM7RuZXolqcNQaMSdelnk 4hsTVtyWqB8V059JsbHeBqu8cFJb50d5LRIi2tbrl6XMpQ83l+buiN0sRZqZzGSm9PxsBeFmm QemzWcds0dA/YHq/xrBSX/wHjwJ5iAeDekzFJ7FJ5kAZwLg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2447 Lines: 64 On Thursday 18 June 2015 11:57:56 Andy Lutomirski wrote: > On Thu, Jun 18, 2015 at 12:58 AM, Arnd Bergmann wrote: > > On Thursday 18 June 2015 09:52:36 Michael Kerrisk wrote: > >> [CC += David] > >> > >> On 2 June 2015 at 18:36, Andy Lutomirski wrote: > >> > include/uapi/linux/signal.h starts with: > >> > > >> > #ifndef _UAPI_LINUX_SIGNAL_H > >> > #define _UAPI_LINUX_SIGNAL_H > >> > > >> > #include > >> > #include > >> > > >> > This causes it to include , which is not the same thing > >> > as . Changing that will break userspace use of > >> > this header, though, as the uapi/ won't get removed. > >> > > >> > What's the correct fix? This is causing trouble with a UML build for me. > >> > >> Perhaps David has some insight, since he architected the original UAPI split. > > > > The uapi headers are installed without the uapi prefix. This means > > that inside of the kernel, we get > > > > > > linux/signal.h > > -> uapi/linux/signal.h > > -> asm/signal.h > > -> uapi/asm/signal.h > > > > while in the installed headers we just get > > > > linux/signal.h > > -> asm/signal.h > > > > This all looks right to me: user space only sees the exported portions > > under the traditional names, while the kernel sees both the kernel-side > > and user-side definitions from the same path. > > > > It seems counterintuitive and error-prone to me that including > would pull in non-UAPI asm/signal.h declarations > in the kernel but not when used from userspace. It would make it very > easy to break the header such that it's only broken in a userspace > context. > It's an artifact of how the files were originally generated, as the UAPI headers used to be part of the normal headers, with #ifdef __KERNEL__ around the parts that are not in include/uapi now. For some reason, we now have device drivers including the uapi headers directly, which was probably done as an accident. Maybe we can just change them all back to use the normal header file names and add a checkpatch warning in case someone else tries to use the uapi headers directly? Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/