All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Mikko Rapeli <mikko.rapeli@iki.fi>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	fuse-devel <fuse-devel@lists.sourceforge.net>,
	Linux API <linux-api@vger.kernel.org>
Subject: Re: [PATCH v4 71/79] include/uapi/linux/fuse.h: use linux/types.h also in userspace
Date: Thu, 15 Oct 2015 20:59:30 +0200	[thread overview]
Message-ID: <9560422.ZpOrhsmRxt@wuerfel> (raw)
In-Reply-To: <CAJfpegtSK-ttDXN+vz+yzsU9P1m7fDCn2VwXfHyJuWL6-O-g3g@mail.gmail.com>

On Thursday 15 October 2015 20:32:45 Miklos Szeredi wrote:
> > In my other patches I got review comments that kernel headers should not
> > use <stdint.h> and also Documentation/CodingStyle section 5 says:
> >
> >  (e) Types safe for use in userspace.
> >
> >      In certain structures which are visible to userspace, we cannot
> >      require C99 types and cannot use the 'u32' form above. Thus, we
> >      use __u32 and similar types in all structures which are shared
> >      with userspace.
> 
> Ok, if you cannot require C99, then the __uXX types are the way to go.
> But for the fuse API we *can* use C99 types, nothing preventing us
> from doing it.

What the sentence above means is that you should not rely on the
user including <stdint.h> before including a kernel header, and
that kernel headers are not allowed to include <stdint.h> themselves,
because that would break any pre-C99 user space that defines types
with the same names in their own headers and that relies on that
header not to be included implicitly.

It's possible that it has never been a problem for the fuse headers,
but it has been a problem for other headers in the past and what
Mikko is trying to achieve is to ensure that none of the kernel
headers do this so we can make it an error in 'make headers_install'.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org>
Cc: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>,
	Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	fuse-devel
	<fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v4 71/79] include/uapi/linux/fuse.h: use linux/types.h also in userspace
Date: Thu, 15 Oct 2015 20:59:30 +0200	[thread overview]
Message-ID: <9560422.ZpOrhsmRxt@wuerfel> (raw)
In-Reply-To: <CAJfpegtSK-ttDXN+vz+yzsU9P1m7fDCn2VwXfHyJuWL6-O-g3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thursday 15 October 2015 20:32:45 Miklos Szeredi wrote:
> > In my other patches I got review comments that kernel headers should not
> > use <stdint.h> and also Documentation/CodingStyle section 5 says:
> >
> >  (e) Types safe for use in userspace.
> >
> >      In certain structures which are visible to userspace, we cannot
> >      require C99 types and cannot use the 'u32' form above. Thus, we
> >      use __u32 and similar types in all structures which are shared
> >      with userspace.
> 
> Ok, if you cannot require C99, then the __uXX types are the way to go.
> But for the fuse API we *can* use C99 types, nothing preventing us
> from doing it.

What the sentence above means is that you should not rely on the
user including <stdint.h> before including a kernel header, and
that kernel headers are not allowed to include <stdint.h> themselves,
because that would break any pre-C99 user space that defines types
with the same names in their own headers and that relies on that
header not to be included implicitly.

It's possible that it has never been a problem for the fuse headers,
but it has been a problem for other headers in the past and what
Mikko is trying to achieve is to ensure that none of the kernel
headers do this so we can make it an error in 'make headers_install'.

	Arnd

  reply	other threads:[~2015-10-15 18:59 UTC|newest]

Thread overview: 206+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15  5:55 [PATCH v4 00/79] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 01/79] headers_install.sh: enhance error handling Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 02/79] scripts/headers_compile_test.sh: compile test script for exported headers Mikko Rapeli
2015-10-15  7:17   ` Alexander Stein
2015-10-15  7:29     ` Mikko Rapeli
2015-11-10 15:03     ` Gabriel Laskar
2015-10-15  5:55 ` [PATCH v4 03/79] drm.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 04/79] drm_mode.h: use __u32 and __u64 from linux/types.h Mikko Rapeli
2015-10-15 13:32   ` Alex Deucher
2015-10-15 13:32     ` Alex Deucher
2015-10-15 13:48     ` Mikko Rapeli
2015-10-15 13:48       ` Mikko Rapeli
2015-10-21 15:09       ` Emil Velikov
2015-10-21 15:09         ` Emil Velikov
2015-10-21 15:18         ` Alex Deucher
2015-10-21 15:18           ` Alex Deucher
2015-10-21 16:21           ` Emil Velikov
2015-10-21 16:21             ` Emil Velikov
2015-10-21 16:27             ` Alex Deucher
2015-10-21 16:27               ` Alex Deucher
2015-10-21 17:42               ` Emil Velikov
2015-10-21 17:42                 ` Emil Velikov
2015-10-15  5:55 ` [PATCH v4 05/79] exynos_drm.h: use " Mikko Rapeli
2015-10-15  5:55   ` Mikko Rapeli
2015-10-15  5:55   ` Mikko Rapeli
2015-10-15 16:17   ` Gustavo Padovan
2015-10-15 16:17     ` Gustavo Padovan
2015-10-15 16:17     ` Gustavo Padovan
2015-10-15  5:55 ` [PATCH v4 06/79] nouveau_drm.h: use __u32 and " Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 07/79] radeon_drm.h: " Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 08/79] r128_drm.h: include drm/drm.h Mikko Rapeli
2015-10-15  7:43   ` Daniel Vetter
2015-10-15  7:43     ` Daniel Vetter
2015-10-15  5:55 ` [PATCH v4 09/79] via_drm.h: don't include non-existing via_drmclient.h Mikko Rapeli
2015-10-21 15:01   ` Emil Velikov
2015-10-21 15:01     ` Emil Velikov
2015-10-15  5:55 ` [PATCH v4 10/79] via_drm.h: move struct via_file_private definition to drivers/gpu/drm/via/via_drv.h Mikko Rapeli
2015-10-21 14:36   ` Emil Velikov
2015-10-21 14:36     ` Emil Velikov
2015-10-21 15:33     ` Daniel Vetter
2015-10-21 15:33       ` Daniel Vetter
2015-10-21 16:25       ` Emil Velikov
2015-10-21 16:25         ` Emil Velikov
2015-10-15  5:55 ` [PATCH v4 11/79] savage_drm.h: include <drm/drm.h> Mikko Rapeli
2015-10-15  5:55   ` Mikko Rapeli
2015-10-15  6:44   ` Daniel Vetter
2015-10-15  6:44     ` Daniel Vetter
2015-10-15  5:55 ` [PATCH v4 12/79] include/uapi/drm/sis_drm.h: move sis_file_private to drivers/gpu/drm/sis/sis_drv.h Mikko Rapeli
2015-10-21 14:39   ` Emil Velikov
2015-10-21 15:34     ` Daniel Vetter
2015-10-21 15:34       ` Daniel Vetter
2015-10-15  5:55 ` [PATCH v4 13/79] drm/i810_drm.h: include drm/drm.h Mikko Rapeli
2015-10-15  7:44   ` Daniel Vetter
2015-10-15  7:44     ` Daniel Vetter
2015-10-15  5:55 ` [PATCH v4 14/79] include/uapi/drm/vmwgfx_drm.h: use __s32, __u32 and __u64 from linux/types.h Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 15/79] include/uapi/drm/qxl_drm.h: " Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 16/79] include/uapi/linux/agpgart.h: include stdlib.h in userspace Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 17/79] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP macro Mikko Rapeli
2015-10-15  5:55   ` Mikko Rapeli
2015-10-15  8:04   ` Takashi Iwai
2015-10-15  8:04     ` Takashi Iwai
2015-10-15  5:55 ` [PATCH v4 18/79] dm-log-userspace.h: use __u32, __s32 and __u64 from linux/types.h Mikko Rapeli
2015-10-15  8:09   ` Mike Snitzer
2015-10-15  8:09     ` Mike Snitzer
2015-10-15 17:53     ` Mikko Rapeli
2015-10-15 17:53       ` Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 19/79] hsi_char.h: use __u32 " Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 20/79] include/uapi/linux/hsi/cs-protocol.h: include linux/time.h Mikko Rapeli
2015-10-15  5:55 ` [PATCH v4 21/79] ebtables.h: use __u64 from linux/types.h Mikko Rapeli
2015-10-15  5:55   ` Mikko Rapeli
2015-11-23 16:55   ` Pablo Neira Ayuso
2015-10-15  5:56 ` [PATCH v4 22/79] cld.h: use __u8, __u16, __s16, __u32 and __s64 " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 23/79] rds.h: " Mikko Rapeli
2015-10-15 11:06   ` Sowmini Varadhan
2015-10-15 11:06     ` Sowmini Varadhan
2015-10-15 22:00     ` Mikko Rapeli
2015-10-15 22:00       ` Mikko Rapeli
2015-10-15 22:21       ` Sowmini Varadhan
2015-10-15 22:39         ` Mikko Rapeli
2015-10-15 22:39           ` Mikko Rapeli
2015-10-15 23:03           ` Sowmini Varadhan
2015-10-15 23:03             ` Sowmini Varadhan
2015-10-15  5:56 ` [PATCH v4 24/79] sctp.h: use __u8 and __u32 " Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 25/79] scsi_bsg_fc.h: use __u8, __u32 and __u64 " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 26/79] scsi_netlink.h: use __u8, __u16 " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 27/79] scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 28/79] hdspm.h: use __u8, __u32 and __u64 from linux/types.h instead of stdint.h Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  8:04   ` Takashi Iwai
2015-10-15  8:04     ` Takashi Iwai
2015-10-15  5:56 ` [PATCH v4 29/79] gntalloc.h: use __u16, __u32 and __u64 from linux/types.h Mikko Rapeli
2015-10-15  5:56 ` Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15 10:55   ` David Vrabel
2015-10-15 10:55   ` [Xen-devel] " David Vrabel
2015-10-15 10:55     ` David Vrabel
2015-10-15  5:56 ` [PATCH v4 30/79] gntdev.h: use " Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15 10:56   ` David Vrabel
2015-10-15 10:56   ` [Xen-devel] " David Vrabel
2015-10-15 10:56     ` David Vrabel
2015-10-15  5:56 ` [PATCH v4 31/79] include/uapi/linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 32/79] include/uapi/asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 33/79] include/uapi/asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 34/79] include/uapi/asm-generic/shmbuf.h: include fixes Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 35/79] asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 36/79] include/uapi/asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 37/79] include/uapi/linux/socket.h: include sys/socket.h in userspace Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 38/79] include/uapi/linux/rds.h: include linux/socket.h and linux/types.h Mikko Rapeli
2015-10-15 11:10   ` Sowmini Varadhan
2015-10-15 11:10     ` Sowmini Varadhan
2015-10-15  5:56 ` [PATCH v4 39/79] include/uapi/linux/if_pppox.h: include linux/if.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 40/79] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 41/79] include/uapi/linux/ipv6_route.h: include linux/in6.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 42/79] " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 43/79] include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 44/79] include/uapi/linux/if_pppox.h: " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 45/79] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ definition to hdlc/ioctl.h Mikko Rapeli
2015-10-15  8:49   ` Frans Klaver
2015-10-15  8:49     ` Frans Klaver
2015-10-15 18:08     ` Mikko Rapeli
2015-10-15 18:08       ` Mikko Rapeli
2015-10-15 18:11       ` [PATCH] " Mikko Rapeli
2015-10-15 18:11         ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 46/79] include/uapi/linux/packet_diag.h: include linux/netdevice.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 47/79] include/uapi/linux/llc.h: include linux/if.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 48/79] include/uapi/linux/mqueue.h: include linux/types.h Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 49/79] include/uapi/linux/mroute.h: include linux/in.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 50/79] include/uapi/linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 51/79] include/uapi/linux/ip6_tunnel.h: include linux/if.h and linux/in6.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 52/79] include/uapi/netfilter/*.h: fix include files for compilation Mikko Rapeli
2015-11-23 16:55   ` Pablo Neira Ayuso
2015-10-15  5:56 ` [PATCH v4 53/79] include/uapi/linux/errqueue.h: include linux/time.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 54/79] include/uapi/asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 55/79] arch/x86/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 56/79] include/uapi/linux/auto_fs.h: include linux/limits.h Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 57/79] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 58/79] include/uapi/linux/target_core_user.h: use __u8, __u16, __u32 and __u64 " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 59/79] include/uapi/linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 60/79] include/uapi/linux/atm_zatm.h: include linux/time.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 61/79] include/uapi/linux/scc.h: include linux/sockios.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 62/79] include/uapi/linux/btrfs.h: define NULL Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 63/79] include/uapi/linux/kexec.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 64/79] include/uapi/linux/reiserfs_xattr.h: " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 65/79] include/uapi/linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 66/79] include/uapi/linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 67/79] include/uapi/linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 68/79] arch/x86/include/uapi/asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 69/79] include/uapi/linux/dvb/video.h: remove stdint.h include Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 70/79] include/uapi/mtd/mtd-user.h: " Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 71/79] include/uapi/linux/fuse.h: use linux/types.h also in userspace Mikko Rapeli
2015-10-15 15:20   ` Miklos Szeredi
2015-10-15 15:20     ` Miklos Szeredi
2015-10-15 17:41     ` Mikko Rapeli
2015-10-15 17:41       ` Mikko Rapeli
2015-10-15 18:32       ` Miklos Szeredi
2015-10-15 18:32         ` Miklos Szeredi
2015-10-15 18:59         ` Arnd Bergmann [this message]
2015-10-15 18:59           ` Arnd Bergmann
2015-10-15 19:25           ` Miklos Szeredi
2015-10-15 21:03             ` Mikko Rapeli
2015-10-15 21:03               ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 72/79] include/linux/ipmi-fru.h: use linux/types.h instead of stdint.h Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 73/79] include/linux/sdb.h: use linux/types.h types " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 74/79] include/linux/xz.h: " Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 75/79] include/uapi/xen/privcmd.h: fix compilation in userspace Mikko Rapeli
2015-10-15  5:56 ` Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15 10:07   ` kbuild test robot
2015-10-15 10:07   ` kbuild test robot
2015-10-15 10:07     ` kbuild test robot
2015-10-15 10:07     ` kbuild test robot
2015-10-15 10:29   ` David Vrabel
2015-10-15 10:29     ` David Vrabel
2015-10-15 10:29     ` David Vrabel
2015-10-15 11:18     ` Mikko Rapeli
2015-10-15 11:18     ` Mikko Rapeli
2015-10-15 11:18       ` Mikko Rapeli
2015-10-15 11:24       ` David Vrabel
2015-10-15 11:24       ` David Vrabel
2015-10-15 11:24         ` David Vrabel
2015-10-15 11:24         ` David Vrabel
2015-10-15 11:35         ` Mikko Rapeli
2015-10-15 11:35           ` Mikko Rapeli
2015-10-15 11:35           ` Mikko Rapeli
2015-10-15 11:35         ` Mikko Rapeli
2015-10-15 10:29   ` David Vrabel
2015-10-15  5:56 ` [PATCH v4 76/79] coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 77/79] include/uapi/linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 78/79] include/uapi/linux/errqueue.h: include time.h in userspace Mikko Rapeli
2015-10-15  5:56 ` [PATCH v4 79/79] arch/arm/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-10-15  5:56   ` Mikko Rapeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9560422.ZpOrhsmRxt@wuerfel \
    --to=arnd@arndb.de \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikko.rapeli@iki.fi \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.