Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1704900 > unrolled thread
| Started by | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| First post | 2017-08-06 19:10 +0200 |
| Last post | 2017-08-06 19:30 +0200 |
| Articles | 20 on this page of 55 — 7 participants |
Back to article view | Back to linux.kernel
[PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
[PATCH v06 16/36] uapi linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
[PATCH v06 34/36] uapi: break dependency loop between <linux/hdlc/ioctl.h> and <linux/if.h> Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
[PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
Re: [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Arnd Bergmann <arnd@arndb.de> - 2017-08-07 16:40 +0200
Re: [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 01:00 +0200
[PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
Re: [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 01:20 +0200
Re: [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-09 09:30 +0200
[PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:20 +0200
Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 01:00 +0200
Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace Arnd Bergmann <arnd@arndb.de> - 2017-08-09 14:50 +0200
Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 15:00 +0200
[PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:20 +0200
Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-08-07 18:00 +0200
Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Arnd Bergmann <arnd@arndb.de> - 2017-08-07 18:10 +0200
Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-08-07 18:50 +0200
Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Arnd Bergmann <arnd@arndb.de> - 2017-08-07 22:30 +0200
Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-08-09 01:10 +0200
Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Arnd Bergmann <arnd@arndb.de> - 2017-08-09 10:30 +0200
[PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:20 +0200
[PATCH v06 20/36] uapi linux/scc.h: include linux/sockios.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:20 +0200
[PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Willem de Bruijn <willemdebruijn.kernel@gmail.com> - 2017-08-06 22:30 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 23:00 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Willem de Bruijn <willemdebruijn.kernel@gmail.com> - 2017-08-06 22:30 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 23:00 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Willem de Bruijn <willemdebruijn.kernel@gmail.com> - 2017-08-06 23:30 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 23:40 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Willem de Bruijn <willemdebruijn.kernel@gmail.com> - 2017-08-06 23:50 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-07 00:00 +0200
Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Willem de Bruijn <willemdebruijn.kernel@gmail.com> - 2017-08-07 00:10 +0200
[PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
Re: [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t Arnd Bergmann <arnd@arndb.de> - 2017-08-07 17:10 +0200
[PATCH v06 06/36] uapi asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 17/36] uapi linux/sctp.h: use __u8, __u16 and __u32 from linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 07/36] uapi asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 25/36] uapi linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 02/36] uapi scsi/scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 11/36] uapi asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 10/36] uapi asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 24/36] uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
Re: [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 00:50 +0200
[PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-08-09 01:20 +0200
Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Moni Shoua <monis@mellanox.com> - 2017-08-09 15:50 +0200
Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-08-09 18:00 +0200
Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-10 04:50 +0200
Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-08-10 18:20 +0200
[PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
Re: [PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 01:00 +0200
[PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
[PATCH v06 28/36] uapi xen/evtchn.h: include xen/privcmd.h Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:30 +0200
Page 1 of 3 [1] 2 3 Next page →
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-06 19:10 +0200 |
| Subject | [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files |
| Message-ID | <ubxdT-50T-3@gated-at.bofh.it> |
v6:
Addressed v5 review comments.
Dropped patches already applied from other developers for same problems:
thanks Christoph Hellwig, Nicolas Dichtel, Arnd Bergmann, Dmitry V. Levin,
Leon Romanovsky, David Lebrun, Jason Gunthorpe, Jonas Gorski, Stephen
Hemminger, Davide Caratti and others!
Moved glibc compatibility fix to a separate patch set to focus on these.
Minor tuning to scripts/headers_compile_test.sh.
Since several patches are not getting any review comments from lkml or from
people and lists added by scripts/get_maintainer.pl, added manually crafted
Cc:'s to the patches.
v5:
https://lkml.org/lkml/2016/8/22/661
two years now from v1 to v5 though some of the patches have been applied
with these changes all uapi headers compile stand alone in users space
added myself to MAINTAINERS for the test script
tried to fix all v04 review findings
due to regression in one of the accepted patches, added a glibc compatibility test
fixed some glibc compatibility issues, which are hopefully on the right path
v4:
https://lkml.org/lkml/2015/10/15/22
tried to fix v03 review findings
tried to fix all hack patches
v3:
https://lkml.org/lkml/2015/5/30/96
tried to fix all v2 review findings
tried to guess how to fix a few more issue
with a few hacks, 0 files fail and 760 files pass the compile test on 32bit x86
v2:
https://lkml.org/lkml/2015/2/16/521
added cross compiler support with CROSS_COMPILE,
detecting libc and GCC headers from compiler,
more header file fixes
v1:
https://lkml.org/lkml/2014/8/21/665
Users of kernel header files would be happier if they did not contain
kernel specific parts and would contain #include statements for all
other header files that they depend on, and in general would compile.
This patch set introduces a compile test for headers exported to userspace
and then fixes all 42 of the remaining userspace header compilation
failures. Some of the fixes may change include order and thus may expose
incompatibilities between kernel and libc and other userspace library
headers which include incompatible copies of kernel uapi header definitions.
Changes are also available in headers_test_v06 branch at github:
https://github.com/mcfrisk/linux/tree/headers_test_v06
Here's how to run the userspace compile tests and example output with these
patches applied on top of v4.13-rc3-216-g0a23ea65ce9f:
$ make headers_install
$ cd usr/include
$ ../../scripts/headers_compile_test.sh
...
Kernel header compile test statistics:
0 files failed the kernel header compile test.
863 files passed the kernel header compile test.
Compile tested with the test itself on 32bit x86 and armhf and
with allmodconfig on x86 i586.
Would be nice when various Linux kernel subsystem maintainers would
pick and apply patches from this series to their queues, and comment
if there are problems with any of them.
Mikko Rapeli (36):
Add scripts/headers_compile_test.sh: compile test for exported uapi
headers
uapi scsi/scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h
uapi scsi/scsi_netlink.h: use __u8, __u16 and __u64 from linux/types.h
uapi scsi/scsi_netlink_fc.h: use __u16, __u32 and __u64 from
linux/types.h
uapi linux/sysctl.h: use __kernel_size_t instead of size_t
uapi asm-generic/ipcbuf.h: include linux/posix_types.h
uapi asm-generic/msgbuf.h: include asm/ipcbuf.h
uapi asm-generic/shmbuf.h: include fixes
uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h
uapi asm-generic/signal.h: use __kernel_size_t instead of size_t
uapi asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h
x86 uapi asm/signal.h: use __kernel_size_t instead of size_t
x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h
arm uapi asm/signal.h: include <stddef.h> for size_t in userspace
uapi linux/socket.h: include sys/socket.h in user space
uapi linux/dlm_netlink.h: include linux/dlmconstants.h
uapi linux/sctp.h: use __u8, __u16 and __u32 from linux/types.h
uapi linux/errqueue.h: include linux/time.h in user space
uapi linux/omapfb.h: use __kernel_size_t instead of size_t
uapi linux/scc.h: include linux/sockios.h
uapi linux/kexec.h: use __kernel_size_t instead of size_t
uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t
uapi linux/coda.h: use __kernel_pid_t and add u_short etc definitions
for userspace
uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel
side headers
uapi linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t
uapi xen/privcmd.h: fix compilation in userspace
uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t
uapi xen/evtchn.h: include xen/privcmd.h
uapi linux/elfcore.h: remove non-compiling userspace parts
uapi rdma/rdma_user_rxe.h: include in.h and in6.h
uapi linux/patchkey.h: change #error to #warning if file included
directly
uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and
uint64_t
uapi linux/fsmap.h: use __kernel_size_t instead of size_t
uapi: break dependency loop between <linux/hdlc/ioctl.h> and
<linux/if.h>
uapi linux/tls.h: don't include <net/tcp.h> in user space
uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and
uint64_t
MAINTAINERS | 5 +
arch/arm/include/uapi/asm/signal.h | 2 +
arch/x86/include/uapi/asm/sembuf.h | 3 +
arch/x86/include/uapi/asm/signal.h | 2 +-
include/linux/coda_psdev.h | 11 +
include/uapi/asm-generic/ipcbuf.h | 2 +
include/uapi/asm-generic/msgbuf.h | 2 +
include/uapi/asm-generic/sembuf.h | 2 +
include/uapi/asm-generic/shmbuf.h | 4 +-
include/uapi/asm-generic/signal.h | 2 +-
include/uapi/asm-generic/ucontext.h | 3 +
include/uapi/drm/armada_drm.h | 22 +-
include/uapi/linux/android/binder.h | 4 +-
include/uapi/linux/coda.h | 11 +-
include/uapi/linux/coda_psdev.h | 13 -
include/uapi/linux/dlm_netlink.h | 1 +
include/uapi/linux/elfcore.h | 21 +-
include/uapi/linux/errqueue.h | 6 +
include/uapi/linux/fsmap.h | 2 +-
include/uapi/linux/hdlc/ioctl.h | 17 +-
include/uapi/linux/if.h | 23 +-
include/uapi/linux/kexec.h | 4 +-
include/uapi/linux/kfd_ioctl.h | 172 ++++++------
include/uapi/linux/omapfb.h | 2 +-
include/uapi/linux/patchkey.h | 2 +-
include/uapi/linux/reiserfs_xattr.h | 2 +-
include/uapi/linux/scc.h | 1 +
include/uapi/linux/sctp.h | 20 +-
include/uapi/linux/socket.h | 4 +
include/uapi/linux/sysctl.h | 4 +-
include/uapi/linux/tls.h | 2 +
include/uapi/rdma/rdma_user_rxe.h | 2 +
include/uapi/scsi/scsi_bsg_fc.h | 54 ++--
include/uapi/scsi/scsi_netlink.h | 22 +-
include/uapi/scsi/scsi_netlink_fc.h | 16 +-
include/uapi/xen/evtchn.h | 2 +
include/uapi/xen/gntdev.h | 6 +
include/uapi/xen/privcmd.h | 14 +-
include/xen/interface/grant_table.h | 6 +-
scripts/headers_compile_test.sh | 507 ++++++++++++++++++++++++++++++++++++
40 files changed, 784 insertions(+), 216 deletions(-)
create mode 100755 scripts/headers_compile_test.sh
--
2.13.3
[toc] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-06 19:10 +0200 |
| Subject | [PATCH v06 16/36] uapi linux/dlm_netlink.h: include linux/dlmconstants.h |
| Message-ID | <ubxdV-50T-65@gated-at.bofh.it> |
| In reply to | #1704900 |
Fixes userspace compilation error:
error: ‘DLM_RESNAME_MAXLEN’ undeclared here (not in a function)
char resource_name[DLM_RESNAME_MAXLEN];
Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Christine Caulfield <ccaulfie@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Cc: cluster-devel@redhat.com
---
include/uapi/linux/dlm_netlink.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/dlm_netlink.h b/include/uapi/linux/dlm_netlink.h
index 647c8ef27227..ef1e2e08769a 100644
--- a/include/uapi/linux/dlm_netlink.h
+++ b/include/uapi/linux/dlm_netlink.h
@@ -10,6 +10,7 @@
#define _DLM_NETLINK_H
#include <linux/types.h>
+#include <linux/dlmconstants.h>
enum {
DLM_STATUS_WAITING = 1,
--
2.13.3
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-06 19:10 +0200 |
| Subject | [PATCH v06 34/36] uapi: break dependency loop between <linux/hdlc/ioctl.h> and <linux/if.h> |
| Message-ID | <ubxdW-50T-75@gated-at.bofh.it> |
| In reply to | #1704900 |
Name structs in linux/hdlc/ioctl.h and forward declare and use them in
linux/if.h. Then include linux/if.h in linux/hdlc/ioctl.h to fix
user space compilation problem:
hdlc/ioctl.h:73:14: error: ‘IFNAMSIZ’ undeclared here (not in a function)
char master[IFNAMSIZ]; /* Name of master FRAD device */
^~~~~~~~
This approach for suggested by Frans Klaver <fransklaver@gmail.com>
in lkml message
<CAH6sp9Ni636HR4sma0SeSZPs+Tws9Y41jij-=fu0gMZj5Zbsyg@mail.gmail.com>.
Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Frans Klaver <fransklaver@gmail.com>
Cc: David Miller <davem@davemloft.net>
---
include/uapi/linux/hdlc/ioctl.h | 17 +++++++++--------
include/uapi/linux/if.h | 23 ++++++++++++++++-------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/include/uapi/linux/hdlc/ioctl.h b/include/uapi/linux/hdlc/ioctl.h
index 04bc0274a189..717d3edef7d1 100644
--- a/include/uapi/linux/hdlc/ioctl.h
+++ b/include/uapi/linux/hdlc/ioctl.h
@@ -1,6 +1,7 @@
#ifndef __HDLC_IOCTL_H__
#define __HDLC_IOCTL_H__
+#include <linux/if.h>
#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
@@ -36,25 +37,25 @@
#ifndef __ASSEMBLY__
-typedef struct {
+typedef struct sync_serial_settings {
unsigned int clock_rate; /* bits per second */
unsigned int clock_type; /* internal, external, TX-internal etc. */
unsigned short loopback;
} sync_serial_settings; /* V.35, V.24, X.21 */
-typedef struct {
+typedef struct te1_settings {
unsigned int clock_rate; /* bits per second */
unsigned int clock_type; /* internal, external, TX-internal etc. */
unsigned short loopback;
unsigned int slot_map;
} te1_settings; /* T1, E1 */
-typedef struct {
+typedef struct raw_hdlc_proto {
unsigned short encoding;
unsigned short parity;
} raw_hdlc_proto;
-typedef struct {
+typedef struct fr_proto {
unsigned int t391;
unsigned int t392;
unsigned int n391;
@@ -64,16 +65,16 @@ typedef struct {
unsigned short dce; /* 1 for DCE (network side) operation */
} fr_proto;
-typedef struct {
+typedef struct fr_proto_pvc {
unsigned int dlci;
} fr_proto_pvc; /* for creating/deleting FR PVCs */
-typedef struct {
+typedef struct fr_proto_pvc_info {
unsigned int dlci;
char master[IFNAMSIZ]; /* Name of master FRAD device */
-}fr_proto_pvc_info; /* for returning PVC information only */
+} fr_proto_pvc_info; /* for returning PVC information only */
-typedef struct {
+typedef struct cisco_proto {
unsigned int interval;
unsigned int timeout;
} cisco_proto;
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 259617a551f2..b57d9cd08ac9 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -34,6 +34,15 @@
#define IFALIASZ 256
#include <linux/hdlc/ioctl.h>
+/* Forward declarations to break dependency loop with <linux/hdlc/ioctl.h> */
+struct sync_serial_settings;
+struct ae1_settings;
+struct raw_hdlc_proto;
+struct fr_proto;
+struct fr_proto_pvc;
+struct fr_proto_pvc_info;
+struct cisco_proto;
+
/* For glibc compatibility. An empty enum does not compile. */
#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \
__UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
@@ -206,15 +215,15 @@ struct if_settings {
unsigned int size; /* Size of the data allocated by the caller */
union {
/* {atm/eth/dsl}_settings anyone ? */
- raw_hdlc_proto __user *raw_hdlc;
- cisco_proto __user *cisco;
- fr_proto __user *fr;
- fr_proto_pvc __user *fr_pvc;
- fr_proto_pvc_info __user *fr_pvc_info;
+ struct raw_hdlc_proto __user *raw_hdlc;
+ struct cisco_proto __user *cisco;
+ struct fr_proto __user *fr;
+ struct fr_proto_pvc __user *fr_pvc;
+ struct fr_proto_pvc_info __user *fr_pvc_info;
/* interface settings */
- sync_serial_settings __user *sync;
- te1_settings __user *te1;
+ struct sync_serial_settings __user *sync;
+ struct te1_settings __user *te1;
} ifs_ifsu;
};
--
2.13.3
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-06 19:10 +0200 |
| Subject | [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubxdW-50T-83@gated-at.bofh.it> |
| In reply to | #1704900 |
Fixes userspace compilation error:
error: unknown type name ‘size_t’
Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: H. Peter Anvin <hpa@zytor.com>
---
arch/x86/include/uapi/asm/signal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/uapi/asm/signal.h b/arch/x86/include/uapi/asm/signal.h
index 8264f47cf53e..74346db30758 100644
--- a/arch/x86/include/uapi/asm/signal.h
+++ b/arch/x86/include/uapi/asm/signal.h
@@ -127,7 +127,7 @@ struct sigaction {
typedef struct sigaltstack {
void __user *ss_sp;
int ss_flags;
- size_t ss_size;
+ __kernel_size_t ss_size;
} stack_t;
#endif /* __ASSEMBLY__ */
--
2.13.3
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-08-07 16:40 +0200 |
| Subject | Re: [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubRmj-148-19@gated-at.bofh.it> |
| In reply to | #1704904 |
On Sun, Aug 6, 2017 at 6:44 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> Fixes userspace compilation error:
>
> error: unknown type name ‘size_t’
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: H. Peter Anvin <hpa@zytor.com>
> ---
> arch/x86/include/uapi/asm/signal.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/uapi/asm/signal.h b/arch/x86/include/uapi/asm/signal.h
> index 8264f47cf53e..74346db30758 100644
> --- a/arch/x86/include/uapi/asm/signal.h
> +++ b/arch/x86/include/uapi/asm/signal.h
> @@ -127,7 +127,7 @@ struct sigaction {
> typedef struct sigaltstack {
> void __user *ss_sp;
> int ss_flags;
> - size_t ss_size;
> + __kernel_size_t ss_size;
> } stack_t;
>
In patch 14, you took a different approach based on an earlier comment
of mine, for the same structure. I think we should definitely take the same
approach for signal.h across all architectures, whichever we end up using.
Arnd
[toc] | [prev] | [next] | [standalone]
| From | "Dmitry V. Levin" <ldv@altlinux.org> |
|---|---|
| Date | 2017-08-09 01:00 +0200 |
| Subject | Re: [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t |
| Message-ID | <uclDI-6Ez-19@gated-at.bofh.it> |
| In reply to | #1704904 |
[Multipart message — attachments visible in raw view] — view raw
On Sun, Aug 06, 2017 at 06:44:03PM +0200, Mikko Rapeli wrote:
> Fixes userspace compilation error:
>
> error: unknown type name ‘size_t’
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: H. Peter Anvin <hpa@zytor.com>
> ---
> arch/x86/include/uapi/asm/signal.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/uapi/asm/signal.h b/arch/x86/include/uapi/asm/signal.h
> index 8264f47cf53e..74346db30758 100644
> --- a/arch/x86/include/uapi/asm/signal.h
> +++ b/arch/x86/include/uapi/asm/signal.h
> @@ -127,7 +127,7 @@ struct sigaction {
> typedef struct sigaltstack {
> void __user *ss_sp;
> int ss_flags;
> - size_t ss_size;
> + __kernel_size_t ss_size;
> } stack_t;
>
> #endif /* __ASSEMBLY__ */
This is definitely wrong because sizeof(size_t) < sizeof(__kernel_size_t) on x32.
I submitted a different fix some time ago, see
http://lkml.kernel.org/r/20170303005930.GA10283@altlinux.org
and
http://lkml.kernel.org/r/20170303005950.GB10283@altlinux.org
--
ldv
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-06 19:10 +0200 |
| Subject | [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubxdW-50T-91@gated-at.bofh.it> |
| In reply to | #1704900 |
Fixes userspace compilation error:
error: unknown type name ‘size_t’
size_t length;
Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: reiserfs-devel@vger.kernel.org
---
include/uapi/linux/reiserfs_xattr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/reiserfs_xattr.h b/include/uapi/linux/reiserfs_xattr.h
index 38fdd648be21..af52b38ef783 100644
--- a/include/uapi/linux/reiserfs_xattr.h
+++ b/include/uapi/linux/reiserfs_xattr.h
@@ -18,7 +18,7 @@ struct reiserfs_xattr_header {
struct reiserfs_security_handle {
const char *name;
void *value;
- size_t length;
+ __kernel_size_t length;
};
#endif /* _LINUX_REISERFS_XATTR_H */
--
2.13.3
[toc] | [prev] | [next] | [standalone]
| From | "Dmitry V. Levin" <ldv@altlinux.org> |
|---|---|
| Date | 2017-08-09 01:20 +0200 |
| Subject | Re: [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t |
| Message-ID | <uclX3-70m-1@gated-at.bofh.it> |
| In reply to | #1704905 |
[Multipart message — attachments visible in raw view] — view raw
On Sun, Aug 06, 2017 at 06:44:13PM +0200, Mikko Rapeli wrote:
> Fixes userspace compilation error:
>
> error: unknown type name ‘size_t’
> size_t length;
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: reiserfs-devel@vger.kernel.org
> ---
> include/uapi/linux/reiserfs_xattr.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/reiserfs_xattr.h b/include/uapi/linux/reiserfs_xattr.h
> index 38fdd648be21..af52b38ef783 100644
> --- a/include/uapi/linux/reiserfs_xattr.h
> +++ b/include/uapi/linux/reiserfs_xattr.h
> @@ -18,7 +18,7 @@ struct reiserfs_xattr_header {
> struct reiserfs_security_handle {
> const char *name;
> void *value;
> - size_t length;
> + __kernel_size_t length;
> };
>
> #endif /* _LINUX_REISERFS_XATTR_H */
I submitted an alternative fix for this bug some time ago, see
http://lkml.kernel.org/r/20170228005328.GA27363@altlinux.org
--
ldv
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-09 09:30 +0200 |
| Subject | Re: [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t |
| Message-ID | <uctBg-3T7-13@gated-at.bofh.it> |
| In reply to | #1706946 |
Hi Dmitry and thanks for the comments. I have only one question: why haven't your patches been applied yet? -Mikko
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-06 19:20 +0200 |
| Subject | [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace |
| Message-ID | <ubxnz-54r-1@gated-at.bofh.it> |
| In reply to | #1704900 |
Arnd Bergmann <arnd@arndb.de> doubts that __kernel_size_t could be used here so trying to fall back to gcc's <stddef.h>. Fixes uapi header compilation error from userspace on ARCH=arm: asm/signal.h:112:2: error: unknown type name ‘size_t’ size_t ss_size; Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi> Cc: Arnd Bergmann <arnd@arndb.de> --- arch/arm/include/uapi/asm/signal.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/include/uapi/asm/signal.h b/arch/arm/include/uapi/asm/signal.h index 33073bdcf091..63066f624c10 100644 --- a/arch/arm/include/uapi/asm/signal.h +++ b/arch/arm/include/uapi/asm/signal.h @@ -12,6 +12,8 @@ struct siginfo; #define NSIG 32 typedef unsigned long sigset_t; +#include <stddef.h> + #endif /* __KERNEL__ */ #define SIGHUP 1 -- 2.13.3
[toc] | [prev] | [next] | [standalone]
| From | "Dmitry V. Levin" <ldv@altlinux.org> |
|---|---|
| Date | 2017-08-09 01:00 +0200 |
| Subject | Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace |
| Message-ID | <uclDJ-6Ez-29@gated-at.bofh.it> |
| In reply to | #1704906 |
[Multipart message — attachments visible in raw view] — view raw
On Sun, Aug 06, 2017 at 06:44:05PM +0200, Mikko Rapeli wrote: > Arnd Bergmann <arnd@arndb.de> doubts that __kernel_size_t could be used here > so trying to fall back to gcc's <stddef.h>. The only architecture where you cannot do this safely is x86 family because of x32 exception. If there is no chance that the change will affect x32, feel free to replace size_t with __kernel_size_t like I did some time ago, see http://lkml.kernel.org/r/20170302002022.GB27097@altlinux.org -- ldv
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-08-09 14:50 +0200 |
| Subject | Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace |
| Message-ID | <ucyAW-76E-17@gated-at.bofh.it> |
| In reply to | #1706926 |
On Wed, Aug 9, 2017 at 12:57 AM, Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Sun, Aug 06, 2017 at 06:44:05PM +0200, Mikko Rapeli wrote:
>> Arnd Bergmann <arnd@arndb.de> doubts that __kernel_size_t could be used here
>> so trying to fall back to gcc's <stddef.h>.
>
> The only architecture where you cannot do this safely is x86 family
> because of x32 exception. If there is no chance that the change will
> affect x32, feel free to replace size_t with __kernel_size_t like I did
> some time ago, see
> http://lkml.kernel.org/r/20170302002022.GB27097@altlinux.org
There is another problem: on some 32-bit architectures, size_t is
defined as 'unsigned int', while '__kernel_size_t' is defined as 'unsigned
long'. These obviously have the same size, but the man page
explicitly defines it as 'size_t ss_size'.
If a user space program accesses the field in a way requires an
exact type match, it gets a warning or error, e.g.
1. printf("signal with %zd bytes\n", stack->ss_size);
2. size_t *pointer_to_size_t = &stack->ss_size;
3. assert(__builtin_types_compatible_p(size_t, typeof(stack->ss_size)))
Not sure how important those are, but I think there is at least a risk
of any of those showing up in user space.
Arnd
[toc] | [prev] | [next] | [standalone]
| From | "Dmitry V. Levin" <ldv@altlinux.org> |
|---|---|
| Date | 2017-08-09 15:00 +0200 |
| Subject | Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace |
| Message-ID | <ucyKB-7af-9@gated-at.bofh.it> |
| In reply to | #1707324 |
[Multipart message — attachments visible in raw view] — view raw
On Wed, Aug 09, 2017 at 02:41:59PM +0200, Arnd Bergmann wrote:
> On Wed, Aug 9, 2017 at 12:57 AM, Dmitry V. Levin <ldv@altlinux.org> wrote:
> > On Sun, Aug 06, 2017 at 06:44:05PM +0200, Mikko Rapeli wrote:
> >> Arnd Bergmann <arnd@arndb.de> doubts that __kernel_size_t could be used here
> >> so trying to fall back to gcc's <stddef.h>.
> >
> > The only architecture where you cannot do this safely is x86 family
> > because of x32 exception. If there is no chance that the change will
> > affect x32, feel free to replace size_t with __kernel_size_t like I did
> > some time ago, see
> > http://lkml.kernel.org/r/20170302002022.GB27097@altlinux.org
>
> There is another problem: on some 32-bit architectures, size_t is
> defined as 'unsigned int', while '__kernel_size_t' is defined as 'unsigned
> long'. These obviously have the same size, but the man page
> explicitly defines it as 'size_t ss_size'.
>
> If a user space program accesses the field in a way requires an
> exact type match, it gets a warning or error, e.g.
>
> 1. printf("signal with %zd bytes\n", stack->ss_size);
> 2. size_t *pointer_to_size_t = &stack->ss_size;
> 3. assert(__builtin_types_compatible_p(size_t, typeof(stack->ss_size)))
>
> Not sure how important those are, but I think there is at least a risk
> of any of those showing up in user space.
Agreed, one has to take this issue into consideration when replacing
size_t with __kernel_size_t.
--
ldv
[toc] | [prev] | [next] | [standalone]
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2017-08-06 19:20 +0200 |
| Subject | [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubxnz-54r-5@gated-at.bofh.it> |
| In reply to | #1704900 |
Fixes user space compilation error:
linux/fsmap.h:71:19: error: unknown type name ‘size_t’
static __inline__ size_t
^~~~~~
Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
---
include/uapi/linux/fsmap.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/fsmap.h b/include/uapi/linux/fsmap.h
index 7e8e5f0bd6d2..99600bbed6b6 100644
--- a/include/uapi/linux/fsmap.h
+++ b/include/uapi/linux/fsmap.h
@@ -68,7 +68,7 @@ struct fsmap_head {
};
/* Size of an fsmap_head with room for nr records. */
-static inline size_t
+static inline __kernel_size_t
fsmap_sizeof(
unsigned int nr)
{
--
2.13.3
[toc] | [prev] | [next] | [standalone]
| From | "Darrick J. Wong" <darrick.wong@oracle.com> |
|---|---|
| Date | 2017-08-07 18:00 +0200 |
| Subject | Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubSBJ-291-33@gated-at.bofh.it> |
| In reply to | #1704907 |
On Sun, Aug 06, 2017 at 06:44:24PM +0200, Mikko Rapeli wrote:
> Fixes user space compilation error:
>
> linux/fsmap.h:71:19: error: unknown type name ‘size_t’
> static __inline__ size_t
> ^~~~~~
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> include/uapi/linux/fsmap.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/fsmap.h b/include/uapi/linux/fsmap.h
> index 7e8e5f0bd6d2..99600bbed6b6 100644
> --- a/include/uapi/linux/fsmap.h
> +++ b/include/uapi/linux/fsmap.h
> @@ -68,7 +68,7 @@ struct fsmap_head {
> };
>
> /* Size of an fsmap_head with room for nr records. */
> -static inline size_t
> +static inline __kernel_size_t
This is a static inline helper to assist in malloc calls. We don't pass
size_t to the kernel, so why is this necessary over, say,
#include <sys/types.h>
--D
> fsmap_sizeof(
> unsigned int nr)
> {
> --
> 2.13.3
>
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-08-07 18:10 +0200 |
| Subject | Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubSLp-2uu-51@gated-at.bofh.it> |
| In reply to | #1705670 |
On Mon, Aug 7, 2017 at 5:54 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
> On Sun, Aug 06, 2017 at 06:44:24PM +0200, Mikko Rapeli wrote:
>> Fixes user space compilation error:
>>
>> linux/fsmap.h:71:19: error: unknown type name ‘size_t’
>> static __inline__ size_t
>> ^~~~~~
>>
>> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
>> Cc: Darrick J. Wong <darrick.wong@oracle.com>
>> ---
>> include/uapi/linux/fsmap.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/uapi/linux/fsmap.h b/include/uapi/linux/fsmap.h
>> index 7e8e5f0bd6d2..99600bbed6b6 100644
>> --- a/include/uapi/linux/fsmap.h
>> +++ b/include/uapi/linux/fsmap.h
>> @@ -68,7 +68,7 @@ struct fsmap_head {
>> };
>>
>> /* Size of an fsmap_head with room for nr records. */
>> -static inline size_t
>> +static inline __kernel_size_t
>
> This is a static inline helper to assist in malloc calls. We don't pass
> size_t to the kernel, so why is this necessary over, say,
>
> #include <sys/types.h>
>
Either way works, but including a system header from a kernel header
requires an additional "#ifndef __KERNEL__" check, so I think Miko's
variant is a little nicer.
Generally speaking, you also want to avoid including system headers
indirectly from kernel headers, as POSIX requires that including one
system header should not indirectly make symbols from other system
headers visible. I think this is not a problem here though, as no system
header should include linux/fsmap.h.
Arnd
[toc] | [prev] | [next] | [standalone]
| From | "Darrick J. Wong" <darrick.wong@oracle.com> |
|---|---|
| Date | 2017-08-07 18:50 +0200 |
| Subject | Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubTo6-2M8-27@gated-at.bofh.it> |
| In reply to | #1705683 |
On Mon, Aug 07, 2017 at 06:01:43PM +0200, Arnd Bergmann wrote:
> On Mon, Aug 7, 2017 at 5:54 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
> > On Sun, Aug 06, 2017 at 06:44:24PM +0200, Mikko Rapeli wrote:
> >> Fixes user space compilation error:
> >>
> >> linux/fsmap.h:71:19: error: unknown type name ‘size_t’
> >> static __inline__ size_t
> >> ^~~~~~
> >>
> >> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> >> Cc: Darrick J. Wong <darrick.wong@oracle.com>
> >> ---
> >> include/uapi/linux/fsmap.h | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/include/uapi/linux/fsmap.h b/include/uapi/linux/fsmap.h
> >> index 7e8e5f0bd6d2..99600bbed6b6 100644
> >> --- a/include/uapi/linux/fsmap.h
> >> +++ b/include/uapi/linux/fsmap.h
> >> @@ -68,7 +68,7 @@ struct fsmap_head {
> >> };
> >>
> >> /* Size of an fsmap_head with room for nr records. */
> >> -static inline size_t
> >> +static inline __kernel_size_t
> >
> > This is a static inline helper to assist in malloc calls. We don't pass
> > size_t to the kernel, so why is this necessary over, say,
> >
> > #include <sys/types.h>
> >
>
> Either way works, but including a system header from a kernel header
> requires an additional "#ifndef __KERNEL__" check, so I think Miko's
> variant is a little nicer.
>
> Generally speaking, you also want to avoid including system headers
> indirectly from kernel headers, as POSIX requires that including one
> system header should not indirectly make symbols from other system
> headers visible. I think this is not a problem here though, as no system
> header should include linux/fsmap.h.
Sorry, I guess I was a little unclear about what I was asking -- I was
wondering why can't the userspace program include sys/types.h prior to
linux/fsmap.h? I wasn't proposing including C library headers in kernel
headers.
I think the patch author is pushing towards kernel headers never relying
on /anything/ in the system headers. For data structures being
exchanged with the kernel I agree, but the fsmap_sizeof result is never
passed to or received from the kernel; it exists purely for malloc
convenience.
--D
>
> Arnd
> --
> To unsubscribe from this list: send the line "unsubscribe linux-api" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-08-07 22:30 +0200 |
| Subject | Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t |
| Message-ID | <ubWOZ-5nl-3@gated-at.bofh.it> |
| In reply to | #1705713 |
On Mon, Aug 7, 2017 at 6:45 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
> On Mon, Aug 07, 2017 at 06:01:43PM +0200, Arnd Bergmann wrote:
>> On Mon, Aug 7, 2017 at 5:54 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
>> > On Sun, Aug 06, 2017 at 06:44:24PM +0200, Mikko Rapeli wrote:
>>
>> Either way works, but including a system header from a kernel header
>> requires an additional "#ifndef __KERNEL__" check, so I think Miko's
>> variant is a little nicer.
>>
>> Generally speaking, you also want to avoid including system headers
>> indirectly from kernel headers, as POSIX requires that including one
>> system header should not indirectly make symbols from other system
>> headers visible. I think this is not a problem here though, as no system
>> header should include linux/fsmap.h.
>
> Sorry, I guess I was a little unclear about what I was asking -- I was
> wondering why can't the userspace program include sys/types.h prior to
> linux/fsmap.h? I wasn't proposing including C library headers in kernel
> headers.
>
> I think the patch author is pushing towards kernel headers never relying
> on /anything/ in the system headers.
Right, and I think that is a good thing to have, because it allows us to
do better compile-time testing of the exported kernel headers.
> For data structures being
> exchanged with the kernel I agree, but the fsmap_sizeof result is never
> passed to or received from the kernel; it exists purely for malloc
> convenience.
Would you prefer making fsmap_sizeof a macro? That would also
make it possible to do static checking on the header without having
to resort to odd types.
Arnd
[toc] | [prev] | [next] | [standalone]
| From | "Darrick J. Wong" <darrick.wong@oracle.com> |
|---|---|
| Date | 2017-08-09 01:10 +0200 |
| Subject | Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t |
| Message-ID | <uclNn-6X2-1@gated-at.bofh.it> |
| In reply to | #1705832 |
On Mon, Aug 07, 2017 at 10:20:58PM +0200, Arnd Bergmann wrote: > On Mon, Aug 7, 2017 at 6:45 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote: > > On Mon, Aug 07, 2017 at 06:01:43PM +0200, Arnd Bergmann wrote: > >> On Mon, Aug 7, 2017 at 5:54 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote: > >> > On Sun, Aug 06, 2017 at 06:44:24PM +0200, Mikko Rapeli wrote: > >> > >> Either way works, but including a system header from a kernel header > >> requires an additional "#ifndef __KERNEL__" check, so I think Miko's > >> variant is a little nicer. > >> > >> Generally speaking, you also want to avoid including system headers > >> indirectly from kernel headers, as POSIX requires that including one > >> system header should not indirectly make symbols from other system > >> headers visible. I think this is not a problem here though, as no system > >> header should include linux/fsmap.h. > > > > Sorry, I guess I was a little unclear about what I was asking -- I was > > wondering why can't the userspace program include sys/types.h prior to > > linux/fsmap.h? I wasn't proposing including C library headers in kernel > > headers. > > > > I think the patch author is pushing towards kernel headers never relying > > on /anything/ in the system headers. > > Right, and I think that is a good thing to have, because it allows us to > do better compile-time testing of the exported kernel headers. > > > For data structures being > > exchanged with the kernel I agree, but the fsmap_sizeof result is never > > passed to or received from the kernel; it exists purely for malloc > > convenience. > > Would you prefer making fsmap_sizeof a macro? That would also > make it possible to do static checking on the header without having > to resort to odd types. Ick, no macros, please. :) How about just change it to unsigned long long and call it a day? --D > > Arnd > -- > To unsubscribe from this list: send the line "unsubscribe linux-api" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-08-09 10:30 +0200 |
| Subject | Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t |
| Message-ID | <ucuxk-4uZ-27@gated-at.bofh.it> |
| In reply to | #1706928 |
On Wed, Aug 9, 2017 at 1:08 AM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
> On Mon, Aug 07, 2017 at 10:20:58PM +0200, Arnd Bergmann wrote:
>> On Mon, Aug 7, 2017 at 6:45 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
>> > On Mon, Aug 07, 2017 at 06:01:43PM +0200, Arnd Bergmann wrote:
>> >> On Mon, Aug 7, 2017 at 5:54 PM, Darrick J. Wong <darrick.wong@oracle.com> wrote:
>> >> > On Sun, Aug 06, 2017 at 06:44:24PM +0200, Mikko Rapeli wrote:
>> >>
>> >> Either way works, but including a system header from a kernel header
>> >> requires an additional "#ifndef __KERNEL__" check, so I think Miko's
>> >> variant is a little nicer.
>> >>
>> >> Generally speaking, you also want to avoid including system headers
>> >> indirectly from kernel headers, as POSIX requires that including one
>> >> system header should not indirectly make symbols from other system
>> >> headers visible. I think this is not a problem here though, as no system
>> >> header should include linux/fsmap.h.
>> >
>> > Sorry, I guess I was a little unclear about what I was asking -- I was
>> > wondering why can't the userspace program include sys/types.h prior to
>> > linux/fsmap.h? I wasn't proposing including C library headers in kernel
>> > headers.
>> >
>> > I think the patch author is pushing towards kernel headers never relying
>> > on /anything/ in the system headers.
>>
>> Right, and I think that is a good thing to have, because it allows us to
>> do better compile-time testing of the exported kernel headers.
>>
>> > For data structures being
>> > exchanged with the kernel I agree, but the fsmap_sizeof result is never
>> > passed to or received from the kernel; it exists purely for malloc
>> > convenience.
>>
>> Would you prefer making fsmap_sizeof a macro? That would also
>> make it possible to do static checking on the header without having
>> to resort to odd types.
>
> Ick, no macros, please. :)
>
> How about just change it to unsigned long long and call it a day?
Works for me.
Arnd
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web