linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files
@ 2017-08-06 16:43 Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers Mikko Rapeli
                   ` (32 more replies)
  0 siblings, 33 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli

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

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
@ 2017-08-06 16:43 ` Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 02/36] uapi scsi/scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h Mikko Rapeli
                   ` (31 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Alexander Stein, Gabriel Laskar, Dmitry V . Levin,
	Arnd Bergmann, netdev, Greg Kroah-Hartman, David S. Miller,
	Mauro Carvalho Chehab, Randy Dunlap

Users of kernel uapi 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 also in user space. If Linux kernal uapi headers compile in
user space, then they can also be used to do ABI and API compatibility
checks against different kernel versions. ABI checks can also be used
by Linux distribution build systems like yocto/bitbake to avoid
recompiling dependencies if changes are ABI compatible.

For each header file exported to userspace, this script tries to
compile it together with minimal header files from GCC and libc, and
reports results.

In the test execution environment, libc and GCC header file locations
are parsed from gcc compiler configuration.

Some gcc and kernel headers depend on libc headers which are made available
by copying from the compiler default location to a temporary location and
removing possibly existing kernel headers from this directory. This is a bit
of a hack but seems to work in multiple environments so test can be
executed without installing headers to /usr/include and compiling a full
Linux distribution on top.

Tested natively on:

Debian unstable, i586-linux-gnu and gcc 4.9.2
Raspbian Wheezy, arm-linux-gnueabihf and gcc 4.6.3
Ubuntu 12.04 LTS, x86_64-linux-gnu and gcc 4.6.3

Tested cross compilation using standard CROSS_COMPILE=/path/to/gcc with:

arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) 4.9.2 20140904 (prerelease)

Execute the script in the directory where kernel header files are installed.
For example with kernel tree from v4.13-rc3-216-g0a23ea65ce9f on x86 i586:

$ make headers_install
$ cd usr/include
$ ../../scripts/headers_compile_test.sh
...
Kernel header compile test statistics:

42 files failed the kernel header compile test.
821 files passed the kernel header compile test.

Once all these errors have been fixed, this test could be added to
'make headers_check'.

In addition to plain compile test, there is also a glibc header
compatibility test, which compiles all kernel uapi headers against a
non-conflicting set of all GNU libc headers. The test covers
variants where kernel header is included before libc header
and libc header before kernel header.

Tested in Debian unstable with libc6 version 2.24-14.

Example execution with output:

$ make headers_install
$ cd usr/include
$ ../../scripts/headers_compile_test.sh -lk
Testing that /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/libc_headers.h compiles
cc -Wall -c -nostdinc -I /usr/lib/gcc/i686-linux-gnu/6/include -I /usr/lib/gcc/i686-linux-gnu/6/include-fixed -I . -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/i686-linux-gnu -o /dev/null /home/mcfrisk/src/linux-2.6/usr/include/drm/i810_drm.h
PASSED: drm/i810_drm.h
cc -Wall -c -nostdinc -I /usr/lib/gcc/i686-linux-gnu/6/include -I /usr/lib/gcc/i686-linux-gnu/6/include-fixed -I . -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/i686-linux-gnu -o /dev/null /home/mcfrisk/src/linux-2.6/usr/include/drm/i810_drm.h_libc_before_kernel.h
...
In file included from /home/mcfrisk/src/linux-2.6/usr/include/asm/sigcontext.h_l
ibc_before_kernel.h:2:0:
./asm/sigcontext.h:291:8: error: redefinition of ‘struct sigcontext’
 struct sigcontext {
        ^~~~~~~~~~
In file included from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/signal.h:306:0,
                 from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/sys/param.h:28,
                 from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/resolv.h:62,
                 from /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_inclu
de.qd5RuE/libc_headers.h:103,
                 from /home/mcfrisk/src/linux-2.6/usr/include/asm/sigcontext.h_l
ibc_before_kernel.h:1:
/home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.qd5RuE/bits/sigcont
ext.h:93:8: note: originally defined here
 struct sigcontext
        ^~~~~~~~~~
FAILED libc before kernel test: asm/sigcontext.h
...
Kernel header compile test statistics:

42 files failed the kernel header compile test.
821 files passed the kernel header compile test.

libc and kernel header compatibility test statistics:
73 files failed libc before kernel include test.
790 files passed libc before kernel include test.

Since I've been stubborn enough to work with this script and fixes to the
test failures for a few years, I added my self to MAINTAINERS.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: Gabriel Laskar <gabriel@lse.epita.fr>
Cc: Dmitry V. Levin <ldv@altlinux.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: netdev@vger.kernel.org
Cc: linux-api@vger.kernel.org
---
 MAINTAINERS                     |   5 +
 scripts/headers_compile_test.sh | 507 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 512 insertions(+)
 create mode 100755 scripts/headers_compile_test.sh

diff --git a/MAINTAINERS b/MAINTAINERS
index 567343b8ffaa..f1d6d50932cf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3527,6 +3527,11 @@ S:	Maintained
 F:	mm/memcontrol.c
 F:	mm/swap_cgroup.c
 
+COMPILE TEST FOR HEADER FILES EXPORTED TO USERSPACE
+M:	Mikko Rapeli <mikko.rapeli@iki.fi>
+S:	Maintained
+F:	scripts/headers_compile_test.sh
+
 CORETEMP HARDWARE MONITORING DRIVER
 M:	Fenghua Yu <fenghua.yu@intel.com>
 L:	linux-hwmon@vger.kernel.org
diff --git a/scripts/headers_compile_test.sh b/scripts/headers_compile_test.sh
new file mode 100755
index 000000000000..99de50d32b7b
--- /dev/null
+++ b/scripts/headers_compile_test.sh
@@ -0,0 +1,507 @@
+#!/bin/bash
+
+help() {
+	cat << EOF_HELP
+Userspace compile test for exported kernel headers.
+
+    Copyright (C) 2015 Mikko Rapeli <mikko.rapeli@iki.fi>
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; version 2
+    of the License.
+
+Execute in root directory of exported kernel headers in Linux kernel source
+tree. Sets up gcc and libc headers without existing kernel headers to
+a temporary environment and tries to compile all exported header files
+from current directory against them. Return value is zero if all tests pass,
+non-zero if something goes wrong during execution or if any file failed
+the compile tests.
+
+Supported arguments:
+
+    -h|--help          print help
+    -k|--keep          don't cleanup temporary header files and directories
+    -lk|--libc-kernel  test for conflicts between kernel and libc headers
+                       when libc headers are included before kernel headers
+    -kl|--kernel-libc  test for conflicts between kernel and libc headers
+                       when kernel headers are included before libc headers
+    -l|--libc          test both -lk and -kl
+    -v|--verbose       print more verbose output
+
+Example in Linux kernel source tree:
+
+    \$ make headers_install
+    \$ cd usr/include
+    \$ $( readlink -f "$0" )
+
+EOF_HELP
+}
+
+# bash due to arithmetics and pipefail
+set -euo pipefail
+
+KEEP=0
+HELP=0
+LIBC_TEST=0
+LIBC_KERNEL_TEST=0
+KERNEL_LIBC_TEST=0
+
+# command line arguments
+for p in "$@"; do
+	case "$p" in
+		-k|--keep)
+			KEEP=1
+		;;
+		-l|--libc)
+			LIBC_TEST=1
+			LIBC_KERNEL_TEST=1
+			KERNEL_LIBC_TEST=1
+		;;
+		-lk|--libc-kernel)
+			LIBC_TEST=1
+			LIBC_KERNEL_TEST=1
+		;;
+		-kl|--kernel-libc)
+			LIBC_TEST=1
+			KERNEL_LIBC_TEST=1
+		;;
+		-h|--help)
+			HELP=1
+		;;
+		-v|--verbose)
+			set -x
+		;;
+		*)
+			help
+			echo "Unknown argument: $p"
+			exit 1
+		;;
+	esac
+done
+
+if [ "$HELP" != "0" ]; then help; exit 0; fi
+
+# sanity test
+if [ ! -d ./linux ]; then
+	echo Sanity check error: ./linux directory not found
+	echo Should be called in usr/include after \'make headers_install\'.
+	echo Returns number of failed files, 0 if none.
+	exit 1
+fi
+
+# Support CC variable for compiler and ccache, and cross compiling.
+# CC is used without quotes to support CC="ccache gcc".
+set +u
+if [ "$CC"foobar == "foobar" ]; then
+	CC=cc
+fi
+
+if [ "$CROSS_COMPILE"foobar != "foobar" ]; then
+	# Using gcc name since some cross compiler tool chains don't provide
+	# the cc symlink. Using eval to expand ~ to $HOME.
+	CC="$( eval echo "$CROSS_COMPILE"gcc )"
+fi
+set -u
+
+# Kernel headers refer to some gcc and libc headers so make them available.
+set +u
+if [ "$ARCH_TRIPLET"foobar == "foobar" ]; then
+	# Taking triplet from gcc/cpp
+	ARCH_TRIPLET="$( $CC -v -x c -E - < /dev/null 2>&1 | \
+			grep Target | sed -e 's/Target: //' )"
+fi
+
+if [ "$LIBC"foobar == "foobar" ]; then
+	# trying to grep libc includes from gcc/cpp defaults
+	_TEMP="$( $CC -v -x c -E - < /dev/null 2>&1 | \
+		sed -n -e '/^#include <...> search starts here:$/,/^End of search list.$/{//!p}' | \
+		sed -e 's/^\ \//\//g' | \
+		grep '/usr/include' )"
+
+	# sanity check and prepare LIBC dirs
+	for d in $_TEMP; do
+		if [ ! -d "$d" ]; then
+			echo "$d not a directory"
+			exit 1
+		fi
+		LIBC="$LIBC $d"
+	done
+fi
+set -u
+
+# Copy libc include files to temp directory for the tests.
+COMPILE_TEST_INC="$( readlink -f \
+		"$( mktemp -d ../headers_compile_test_include.XXXXXX )" )"
+
+# cleanup if keep not set
+if [ "$KEEP" = "0" ]; then
+	trap 'rm -rf "$COMPILE_TEST_INC"' EXIT
+else
+	trap 'printf \
+"Temporary directory not cleaned up! Remove manually:\n${COMPILE_TEST_INC}\n"' \
+		EXIT
+fi
+
+for d in $LIBC; do
+	# check if last part of dir is the arch triplet, cross compile paths
+	# can have it also elsewhere so just the last one counts.
+	if ! ( echo "$d" | egrep "$ARCH_TRIPLET$" > /dev/null ); then
+		# hopefully just main libc dir, e.g. /usr/include,
+		# follow symlinks from e.g. /usr/include/bits
+		cp -aL "$d"/* "$COMPILE_TEST_INC"/
+	elif ( echo "$d" | egrep "$ARCH_TRIPLET$" > /dev/null ); then
+		# hopefully the arch specific dir, e.g. /usr/include/x86_64-linux-gnu
+		cp -ar "$d"/* "$COMPILE_TEST_INC/"
+	else
+		echo "$d unexpected, bailing out"
+		exit 1
+	fi
+done
+
+# A single header with all non-conflicting libc headers to test kernel
+# headers against libc headers for conflicts.
+if [ "$LIBC_TEST" != 0 ]; then
+	# List taken from Debian unstable libc6 version 2.21-9.
+	# Some glibc headers conflict with each other so they
+	# are filtered out. Not perfect but better than nothing.
+        #
+	# $ for f in $( egrep "\.h$" /var/lib/dpkg/info/libc6-dev\:i386.list | sed -e 's|/usr/include/||'| sort | grep -v arpa | grep -v linux-gnu | grep -v rpcsvc | grep -v regexp.h | grep -v rpc | grep -v scsi | grep -v talkd ); do echo "#include <$f>"; done > libc_headers.h
+
+	cat > "$COMPILE_TEST_INC/libc_headers.h" << EOF_LIBC_HEADERS
+#include <aio.h>
+#include <aliases.h>
+#include <alloca.h>
+#include <argp.h>
+#include <argz.h>
+#include <ar.h>
+#include <assert.h>
+#include <byteswap.h>
+#include <complex.h>
+#include <cpio.h>
+#include <crypt.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <dlfcn.h>
+#include <elf.h>
+#include <endian.h>
+#include <envz.h>
+#include <err.h>
+#include <errno.h>
+#include <error.h>
+#include <execinfo.h>
+#include <fcntl.h>
+#include <features.h>
+#include <fenv.h>
+#include <fmtmsg.h>
+#include <fnmatch.h>
+#include <fstab.h>
+#include <fts.h>
+#include <ftw.h>
+#include <_G_config.h>
+#include <gconv.h>
+#include <getopt.h>
+#include <glob.h>
+#include <gnu-versions.h>
+#include <grp.h>
+#include <gshadow.h>
+#include <iconv.h>
+#include <ifaddrs.h>
+#include <inttypes.h>
+#include <langinfo.h>
+#include <lastlog.h>
+#include <libgen.h>
+#include <libintl.h>
+#include <libio.h>
+#include <limits.h>
+#include <link.h>
+#include <locale.h>
+#include <malloc.h>
+#include <math.h>
+#include <mcheck.h>
+#include <memory.h>
+#include <mntent.h>
+#include <monetary.h>
+#include <mqueue.h>
+#include <netash/ash.h>
+#include <netatalk/at.h>
+#include <netax25/ax25.h>
+#include <netdb.h>
+#include <neteconet/ec.h>
+#include <net/ethernet.h>
+#include <net/if_arp.h>
+#include <net/if.h>
+#include <net/if_packet.h>
+#include <net/if_ppp.h>
+#include <net/if_shaper.h>
+#include <net/if_slip.h>
+#include <netinet/ether.h>
+#include <netinet/icmp6.h>
+#include <netinet/if_ether.h>
+#include <netinet/if_fddi.h>
+#include <netinet/if_tr.h>
+#include <netinet/igmp.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip6.h>
+#include <netinet/ip.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#include <netipx/ipx.h>
+#include <netiucv/iucv.h>
+#include <netpacket/packet.h>
+#include <net/ppp-comp.h>
+#include <net/ppp_defs.h>
+#include <netrom/netrom.h>
+#include <netrose/rose.h>
+#include <net/route.h>
+#include <nfs/nfs.h>
+#include <nl_types.h>
+#include <nss.h>
+#include <obstack.h>
+#include <paths.h>
+#include <poll.h>
+#include <printf.h>
+#include <protocols/routed.h>
+#include <protocols/rwhod.h>
+#include <protocols/timed.h>
+#include <pthread.h>
+#include <pty.h>
+#include <pwd.h>
+#include <re_comp.h>
+#include <regex.h>
+#include <resolv.h>
+#include <sched.h>
+#include <search.h>
+#include <semaphore.h>
+#include <setjmp.h>
+#include <sgtty.h>
+#include <shadow.h>
+#include <signal.h>
+#include <spawn.h>
+#include <stab.h>
+#include <stdc-predef.h>
+#include <stdint.h>
+#include <stdio_ext.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <stropts.h>
+#include <syscall.h>
+#include <sysexits.h>
+#include <syslog.h>
+#include <tar.h>
+#include <termio.h>
+#include <termios.h>
+#include <tgmath.h>
+#include <thread_db.h>
+#include <time.h>
+#include <ttyent.h>
+#include <uchar.h>
+#include <ucontext.h>
+#include <ulimit.h>
+#include <unistd.h>
+#include <ustat.h>
+#include <utime.h>
+#include <utmp.h>
+#include <utmpx.h>
+#include <values.h>
+#include <wait.h>
+#include <wchar.h>
+#include <wctype.h>
+#include <wordexp.h>
+#include <xlocale.h>
+EOF_LIBC_HEADERS
+
+fi # LIBC_TEST
+
+# Simulate libc headers without kernel headers by removing
+# all known kernel header dirs from the copied libc ones.
+# This seems to magically work.
+_KERNEL_DIRS="$( find . -type d | grep -v '^\.$' )"
+( cd "$COMPILE_TEST_INC" && rm -rf $_KERNEL_DIRS )
+
+# GCC headers
+set +u
+if [ "$GCC_INC"foobar == "foobar" ]; then
+	# Take from $CC default system include paths, filter out
+	# /usr/local/include and /usr/include stuff first, then try to match
+	# for gcc.
+	_TEMP="$( $CC -v -x c -E - < /dev/null 2>&1 | \
+		sed -n -e '/^#include <...> search starts here:$/,/^End of search list.$/{//!p}' | \
+		sed -e 's/^\ \//\//g' | \
+		egrep -v '/usr/local/include' | \
+		egrep -v '/usr/include' | \
+		grep gcc | \
+		xargs )"
+
+	# merge and prepare for use with $CC
+	for d in $_TEMP; do
+		# sanity test
+		if [ ! -d "$d" ]; then
+			echo "$d: is not a directory"
+			exit 1
+		fi
+		GCC_INC="$GCC_INC -I $d"
+	done
+fi
+set -u
+
+# sanity check: test that plain libc headers compile
+if [ "$LIBC_TEST" != 0 ]; then
+	echo "Testing that $COMPILE_TEST_INC/libc_headers.h compiles"
+	$CC -Wall -c -nostdinc $GCC_INC -I . \
+		-I "$COMPILE_TEST_INC" \
+		-I "$COMPILE_TEST_INC/$ARCH_TRIPLET" \
+		-o /dev/null \
+		"$COMPILE_TEST_INC/libc_headers.h"
+fi
+
+# Summary counters:
+_FAILED=0
+_PASSED=0
+_LIBC_FAILED=0
+_LIBC_PASSED=0
+_LIBC_BEFORE_KERNEL_FAILED=0
+_LIBC_BEFORE_KERNEL_PASSED=0
+_KERNEL_BEFORE_LIBC_FAILED=0
+_KERNEL_BEFORE_LIBC_PASSED=0
+
+# For each header file, try to compile it using the headers we prepared.
+for f in $( find . -name "*\.h" -printf "%P\n" ); do
+	_FAIL=0
+	_FAIL_LIBC=0
+	_FAIL_LIBC_BEFORE_KERNEL=0
+	_FAIL_KERNEL_BEFORE_LIBC=0
+
+	# compile test, CC not quoted to support ccache
+	echo $CC -Wall -c -nostdinc $GCC_INC -I . -I "$COMPILE_TEST_INC" -I "$COMPILE_TEST_INC/$ARCH_TRIPLET" -o /dev/null "$PWD/$f"
+	$CC -Wall -c -nostdinc $GCC_INC -I . -I "$COMPILE_TEST_INC" -I "$COMPILE_TEST_INC/$ARCH_TRIPLET" -o /dev/null "$PWD/$f" \
+		|| _FAIL=1
+
+	# report errors
+	if [ "$_FAIL" -gt 0 ]; then
+		echo "FAILED: $f"
+		_FAILED="$(( _FAILED + 1 ))"
+	else
+		echo "PASSED: $f"
+		_PASSED="$(( _PASSED + 1))"
+	fi
+
+	# libc header conflict tests
+	if [ "$LIBC_TEST" != 0 ]; then
+		_LIBC_BEFORE_KERNEL="$PWD/$f"_libc_before_kernel.h
+		_KERNEL_BEFORE_LIBC="$PWD/$f"_kernel_before_libc.h
+
+		# libc header included before kernel header
+		if [ "$LIBC_KERNEL_TEST" != 0 ]; then
+			cat > "$_LIBC_BEFORE_KERNEL" << EOF_LIBC_BEFORE_KERNEL
+#include <libc_headers.h>
+#include <$f>
+EOF_LIBC_BEFORE_KERNEL
+			echo \
+				$CC -Wall -c -nostdinc $GCC_INC \
+				-I . -I "$COMPILE_TEST_INC" \
+				-I "$COMPILE_TEST_INC/$ARCH_TRIPLET" \
+				-o /dev/null "$_LIBC_BEFORE_KERNEL"
+			$CC -Wall -c -nostdinc $GCC_INC \
+				-I . -I "$COMPILE_TEST_INC" \
+				-I "$COMPILE_TEST_INC/$ARCH_TRIPLET" \
+				-o /dev/null "$_LIBC_BEFORE_KERNEL" \
+				|| _FAIL_LIBC_BEFORE_KERNEL=1
+
+			# report errors
+			if [ "$_FAIL_LIBC_BEFORE_KERNEL" -gt 0 ]; then
+				echo "FAILED libc before kernel test: $f"
+				_LIBC_BEFORE_KERNEL_FAILED="$(( _LIBC_BEFORE_KERNEL_FAILED + 1 ))"
+			else
+				echo "PASSED libc before kernel test: $f"
+				_LIBC_BEFORE_KERNEL_PASSED="$(( _LIBC_BEFORE_KERNEL_PASSED + 1))"
+			fi
+		fi
+
+		# kernel header included before libc
+		if [ "$KERNEL_LIBC_TEST" != 0 ]; then
+			cat > "$_KERNEL_BEFORE_LIBC" << EOF_KERNEL_BEFORE_LIBC
+#include <$f>
+#include <libc_headers.h>
+EOF_KERNEL_BEFORE_LIBC
+			echo \
+				$CC -Wall -c -nostdinc $GCC_INC \
+				-I . -I "$COMPILE_TEST_INC" \
+				-I "$COMPILE_TEST_INC/$ARCH_TRIPLET" \
+				-o /dev/null "$_KERNEL_BEFORE_LIBC"
+			$CC -Wall -c -nostdinc $GCC_INC \
+				-I . -I "$COMPILE_TEST_INC" \
+				-I "$COMPILE_TEST_INC/$ARCH_TRIPLET" \
+				-o /dev/null "$_KERNEL_BEFORE_LIBC" \
+				|| _FAIL_KERNEL_BEFORE_LIBC=1
+
+			# report errors
+			if [ "$_FAIL_KERNEL_BEFORE_LIBC" -gt 0 ]; then
+				echo "FAILED kernel before libc test: $f"
+				_KERNEL_BEFORE_LIBC_FAILED="$(( _KERNEL_BEFORE_LIBC_FAILED + 1 ))"
+			else
+				echo "PASSED kernel before libc test: $f"
+				_KERNEL_BEFORE_LIBC_PASSED="$(( _KERNEL_BEFORE_LIBC_PASSED + 1))"
+			fi
+		fi
+
+		# libc summary
+		if [ "$_FAIL_LIBC_BEFORE_KERNEL" -gt 0 -o "$_FAIL_KERNEL_BEFORE_LIBC" -gt 0 ]; then
+			_LIBC_FAILED="$(( _LIBC_FAILED + 1))"
+		else
+			_LIBC_PASSED="$(( _LIBC_PASSED + 1))"
+		fi
+
+		if [ "$KEEP" = "0" ]; then
+			rm -f "$_LIBC_BEFORE_KERNEL" "$_KERNEL_BEFORE_LIBC"
+		fi
+	fi # LIBC_TEST
+done
+
+cat << EOF_STATS
+
+Kernel header compile test statistics:
+
+$_FAILED files failed the kernel header compile test.
+$_PASSED files passed the kernel header compile test.
+
+EOF_STATS
+
+if [ "$LIBC_TEST" != 0 ]; then
+	cat << EOF_LIBC_STATS
+libc and kernel header compatibility test statistics:
+EOF_LIBC_STATS
+
+if [ "$LIBC_KERNEL_TEST" != 0 ] && [ "$KERNEL_LIBC_TEST" != 0 ]; then
+	cat << EOF_LIBC_COMBINED
+$_LIBC_FAILED files failed the libc compatibility test.
+$_LIBC_PASSED files passed the libc compatibility test.
+EOF_LIBC_COMBINED
+fi
+
+if [ "$LIBC_KERNEL_TEST" != 0 ]; then
+	cat << EOF_LIBC_KERNEL
+$_LIBC_BEFORE_KERNEL_FAILED files failed libc before kernel include test.
+$_LIBC_BEFORE_KERNEL_PASSED files passed libc before kernel include test.
+EOF_LIBC_KERNEL
+fi
+
+if [ "$KERNEL_LIBC_TEST" != 0 ]; then
+	cat << EOF_KERNEL_LIBC
+$_KERNEL_BEFORE_LIBC_FAILED files failed kernel before libc include test.
+$_KERNEL_BEFORE_LIBC_PASSED files passed kernel before libc include test.
+EOF_KERNEL_LIBC
+fi
+
+fi # LIBC_TEST
+
+# return value, summary of all failures.
+if [ "$(( $_FAILED + $_LIBC_BEFORE_KERNEL_FAILED + $_KERNEL_BEFORE_LIBC_FAILED ))" != 0 ]; then
+	exit 1
+else
+	exit 0
+fi
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 02/36] uapi scsi/scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers Mikko Rapeli
@ 2017-08-06 16:43 ` Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 03/36] uapi scsi/scsi_netlink.h: use __u8, __u16 " Mikko Rapeli
                   ` (30 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, linux-scsi

Fixes userspace compilation errors like:

scsi/scsi_bsg_fc.h:83:2: error: unknown type name ‘uint8_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: linux-scsi@vger.kernel.org
---
 include/uapi/scsi/scsi_bsg_fc.h | 54 +++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h
index 3031b900b087..1a2044755636 100644
--- a/include/uapi/scsi/scsi_bsg_fc.h
+++ b/include/uapi/scsi/scsi_bsg_fc.h
@@ -22,6 +22,8 @@
 #ifndef SCSI_BSG_FC_H
 #define SCSI_BSG_FC_H
 
+#include <linux/types.h>
+
 /*
  * This file intended to be included by both kernel and user space
  */
@@ -80,10 +82,10 @@
  * with the transport upon completion of the login.
  */
 struct fc_bsg_host_add_rport {
-	uint8_t		reserved;
+	__u8		reserved;
 
 	/* FC Address Identier of the remote port to login to */
-	uint8_t		port_id[3];
+	__u8		port_id[3];
 };
 
 /* Response:
@@ -101,10 +103,10 @@ struct fc_bsg_host_add_rport {
  * remain logged in with the remote port.
  */
 struct fc_bsg_host_del_rport {
-	uint8_t		reserved;
+	__u8		reserved;
 
 	/* FC Address Identier of the remote port to logout of */
-	uint8_t		port_id[3];
+	__u8		port_id[3];
 };
 
 /* Response:
@@ -125,10 +127,10 @@ struct fc_bsg_host_els {
 	 * ELS Command Code being sent (must be the same as byte 0
 	 * of the payload)
 	 */
-	uint8_t 	command_code;
+	__u8	command_code;
 
 	/* FC Address Identier of the remote port to send the ELS to */
-	uint8_t		port_id[3];
+	__u8		port_id[3];
 };
 
 /* Response:
@@ -165,14 +167,14 @@ struct fc_bsg_ctels_reply {
 	 * Note: x_RJT/BSY status will indicae that the rjt_data field
 	 *   is valid and contains the reason/explanation values.
 	 */
-	uint32_t	status;		/* See FC_CTELS_STATUS_xxx */
+	__u32	status;		/* See FC_CTELS_STATUS_xxx */
 
 	/* valid if status is not FC_CTELS_STATUS_OK */
 	struct	{
-		uint8_t	action;		/* fragment_id for CT REJECT */
-		uint8_t	reason_code;
-		uint8_t	reason_explanation;
-		uint8_t	vendor_unique;
+		__u8	action;		/* fragment_id for CT REJECT */
+		__u8	reason_code;
+		__u8	reason_explanation;
+		__u8	vendor_unique;
 	} rjt_data;
 };
 
@@ -188,17 +190,17 @@ struct fc_bsg_ctels_reply {
  * and whether to tear it down after the request.
  */
 struct fc_bsg_host_ct {
-	uint8_t		reserved;
+	__u8		reserved;
 
 	/* FC Address Identier of the remote port to send the ELS to */
-	uint8_t		port_id[3];
+	__u8		port_id[3];
 
 	/*
 	 * We need words 0-2 of the generic preamble for the LLD's
 	 */
-	uint32_t	preamble_word0;	/* revision & IN_ID */
-	uint32_t	preamble_word1;	/* GS_Type, GS_SubType, Options, Rsvd */
-	uint32_t	preamble_word2;	/* Cmd Code, Max Size */
+	__u32	preamble_word0;	/* revision & IN_ID */
+	__u32	preamble_word1;	/* GS_Type, GS_SubType, Options, Rsvd */
+	__u32	preamble_word2;	/* Cmd Code, Max Size */
 
 };
 /* Response:
@@ -218,17 +220,17 @@ struct fc_bsg_host_vendor {
 	 * Identifies the vendor that the message is formatted for. This
 	 * should be the recipient of the message.
 	 */
-	uint64_t vendor_id;
+	__u64 vendor_id;
 
 	/* start of vendor command area */
-	uint32_t vendor_cmd[0];
+	__u32 vendor_cmd[0];
 };
 
 /* Response:
  */
 struct fc_bsg_host_vendor_reply {
 	/* start of vendor response area */
-	uint32_t vendor_rsp[0];
+	__u32 vendor_rsp[0];
 };
 
 
@@ -247,7 +249,7 @@ struct fc_bsg_rport_els {
 	 * ELS Command Code being sent (must be the same as
 	 * byte 0 of the payload)
 	 */
-	uint8_t els_code;
+	__u8 els_code;
 };
 
 /* Response:
@@ -265,9 +267,9 @@ struct fc_bsg_rport_ct {
 	/*
 	 * We need words 0-2 of the generic preamble for the LLD's
 	 */
-	uint32_t	preamble_word0;	/* revision & IN_ID */
-	uint32_t	preamble_word1;	/* GS_Type, GS_SubType, Options, Rsvd */
-	uint32_t	preamble_word2;	/* Cmd Code, Max Size */
+	__u32	preamble_word0;	/* revision & IN_ID */
+	__u32	preamble_word1;	/* GS_Type, GS_SubType, Options, Rsvd */
+	__u32	preamble_word2;	/* Cmd Code, Max Size */
 };
 /* Response:
  *
@@ -279,7 +281,7 @@ struct fc_bsg_rport_ct {
 
 /* request (CDB) structure of the sg_io_v4 */
 struct fc_bsg_request {
-	uint32_t msgcode;
+	__u32 msgcode;
 	union {
 		struct fc_bsg_host_add_rport	h_addrport;
 		struct fc_bsg_host_del_rport	h_delrport;
@@ -303,10 +305,10 @@ struct fc_bsg_reply {
 	 *    msg and status fields. The per-msgcode reply structure
 	 *    will contain valid data.
 	 */
-	uint32_t result;
+	__u32 result;
 
 	/* If there was reply_payload, how much was recevied ? */
-	uint32_t reply_payload_rcv_len;
+	__u32 reply_payload_rcv_len;
 
 	union {
 		struct fc_bsg_host_vendor_reply		vendor_reply;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 03/36] uapi scsi/scsi_netlink.h: use __u8, __u16 and __u64 from linux/types.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 02/36] uapi scsi/scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h Mikko Rapeli
@ 2017-08-06 16:43 ` Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
                   ` (29 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, linux-scsi

Fixes userspace compilation errors like:

scsi/scsi_netlink.h:43:2: error: unknown type name ‘uint8_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: linux-scsi@vger.kernel.org
---
 include/uapi/scsi/scsi_netlink.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/uapi/scsi/scsi_netlink.h b/include/uapi/scsi/scsi_netlink.h
index 62b4edab15d3..36b53a769a04 100644
--- a/include/uapi/scsi/scsi_netlink.h
+++ b/include/uapi/scsi/scsi_netlink.h
@@ -22,8 +22,8 @@
 #ifndef SCSI_NETLINK_H
 #define SCSI_NETLINK_H
 
-#include <linux/netlink.h>
 #include <linux/types.h>
+#include <linux/netlink.h>
 
 /*
  * This file intended to be included by both kernel and user space
@@ -40,12 +40,12 @@
 
 /* SCSI_TRANSPORT_MSG event message header */
 struct scsi_nl_hdr {
-	uint8_t version;
-	uint8_t transport;
-	uint16_t magic;
-	uint16_t msgtype;
-	uint16_t msglen;
-} __attribute__((aligned(sizeof(uint64_t))));
+	__u8 version;
+	__u8 transport;
+	__u16 magic;
+	__u16 msgtype;
+	__u16 msglen;
+} __attribute__((aligned(sizeof(__u64))));
 
 /* scsi_nl_hdr->version value */
 #define SCSI_NL_VERSION				1
@@ -89,10 +89,10 @@ struct scsi_nl_hdr {
  */
 struct scsi_nl_host_vendor_msg {
 	struct scsi_nl_hdr snlh;		/* must be 1st element ! */
-	uint64_t vendor_id;
-	uint16_t host_no;
-	uint16_t vmsg_datalen;
-} __attribute__((aligned(sizeof(uint64_t))));
+	__u64 vendor_id;
+	__u16 host_no;
+	__u16 vmsg_datalen;
+} __attribute__((aligned(sizeof(__u64))));
 
 
 /*
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 and __u64 from linux/types.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (2 preceding siblings ...)
  2017-08-06 16:43 ` [PATCH v06 03/36] uapi scsi/scsi_netlink.h: use __u8, __u16 " Mikko Rapeli
@ 2017-08-06 16:43 ` Mikko Rapeli
  2017-08-06 18:22   ` James Bottomley
  2017-08-06 16:43 ` [PATCH v06 06/36] uapi asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli
                   ` (28 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, linux-scsi

Fixes userspace compilation errors like:

scsi/scsi_netlink_fc.h:60:2: error: expected specifier-qualifier-list before ‘uint64_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: linux-scsi@vger.kernel.org
---
 include/uapi/scsi/scsi_netlink_fc.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/uapi/scsi/scsi_netlink_fc.h b/include/uapi/scsi/scsi_netlink_fc.h
index cbf76e479761..2493a0f533dc 100644
--- a/include/uapi/scsi/scsi_netlink_fc.h
+++ b/include/uapi/scsi/scsi_netlink_fc.h
@@ -57,14 +57,14 @@
  */
 struct fc_nl_event {
 	struct scsi_nl_hdr snlh;		/* must be 1st element ! */
-	uint64_t seconds;
-	uint64_t vendor_id;
-	uint16_t host_no;
-	uint16_t event_datalen;
-	uint32_t event_num;
-	uint32_t event_code;
-	uint32_t event_data;
-} __attribute__((aligned(sizeof(uint64_t))));
+	__u64 seconds;
+	__u64 vendor_id;
+	__u16 host_no;
+	__u16 event_datalen;
+	__u32 event_num;
+	__u32 event_code;
+	__u32 event_data;
+} __attribute__((aligned(sizeof(__u64))));
 
 
 #endif /* SCSI_NETLINK_FC_H */
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t
       [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-06 16:43   ` Mikko Rapeli
       [not found]     ` <20170806164428.2273-6-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44   ` [PATCH v06 21/36] uapi linux/kexec.h: " Mikko Rapeli
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: Mikko Rapeli, Arnd Bergmann, David S . Miller, Matthew Whitehead,
	Joel Scherpelz, Lorenzo Colitti

Fixes userspace compilation error:

error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
---
 include/uapi/linux/sysctl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index e13d48058b8d..35a4b8b417fe 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -35,9 +35,9 @@ struct __sysctl_args {
 	int __user *name;
 	int nlen;
 	void __user *oldval;
-	size_t __user *oldlenp;
+	__kernel_size_t __user *oldlenp;
 	void __user *newval;
-	size_t newlen;
+	__kernel_size_t newlen;
 	unsigned long __unused[4];
 };
 
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 06/36] uapi asm-generic/ipcbuf.h: include linux/posix_types.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (3 preceding siblings ...)
  2017-08-06 16:43 ` [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
@ 2017-08-06 16:43 ` Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 07/36] uapi asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli
                   ` (27 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, H. Peter Anvin, H . J . Lu, Arnd Bergmann, linux-arch

Fixes userspace compilation error:

error: unknown type name ‘__kernel_key_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/asm-generic/ipcbuf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/asm-generic/ipcbuf.h b/include/uapi/asm-generic/ipcbuf.h
index 3dbcc1e771c0..909f825096f4 100644
--- a/include/uapi/asm-generic/ipcbuf.h
+++ b/include/uapi/asm-generic/ipcbuf.h
@@ -1,6 +1,8 @@
 #ifndef __ASM_GENERIC_IPCBUF_H
 #define __ASM_GENERIC_IPCBUF_H
 
+#include <linux/posix_types.h>
+
 /*
  * The generic ipc64_perm structure:
  * Note extra padding because this structure is passed back and forth
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 07/36] uapi asm-generic/msgbuf.h: include asm/ipcbuf.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (4 preceding siblings ...)
  2017-08-06 16:43 ` [PATCH v06 06/36] uapi asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli
@ 2017-08-06 16:43 ` Mikko Rapeli
  2017-08-06 16:43 ` [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes Mikko Rapeli
                   ` (26 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, H . J . Lu, H . Peter Anvin, Arnd Bergmann, linux-arch

Fixes userspace compilation errors like:

error: field ‘msg_perm’ has incomplete type
struct ipc64_perm msg_perm

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: H.J. Lu <hjl.tools@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/msgbuf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h
index f55ecc43c60f..f5fbd8e8ab05 100644
--- a/include/uapi/asm-generic/msgbuf.h
+++ b/include/uapi/asm-generic/msgbuf.h
@@ -2,6 +2,8 @@
 #define __ASM_GENERIC_MSGBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm/ipcbuf.h>
+
 /*
  * generic msqid64_ds structure.
  *
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (5 preceding siblings ...)
  2017-08-06 16:43 ` [PATCH v06 07/36] uapi asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli
@ 2017-08-06 16:43 ` Mikko Rapeli
  2017-08-08 22:42   ` Dmitry V. Levin
  2017-08-06 16:44 ` [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
                   ` (25 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:43 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, H . J . Lu, H . Peter Anvin, Arnd Bergmann, linux-arch

Include linux/types.h and asm/msgbuf.h and use __kernel_size_t instead
of size_t.

Fixes userspace compilation errors like:

error: field ‘shm_perm’ has incomplete type
struct ipc64_perm shm_perm; /* operation perms */
error: unknown type name ‘size_t’
error: unknown type name ‘__kernel_time_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: H.J. Lu <hjl.tools@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/shmbuf.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 7e9fb2f0853b..ae867ad1e5e4 100644
--- a/include/uapi/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
@@ -1,7 +1,9 @@
 #ifndef __ASM_GENERIC_SHMBUF_H
 #define __ASM_GENERIC_SHMBUF_H
 
+#include <linux/types.h>
 #include <asm/bitsperlong.h>
+#include <asm/msgbuf.h>
 
 /*
  * The shmid64_ds structure for x86 architecture.
@@ -24,7 +26,7 @@
 
 struct shmid64_ds {
 	struct ipc64_perm	shm_perm;	/* operation perms */
-	size_t			shm_segsz;	/* size of segment (bytes) */
+	__kernel_size_t		shm_segsz;	/* size of segment (bytes) */
 	__kernel_time_t		shm_atime;	/* last attach time */
 #if __BITS_PER_LONG != 64
 	unsigned long		__unused1;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (6 preceding siblings ...)
  2017-08-06 16:43 ` [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-08 22:45   ` Dmitry V. Levin
  2017-08-06 16:44 ` [PATCH v06 10/36] uapi asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
                   ` (24 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, H . J . Lu, H . Peter Anvin, Arnd Bergmann, linux-arch

Fixes userspace compilation errors like:

error: field ‘msg_perm’ has incomplete type
struct ipc64_perm msg_perm;
error: unknown type name ‘__kernel_ulong_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: H.J. Lu <hjl.tools@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/sembuf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h
index 4cb2c13e5090..17d523f86923 100644
--- a/include/uapi/asm-generic/sembuf.h
+++ b/include/uapi/asm-generic/sembuf.h
@@ -2,6 +2,8 @@
 #define __ASM_GENERIC_SEMBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm/posix_types.h>
+#include <asm/ipcbuf.h>
 
 /*
  * The semid64_ds structure for x86 architecture.
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 10/36] uapi asm-generic/signal.h: use __kernel_size_t instead of size_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (7 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 11/36] uapi asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli
                   ` (23 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Al Viro, H . Peter Anvin, Arnd Bergmann, linux-arch

Fixes userspace compiler error:

error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/signal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h
index 3094618d382f..6bbcdfa5db89 100644
--- a/include/uapi/asm-generic/signal.h
+++ b/include/uapi/asm-generic/signal.h
@@ -113,7 +113,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

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 11/36] uapi asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (8 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 10/36] uapi asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
                   ` (22 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, H . Peter Anvin, Arnd Bergmann, Al Viro, linux-arch

Fixes userspace compiler errors:

error: unknown type name ‘stack_t’
error: field ‘uc_mcontext’ has incomplete type
struct sigcontext uc_mcontext;
error: unknown type name ‘sigset_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
 include/uapi/asm-generic/ucontext.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/asm-generic/ucontext.h b/include/uapi/asm-generic/ucontext.h
index ad77343e8a9a..448152801c4f 100644
--- a/include/uapi/asm-generic/ucontext.h
+++ b/include/uapi/asm-generic/ucontext.h
@@ -1,6 +1,9 @@
 #ifndef __ASM_GENERIC_UCONTEXT_H
 #define __ASM_GENERIC_UCONTEXT_H
 
+#include <asm/signal.h>
+#include <asm/sigcontext.h>
+
 struct ucontext {
 	unsigned long	  uc_flags;
 	struct ucontext  *uc_link;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (9 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 11/36] uapi asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-07 14:30   ` Arnd Bergmann
  2017-08-08 22:50   ` Dmitry V. Levin
  2017-08-06 16:44 ` [PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli
                   ` (21 subsequent siblings)
  32 siblings, 2 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Al Viro, Arnd Bergmann, H . Peter Anvin,
	Thomas Gleixner, Ingo Molnar, x86

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

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (10 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
       [not found]   ` <20170806164428.2273-14-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44 ` [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace Mikko Rapeli
                   ` (20 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Al Viro, Arnd Bergmann, H . Peter Anvin,
	Thomas Gleixner, Ingo Molnar, x86

Fixes userspace compile errors like:

error: field ‘sem_perm’ has incomplete type
  struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
error: unknown type name ‘__kernel_time_t’
  __kernel_time_t sem_otime; /* last semop time */

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/sembuf.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h
index cc2d6a3aeae7..f11ed5282eec 100644
--- a/arch/x86/include/uapi/asm/sembuf.h
+++ b/arch/x86/include/uapi/asm/sembuf.h
@@ -1,6 +1,9 @@
 #ifndef _ASM_X86_SEMBUF_H
 #define _ASM_X86_SEMBUF_H
 
+#include <linux/types.h>
+#include <linux/ipc.h>
+
 /*
  * The semid64_ds structure for x86 architecture.
  * Note extra padding because this structure is passed back and forth
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (11 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-08 22:57   ` Dmitry V. Levin
  2017-08-06 16:44 ` [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space Mikko Rapeli
                   ` (19 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: linux-arm-kernel, Mikko Rapeli, Russell King, Arnd Bergmann

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (12 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
       [not found]   ` <20170806164428.2273-16-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44 ` [PATCH v06 16/36] uapi linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli
                   ` (18 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, netdev, Dmitry V . Levin

This libc header has sockaddr definition in user space.

Fixes user space compilation errors like these from kernel headers including
only linux/socket.h:

error: field ‘ifru_addr’ has incomplete type
struct sockaddr ifru_addr;
error: field ‘_sockaddr’ has incomplete type
struct sockaddr  _sockaddr;
error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’

With this following uapi headers now compile in user space:

rdma/rdma_user_rxe.h
linux/vm_sockets.h
linux/ncp_fs.h
linux/nfc.h
linux/phonet.h

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: netdev@vger.kernel.org
Cc: Dmitry V. Levin <ldv@altlinux.org>
---
 include/uapi/linux/socket.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 76ab0c68561e..8a81197cc08b 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -1,6 +1,10 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 
+#ifndef __KERNEL__
+#include <sys/socket.h>
+#endif
+
 /*
  * Desired design of maximum size and alignment (see RFC2553)
  */
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 16/36] uapi linux/dlm_netlink.h: include linux/dlmconstants.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (13 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 17/36] uapi linux/sctp.h: use __u8, __u16 and __u32 from linux/types.h Mikko Rapeli
                   ` (17 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Christine Caulfield, David Teigland, cluster-devel

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

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 17/36] uapi linux/sctp.h: use __u8, __u16 and __u32 from linux/types.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (14 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 16/36] uapi linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli
                   ` (16 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Marcelo Ricardo Leitner, Xin Long, Phil Sutter,
	Vlad Yasevich, Neil Horman, linux-sctp

Fixes userspace compilation errors like:

linux/sctp.h:652:2: error: unknown type name ‘uint32_t’

Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
Cc: Phil Sutter <phil@nwl.cc>
---
 include/uapi/linux/sctp.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index 6217ff8500a1..d8b83fd56572 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi/linux/sctp.h
@@ -805,13 +805,13 @@ struct sctp_authkeyid {
  */
 struct sctp_sack_info {
 	sctp_assoc_t	sack_assoc_id;
-	uint32_t	sack_delay;
-	uint32_t	sack_freq;
+	__u32	sack_delay;
+	__u32	sack_freq;
 };
 
 struct sctp_assoc_value {
-    sctp_assoc_t            assoc_id;
-    uint32_t                assoc_value;
+	sctp_assoc_t	assoc_id;
+	__u32		assoc_value;
 };
 
 /*
@@ -881,7 +881,7 @@ struct sctp_status {
 struct sctp_authchunks {
 	sctp_assoc_t	gauth_assoc_id;
 	__u32		gauth_number_of_chunks;
-	uint8_t		gauth_chunks[];
+	__u8		gauth_chunks[];
 };
 
 /* The broken spelling has been released already in lksctp-tools header,
@@ -1077,15 +1077,15 @@ struct sctp_info {
 
 struct sctp_reset_streams {
 	sctp_assoc_t srs_assoc_id;
-	uint16_t srs_flags;
-	uint16_t srs_number_streams;	/* 0 == ALL */
-	uint16_t srs_stream_list[];	/* list if srs_num_streams is not 0 */
+	__u16 srs_flags;
+	__u16 srs_number_streams;	/* 0 == ALL */
+	__u16 srs_stream_list[];	/* list if srs_num_streams is not 0 */
 };
 
 struct sctp_add_streams {
 	sctp_assoc_t sas_assoc_id;
-	uint16_t sas_instrms;
-	uint16_t sas_outstrms;
+	__u16 sas_instrms;
+	__u16 sas_outstrms;
 };
 
 #endif /* _UAPI_SCTP_H */
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (15 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 17/36] uapi linux/sctp.h: use __u8, __u16 and __u32 from linux/types.h Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 20:23   ` Willem de Bruijn
  2017-08-06 16:44 ` [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
                   ` (15 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Willem de Bruijn, Soheil Hassas Yeganeh, netdev

linux/time.h conflicts with user space header time.h. Try to be compatible
with both.

Fixes userspace compilation error:

error: array type has incomplete element type
 struct timespec ts[3];

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Cc: netdev@vger.kernel.org
---
 include/uapi/linux/errqueue.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
index 07bdce1f444a..b310b2c6d94f 100644
--- a/include/uapi/linux/errqueue.h
+++ b/include/uapi/linux/errqueue.h
@@ -3,6 +3,12 @@
 
 #include <linux/types.h>
 
+#ifdef __KERNEL__
+#include <linux/time.h>
+#else
+#include <time.h>
+#endif /* __KERNEL__ */
+
 struct sock_extended_err {
 	__u32	ee_errno;	
 	__u8	ee_origin;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (16 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-07 15:00   ` Arnd Bergmann
  2017-08-08 23:11   ` Dmitry V. Levin
  2017-08-06 16:44 ` [PATCH v06 20/36] uapi linux/scc.h: include linux/sockios.h Mikko Rapeli
                   ` (14 subsequent siblings)
  32 siblings, 2 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, linux-omap, Tomi Valkeinen, Aaro Koskinen

Fixes userspace compilation error:

error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: linux-omap@vger.kernel.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 include/uapi/linux/omapfb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/omapfb.h b/include/uapi/linux/omapfb.h
index 7c97bc00ac6d..b637a924618f 100644
--- a/include/uapi/linux/omapfb.h
+++ b/include/uapi/linux/omapfb.h
@@ -181,7 +181,7 @@ struct omapfb_memory_read {
 	__u16 y;
 	__u16 w;
 	__u16 h;
-	size_t buffer_size;
+	__kernel_size_t buffer_size;
 	void __user *buffer;
 };
 
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 20/36] uapi linux/scc.h: include linux/sockios.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (17 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
       [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, netdev, linux-hams, Joerg Reuter

Fixes userspace compilation error:

error: ‘SIOCDEVPRIVATE’ undeclared here (not in a function)
  SIOCSCCRESERVED = SIOCDEVPRIVATE

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: netdev@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Cc: Joerg Reuter <jreuter@yaina.de>
---
 include/uapi/linux/scc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/scc.h b/include/uapi/linux/scc.h
index 72b6b8153374..2992b88ca4ce 100644
--- a/include/uapi/linux/scc.h
+++ b/include/uapi/linux/scc.h
@@ -3,6 +3,7 @@
 #ifndef _UAPI_SCC_H
 #define _UAPI_SCC_H
 
+#include <linux/sockios.h>
 
 /* selection of hardware types */
 
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 21/36] uapi linux/kexec.h: use __kernel_size_t instead of size_t
       [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:43   ` [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-06 16:44   ` Mikko Rapeli
       [not found]     ` <20170806164428.2273-22-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-08 23:15     ` Dmitry V. Levin
  2017-08-06 16:44   ` [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Mikko Rapeli
  2017-08-06 16:44   ` [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
  3 siblings, 2 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: Mikko Rapeli, kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Eric Biederman

Fixes userspace compilation error:

error: unknown type name ‘size_t’
  size_t bufsz;

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: kexec@lists.infradead.org
Cc: Eric Biederman <ebiederm@xmission.com>
---
 include/uapi/linux/kexec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h
index aae5ebf2022b..f964d83b2757 100644
--- a/include/uapi/linux/kexec.h
+++ b/include/uapi/linux/kexec.h
@@ -51,9 +51,9 @@
  */
 struct kexec_segment {
 	const void *buf;
-	size_t bufsz;
+	__kernel_size_t bufsz;
 	const void *mem;
-	size_t memsz;
+	__kernel_size_t memsz;
 };
 
 #endif /* __KERNEL__ */
-- 
2.13.3


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (19 preceding siblings ...)
       [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-08 23:17   ` Dmitry V. Levin
  2017-08-06 16:44 ` [PATCH v06 23/36] uapi linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli
                   ` (11 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, reiserfs-devel

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

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 23/36] uapi linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (20 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
       [not found]   ` <20170806164428.2273-24-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44 ` [PATCH v06 24/36] uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli
                   ` (10 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, Jan Harkes, codalist, coda

Fixes userspace compilation errors about unknown pid_t, u_short etc types.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
Cc: codalist@coda.cs.cmu.edu
---
 include/uapi/linux/coda.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/coda.h b/include/uapi/linux/coda.h
index 695fade33c64..2985ca00d63b 100644
--- a/include/uapi/linux/coda.h
+++ b/include/uapi/linux/coda.h
@@ -100,7 +100,14 @@ typedef unsigned long long u_quad_t;
 #if defined(__linux__)
 #include <linux/time.h>
 #define cdev_t u_quad_t
+
 #ifndef __KERNEL__
+typedef unsigned long u_long;
+typedef unsigned int u_int;
+typedef unsigned short u_short;
+typedef u_long ino_t;
+typedef u_long dev_t;
+typedef void *caddr_t;
 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
 #define _UQUAD_T_ 1
 typedef unsigned long long u_quad_t;
@@ -295,8 +302,8 @@ struct coda_statfs {
 struct coda_in_hdr {
     u_int32_t opcode;
     u_int32_t unique;	    /* Keep multiple outstanding msgs distinct */
-    pid_t pid;
-    pid_t pgid;
+    __kernel_pid_t pid;
+    __kernel_pid_t pgid;
     vuid_t uid;
 };
 
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 24/36] uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (21 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 23/36] uapi linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 25/36] uapi linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli
                   ` (9 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, coda, Jan Harkes, codalist

Only users of upc_req in kernel side fs/coda/psdev.c and fs/coda/upcall.c
already include linux/coda_psdev.h.

Suggested by Jan Harkes <jaharkes@cs.cmu.edu> on lkml message
<20150531111913.GA23377@cs.cmu.edu>.

Fixes these include/uapi/linux/coda_psdev.h compilation errors in userspace:

./linux/coda_psdev.h:12:19: error: field ‘uc_chain’ has incomplete type
  struct list_head    uc_chain;
                   ^
./linux/coda_psdev.h:13:2: error: unknown type name ‘caddr_t’
  caddr_t             uc_data;
  ^
./linux/coda_psdev.h:14:2: error: unknown type name ‘u_short’
  u_short             uc_flags;
  ^
./linux/coda_psdev.h:15:2: error: unknown type name ‘u_short’
  u_short             uc_inSize;  /* Size is at most 5000 bytes */
  ^
./linux/coda_psdev.h:16:2: error: unknown type name ‘u_short’
  u_short             uc_outSize;
  ^
./linux/coda_psdev.h:17:2: error: unknown type name ‘u_short’
  u_short             uc_opcode;  /* copied from data to save lookup */
  ^
./linux/coda_psdev.h:19:2: error: unknown type name ‘wait_queue_head_t’
  wait_queue_head_t   uc_sleep;   /* process' wait queue */
  ^

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: coda@cs.cmu.edu
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
---
 include/linux/coda_psdev.h      | 11 +++++++++++
 include/uapi/linux/coda_psdev.h | 13 -------------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 31e4e1f1547c..8eccf94b6d25 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -18,6 +18,17 @@ struct venus_comm {
 	struct mutex	    vc_mutex;
 };
 
+/* messages between coda filesystem in kernel and Venus */
+struct upc_req {
+	struct list_head	uc_chain;
+	caddr_t			uc_data;
+	u_short			uc_flags;
+	u_short			uc_inSize;  /* Size is at most 5000 bytes */
+	u_short			uc_outSize;
+	u_short			uc_opcode;  /* copied from data to save lookup */
+	int			uc_unique;
+	wait_queue_head_t	uc_sleep;   /* process' wait queue */
+};
 
 static inline struct venus_comm *coda_vcp(struct super_block *sb)
 {
diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h
index 79d05981fc4b..e2c44d2f7d5b 100644
--- a/include/uapi/linux/coda_psdev.h
+++ b/include/uapi/linux/coda_psdev.h
@@ -6,19 +6,6 @@
 #define CODA_PSDEV_MAJOR 67
 #define MAX_CODADEVS  5	   /* how many do we allow */
 
-
-/* messages between coda filesystem in kernel and Venus */
-struct upc_req {
-	struct list_head    uc_chain;
-	caddr_t	            uc_data;
-	u_short	            uc_flags;
-	u_short             uc_inSize;  /* Size is at most 5000 bytes */
-	u_short	            uc_outSize;
-	u_short	            uc_opcode;  /* copied from data to save lookup */
-	int		    uc_unique;
-	wait_queue_head_t   uc_sleep;   /* process' wait queue */
-};
-
 #define CODA_REQ_ASYNC  0x1
 #define CODA_REQ_READ   0x2
 #define CODA_REQ_WRITE  0x4
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 25/36] uapi linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (22 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 24/36] uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace Mikko Rapeli
                   ` (8 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: devel, Todd Kjos, Mikko Rapeli, Riley Andrews,
	Arve Hjønnevåg, Martijn Coenen, John Stultz,
	Greg Kroah-Hartman

Fixes userspace compilation errors:

error: unknown type name ‘pid_t’
  pid_t  sender_pid
error: unknown type name ‘uid_t’
  uid_t  sender_euid;

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: Todd Kjos <tkjos@android.com>
Cc: Martijn Coenen <maco@google.com>
Cc: devel@driverdev.osuosl.org
---
 include/uapi/linux/android/binder.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h
index 51f891fb1b18..4f7247722ad6 100644
--- a/include/uapi/linux/android/binder.h
+++ b/include/uapi/linux/android/binder.h
@@ -229,8 +229,8 @@ struct binder_transaction_data {
 
 	/* General information about the transaction. */
 	__u32	        flags;
-	pid_t		sender_pid;
-	uid_t		sender_euid;
+	__kernel_pid_t		sender_pid;
+	__kernel_uid_t		sender_euid;
 	binder_size_t	data_size;	/* number of bytes of data */
 	binder_size_t	offsets_size;	/* number of bytes of offsets */
 
-- 
2.13.3

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (23 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 25/36] uapi linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-15 22:58   ` [Xen-devel] " Stefano Stabellini
  2017-08-06 16:44 ` [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t Mikko Rapeli
                   ` (7 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Juergen Gross, Stefano Stabellini, Mikko Rapeli, Russell King,
	Paul Durrant, David Vrabel, xen-devel, Boris Ostrovsky

xen/interface/xen.h is not exported from kernel headers so remove the
dependency and provide needed defines for domid_t and xen_pfn_t if they
are not already defined by some other e.g. Xen specific headers.

Suggested by Andrew Cooper <andrew.cooper3@citrix.com> on lkml message
<5569F9C9.8000607@citrix.com>.

The ifdef for ARM is ugly but did not find better solutions for it.

Then use __kernel_size_t instead of size_t since that is available in
uapi headers in user space.

Fixes userspace compilation errors:

xen/privcmd.h:38:31: fatal error: xen/interface/xen.h: No such file or directory
xen/privcmd.h:92:2: error: unknown type name ‘size_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Paul Durrant <paul.durrant@citrix.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
---
 include/uapi/xen/privcmd.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/uapi/xen/privcmd.h b/include/uapi/xen/privcmd.h
index 63ee95c9dabb..565f3003741d 100644
--- a/include/uapi/xen/privcmd.h
+++ b/include/uapi/xen/privcmd.h
@@ -35,7 +35,17 @@
 
 #include <linux/types.h>
 #include <linux/compiler.h>
-#include <xen/interface/xen.h>
+
+/* Defined by include/xen/interface/xen.h, but it is not part of Linux uapi */
+#ifndef __XEN_PUBLIC_XEN_H__
+typedef __u16 domid_t;
+
+#if (defined __ARMEL__ || defined __ARMEB__)
+typedef __u64 xen_pfn_t;
+#else
+typedef unsigned long xen_pfn_t;
+#endif /* (defined __ARMEL__ || defined __ARMEB__) */
+#endif /* __XEN_PUBLIC_XEN_H__ */
 
 struct privcmd_hypercall {
 	__u64 op;
@@ -79,7 +89,7 @@ struct privcmd_mmapbatch_v2 {
 
 struct privcmd_dm_op_buf {
 	void __user *uptr;
-	size_t size;
+	__kernel_size_t size;
 };
 
 struct privcmd_dm_op {
-- 
2.13.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (24 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
       [not found]   ` <20170806164428.2273-28-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44 ` [PATCH v06 28/36] uapi xen/evtchn.h: include xen/privcmd.h Mikko Rapeli
                   ` (6 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Juergen Gross, Mikko Rapeli, Masahiro Yamada, xen-devel,
	Boris Ostrovsky, Andrew Morton

Both are needed to compile <xen/gntdev.h> in userspace. Fixes these
userspace compile errors:

xen/gntdev.h:151:4: error: unknown type name ‘grant_ref_t’
    grant_ref_t ref;
    ^
xen/gntdev.h:153:4: error: unknown type name ‘domid_t’
    domid_t domid;
    ^

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: xen-devel@lists.xenproject.org
---
 include/uapi/xen/gntdev.h           | 6 ++++++
 include/xen/interface/grant_table.h | 6 +-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h
index d0661977667e..f208706b07c9 100644
--- a/include/uapi/xen/gntdev.h
+++ b/include/uapi/xen/gntdev.h
@@ -34,6 +34,12 @@
 #define __LINUX_PUBLIC_GNTDEV_H__
 
 #include <linux/types.h>
+#include <xen/privcmd.h>
+
+/*
+ * Reference to a grant entry in a specified domain's grant table.
+ */
+typedef __u32 grant_ref_t;
 
 struct ioctl_gntdev_grant_ref {
 	/* The domain ID of the grant to be mapped. */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index 7fb7112d667c..29b3724aec2c 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -29,6 +29,7 @@
 #define __XEN_PUBLIC_GRANT_TABLE_H__
 
 #include <xen/interface/xen.h>
+#include <uapi/xen/gntdev.h> /* for grant_ref_t */
 
 /***********************************
  * GRANT TABLE REPRESENTATION
@@ -85,11 +86,6 @@
  */
 
 /*
- * Reference to a grant entry in a specified domain's grant table.
- */
-typedef uint32_t grant_ref_t;
-
-/*
  * A grant table comprises a packed array of grant entries in one or more
  * page frames shared between Xen and a guest.
  * [XEN]: This field is written by Xen and read by the sharing guest.
-- 
2.13.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 28/36] uapi xen/evtchn.h: include xen/privcmd.h
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (25 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 29/36] uapi linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Juergen Gross, Mikko Rapeli, Boris Ostrovsky, xen-devel

It has definition of domid_t. Fixes userspace compiler error when
xen/privcmd.h is compiled alone:

xen/evtchn.h:100:2: error: unknown type name ‘domid_t’
  domid_t domid;
  ^~~~~~~

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: xen-devel@lists.xenproject.org
---
 include/uapi/xen/evtchn.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/xen/evtchn.h b/include/uapi/xen/evtchn.h
index cb4aa4bb905e..81df4b378938 100644
--- a/include/uapi/xen/evtchn.h
+++ b/include/uapi/xen/evtchn.h
@@ -33,6 +33,8 @@
 #ifndef __LINUX_PUBLIC_EVTCHN_H__
 #define __LINUX_PUBLIC_EVTCHN_H__
 
+#include <xen/privcmd.h>
+
 /*
  * Bind a fresh port to VIRQ @virq.
  * Return allocated port.
-- 
2.13.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 29/36] uapi linux/elfcore.h: remove non-compiling userspace parts
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (26 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 28/36] uapi xen/evtchn.h: include xen/privcmd.h Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 31/36] uapi linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Al Viro, Ingo Molnar, Roland McGrath

Remove typedef elf_greg_t greg_t and friends from userspace.
Remove struct elf_prstatus completely from userspace.

elfcore.h as such does not compile in userspace. All userspace users
of <linux/elfcore.h> like gcc/gdb and linux-tools contain their own modified
versions of the file. With these changes the file compiles but is generally
not usable for things like core dump parsing but luckily userspace users
already know this and have their own modified version of the needed
definitions and headers. But at least this compiles now.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Roland McGrath <roland@redhat.com>
---
 include/uapi/linux/elfcore.h | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/include/uapi/linux/elfcore.h b/include/uapi/linux/elfcore.h
index 569737cfb557..6c230664e362 100644
--- a/include/uapi/linux/elfcore.h
+++ b/include/uapi/linux/elfcore.h
@@ -15,15 +15,7 @@ struct elf_siginfo
 	int	si_errno;			/* errno */
 };
 
-
-#ifndef __KERNEL__
-typedef elf_greg_t greg_t;
-typedef elf_gregset_t gregset_t;
-typedef elf_fpregset_t fpregset_t;
-typedef elf_fpxregset_t fpxregset_t;
-#define NGREG ELF_NGREG
-#endif
-
+#ifdef __KERNEL__
 /*
  * Definitions to generate Intel SVR4-like core files.
  * These mostly have the same names as the SVR4 types with "elf_"
@@ -48,10 +40,10 @@ struct elf_prstatus
 	struct sigaltstack pr_altstack;	/* Alternate stack info */
 	struct sigaction pr_action;	/* Signal action for current sig */
 #endif
-	pid_t	pr_pid;
-	pid_t	pr_ppid;
-	pid_t	pr_pgrp;
-	pid_t	pr_sid;
+	__kernel_pid_t	pr_pid;
+	__kernel_pid_t	pr_ppid;
+	__kernel_pid_t	pr_pgrp;
+	__kernel_pid_t	pr_sid;
 	struct timeval pr_utime;	/* User time */
 	struct timeval pr_stime;	/* System time */
 	struct timeval pr_cutime;	/* Cumulative user time */
@@ -72,6 +64,7 @@ struct elf_prstatus
 #endif
 	int pr_fpvalid;		/* True if math co-processor being used.  */
 };
+#endif /* __KERNEL__ */
 
 #define ELF_PRARGSZ	(80)	/* Number of chars for args */
 
@@ -84,7 +77,7 @@ struct elf_prpsinfo
 	unsigned long pr_flag;	/* flags */
 	__kernel_uid_t	pr_uid;
 	__kernel_gid_t	pr_gid;
-	pid_t	pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	__kernel_pid_t	pr_pid, pr_ppid, pr_pgrp, pr_sid;
 	/* Lots missing */
 	char	pr_fname[16];	/* filename of executable */
 	char	pr_psargs[ELF_PRARGSZ];	/* initial part of arg list */
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h
       [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:43   ` [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli
  2017-08-06 16:44   ` [PATCH v06 21/36] uapi linux/kexec.h: " Mikko Rapeli
@ 2017-08-06 16:44   ` Mikko Rapeli
       [not found]     ` <20170806164428.2273-31-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44   ` [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
  3 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: Mikko Rapeli, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Moni Shoua, Doug Ledford

Fixes these userspace compilation errors when rdma_user_rxe.h is compiled
alone:

rdma/rdma_user_rxe.h:59:20: error: field ‘_sockaddr’ has incomplete type
   struct sockaddr  _sockaddr;
                    ^~~~~~~~~
rdma/rdma_user_rxe.h:60:22: error: field ‘_sockaddr_in’ has incomplete type
   struct sockaddr_in _sockaddr_in;
                      ^~~~~~~~~~~~
rdma/rdma_user_rxe.h:61:23: error: field ‘_sockaddr_in6’ has incomplete type
   struct sockaddr_in6 _sockaddr_in6;
                       ^~~~~~~~~~~~~

Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
Acked-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Acked-by: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Hal Rosenstock <hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 include/uapi/rdma/rdma_user_rxe.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h
index 1de99cfdaf7d..ce6c929ca331 100644
--- a/include/uapi/rdma/rdma_user_rxe.h
+++ b/include/uapi/rdma/rdma_user_rxe.h
@@ -34,6 +34,8 @@
 #define RDMA_USER_RXE_H
 
 #include <linux/types.h>
+#include <linux/in.h>
+#include <linux/in6.h>
 
 union rxe_gid {
 	__u8	raw[16];
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 31/36] uapi linux/patchkey.h: change #error to #warning if file included directly
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (27 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 29/36] uapi linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 32/36] uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
                   ` (3 subsequent siblings)
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, alsa-devel, Andrew Veliath, Riccardo Facchetti

Would be nice to be able to compile all userspace header files also alone.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: alsa-devel@alsa-project.org
Cc: Andrew Veliath <andrewtv@usa.net>
Cc: Riccardo Facchetti <fizban@tin.it>
---
 include/uapi/linux/patchkey.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/patchkey.h b/include/uapi/linux/patchkey.h
index 1bda0e56bc5e..cee195d6d826 100644
--- a/include/uapi/linux/patchkey.h
+++ b/include/uapi/linux/patchkey.h
@@ -11,7 +11,7 @@
  */
 
 #ifndef _LINUX_PATCHKEY_H_INDIRECT
-#error "patchkey.h included directly"
+#warning "patchkey.h included directly"
 #endif
 
 #ifndef _UAPI_LINUX_PATCHKEY_H
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 32/36] uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and uint64_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (28 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 31/36] uapi linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
       [not found]   ` <20170806164428.2273-33-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44 ` [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Mikko Rapeli
                   ` (2 subsequent siblings)
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Emil Velikov, Russell King, dri-devel, Russell King

These are defined in linux/types.h or drm/drm.h. Fixes
user space compilation errors like:

drm/armada_drm.h:26:2: error: unknown type name ‘uint32_t’
  uint32_t handle;
  ^~~~~~~~

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Gabriel Laskar <gabriel@lse.epita.fr>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Rob Clark <robdclark@gmail.com>
---
 include/uapi/drm/armada_drm.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/uapi/drm/armada_drm.h b/include/uapi/drm/armada_drm.h
index 72e326f9c7de..0cb932416cfe 100644
--- a/include/uapi/drm/armada_drm.h
+++ b/include/uapi/drm/armada_drm.h
@@ -23,27 +23,27 @@ extern "C" {
 	DRM_##dir(DRM_COMMAND_BASE + DRM_ARMADA_##name, struct drm_armada_##str)
 
 struct drm_armada_gem_create {
-	uint32_t handle;
-	uint32_t size;
+	__u32 handle;
+	__u32 size;
 };
 #define DRM_IOCTL_ARMADA_GEM_CREATE \
 	ARMADA_IOCTL(IOWR, GEM_CREATE, gem_create)
 
 struct drm_armada_gem_mmap {
-	uint32_t handle;
-	uint32_t pad;
-	uint64_t offset;
-	uint64_t size;
-	uint64_t addr;
+	__u32 handle;
+	__u32 pad;
+	__u64 offset;
+	__u64 size;
+	__u64 addr;
 };
 #define DRM_IOCTL_ARMADA_GEM_MMAP \
 	ARMADA_IOCTL(IOWR, GEM_MMAP, gem_mmap)
 
 struct drm_armada_gem_pwrite {
-	uint64_t ptr;
-	uint32_t handle;
-	uint32_t offset;
-	uint32_t size;
+	__u64 ptr;
+	__u32 handle;
+	__u32 offset;
+	__u32 size;
 };
 #define DRM_IOCTL_ARMADA_GEM_PWRITE \
 	ARMADA_IOCTL(IOW, GEM_PWRITE, gem_pwrite)
-- 
2.13.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (29 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 32/36] uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
       [not found]   ` <20170806164428.2273-34-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  2017-08-06 16:44 ` [PATCH v06 34/36] uapi: break dependency loop between <linux/hdlc/ioctl.h> and <linux/if.h> Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space Mikko Rapeli
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: Mikko Rapeli, Darrick J . Wong, Theodore Ts'o

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

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 34/36] uapi: break dependency loop between <linux/hdlc/ioctl.h> and <linux/if.h>
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (30 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-06 16:44 ` [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space Mikko Rapeli
  32 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Frans Klaver, David Miller, Dmitry V. Levin, Jonas Gorski

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

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space
  2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
                   ` (31 preceding siblings ...)
  2017-08-06 16:44 ` [PATCH v06 34/36] uapi: break dependency loop between <linux/hdlc/ioctl.h> and <linux/if.h> Mikko Rapeli
@ 2017-08-06 16:44 ` Mikko Rapeli
  2017-08-08 23:25   ` Dmitry V. Levin
  32 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Mikko Rapeli, Dave Watson, Ilya Lesokhin, Aviad Yehezkel, netdev

It is not needed and not part of uapi headers, but causes
user space compilation error:

fatal error: net/tcp.h: No such file or directory
 #include <net/tcp.h>
                     ^

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Dave Watson <davejwatson@fb.com>
Cc: Ilya Lesokhin <ilyal@mellanox.com>
Cc: Aviad Yehezkel <aviadye@mellanox.com>
---
 include/uapi/linux/tls.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
index cc1d21db35d8..d87c698623f2 100644
--- a/include/uapi/linux/tls.h
+++ b/include/uapi/linux/tls.h
@@ -37,7 +37,9 @@
 #include <asm/byteorder.h>
 #include <linux/socket.h>
 #include <linux/tcp.h>
+#ifdef __KERNEL__
 #include <net/tcp.h>
+#endif
 
 /* TLS socket options */
 #define TLS_TX			1	/* Set transmit parameters */
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t
       [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-08-06 16:44   ` [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Mikko Rapeli
@ 2017-08-06 16:44   ` Mikko Rapeli
       [not found]     ` <20170806164428.2273-37-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  3 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 16:44 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: Mikko Rapeli, Yair Shachar, Oded Gabbay, Andrew Lewycky,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Include <drm/drm.h> instead of <linux/types.h> which on Linux includes
<linux/types.h> and on non-Linux platforms defines __u32 etc types.

Fixes user space compilation errors like:

linux/kfd_ioctl.h:33:2: error: unknown type name ‘uint32_t’
  uint32_t major_version; /* from KFD */
  ^~~~~~~~

Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
Cc: Yair Shachar <yair.shachar-5C7GfCeVMHo@public.gmane.org>
Cc: Oded Gabbay <oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Andrew Lewycky <Andrew.Lewycky-5C7GfCeVMHo@public.gmane.org>
---
 include/uapi/linux/kfd_ioctl.h | 172 ++++++++++++++++++++---------------------
 1 file changed, 86 insertions(+), 86 deletions(-)

diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index d6833426fdef..189ebfc2e193 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -23,15 +23,15 @@
 #ifndef KFD_IOCTL_H_INCLUDED
 #define KFD_IOCTL_H_INCLUDED
 
-#include <linux/types.h>
+#include <drm/drm.h>
 #include <linux/ioctl.h>
 
 #define KFD_IOCTL_MAJOR_VERSION 1
 #define KFD_IOCTL_MINOR_VERSION 1
 
 struct kfd_ioctl_get_version_args {
-	uint32_t major_version;	/* from KFD */
-	uint32_t minor_version;	/* from KFD */
+	__u32 major_version;	/* from KFD */
+	__u32 minor_version;	/* from KFD */
 };
 
 /* For kfd_ioctl_create_queue_args.queue_type. */
@@ -43,36 +43,36 @@ struct kfd_ioctl_get_version_args {
 #define KFD_MAX_QUEUE_PRIORITY		15
 
 struct kfd_ioctl_create_queue_args {
-	uint64_t ring_base_address;	/* to KFD */
-	uint64_t write_pointer_address;	/* from KFD */
-	uint64_t read_pointer_address;	/* from KFD */
-	uint64_t doorbell_offset;	/* from KFD */
-
-	uint32_t ring_size;		/* to KFD */
-	uint32_t gpu_id;		/* to KFD */
-	uint32_t queue_type;		/* to KFD */
-	uint32_t queue_percentage;	/* to KFD */
-	uint32_t queue_priority;	/* to KFD */
-	uint32_t queue_id;		/* from KFD */
-
-	uint64_t eop_buffer_address;	/* to KFD */
-	uint64_t eop_buffer_size;	/* to KFD */
-	uint64_t ctx_save_restore_address; /* to KFD */
-	uint64_t ctx_save_restore_size;	/* to KFD */
+	__u64 ring_base_address;	/* to KFD */
+	__u64 write_pointer_address;	/* from KFD */
+	__u64 read_pointer_address;	/* from KFD */
+	__u64 doorbell_offset;	/* from KFD */
+
+	__u32 ring_size;		/* to KFD */
+	__u32 gpu_id;		/* to KFD */
+	__u32 queue_type;		/* to KFD */
+	__u32 queue_percentage;	/* to KFD */
+	__u32 queue_priority;	/* to KFD */
+	__u32 queue_id;		/* from KFD */
+
+	__u64 eop_buffer_address;	/* to KFD */
+	__u64 eop_buffer_size;	/* to KFD */
+	__u64 ctx_save_restore_address; /* to KFD */
+	__u64 ctx_save_restore_size;	/* to KFD */
 };
 
 struct kfd_ioctl_destroy_queue_args {
-	uint32_t queue_id;		/* to KFD */
-	uint32_t pad;
+	__u32 queue_id;		/* to KFD */
+	__u32 pad;
 };
 
 struct kfd_ioctl_update_queue_args {
-	uint64_t ring_base_address;	/* to KFD */
+	__u64 ring_base_address;	/* to KFD */
 
-	uint32_t queue_id;		/* to KFD */
-	uint32_t ring_size;		/* to KFD */
-	uint32_t queue_percentage;	/* to KFD */
-	uint32_t queue_priority;	/* to KFD */
+	__u32 queue_id;		/* to KFD */
+	__u32 ring_size;		/* to KFD */
+	__u32 queue_percentage;	/* to KFD */
+	__u32 queue_priority;	/* to KFD */
 };
 
 /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */
@@ -80,13 +80,13 @@ struct kfd_ioctl_update_queue_args {
 #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
 
 struct kfd_ioctl_set_memory_policy_args {
-	uint64_t alternate_aperture_base;	/* to KFD */
-	uint64_t alternate_aperture_size;	/* to KFD */
+	__u64 alternate_aperture_base;	/* to KFD */
+	__u64 alternate_aperture_size;	/* to KFD */
 
-	uint32_t gpu_id;			/* to KFD */
-	uint32_t default_policy;		/* to KFD */
-	uint32_t alternate_policy;		/* to KFD */
-	uint32_t pad;
+	__u32 gpu_id;			/* to KFD */
+	__u32 default_policy;		/* to KFD */
+	__u32 alternate_policy;		/* to KFD */
+	__u32 pad;
 };
 
 /*
@@ -97,26 +97,26 @@ struct kfd_ioctl_set_memory_policy_args {
  */
 
 struct kfd_ioctl_get_clock_counters_args {
-	uint64_t gpu_clock_counter;	/* from KFD */
-	uint64_t cpu_clock_counter;	/* from KFD */
-	uint64_t system_clock_counter;	/* from KFD */
-	uint64_t system_clock_freq;	/* from KFD */
+	__u64 gpu_clock_counter;	/* from KFD */
+	__u64 cpu_clock_counter;	/* from KFD */
+	__u64 system_clock_counter;	/* from KFD */
+	__u64 system_clock_freq;	/* from KFD */
 
-	uint32_t gpu_id;		/* to KFD */
-	uint32_t pad;
+	__u32 gpu_id;		/* to KFD */
+	__u32 pad;
 };
 
 #define NUM_OF_SUPPORTED_GPUS 7
 
 struct kfd_process_device_apertures {
-	uint64_t lds_base;		/* from KFD */
-	uint64_t lds_limit;		/* from KFD */
-	uint64_t scratch_base;		/* from KFD */
-	uint64_t scratch_limit;		/* from KFD */
-	uint64_t gpuvm_base;		/* from KFD */
-	uint64_t gpuvm_limit;		/* from KFD */
-	uint32_t gpu_id;		/* from KFD */
-	uint32_t pad;
+	__u64 lds_base;		/* from KFD */
+	__u64 lds_limit;		/* from KFD */
+	__u64 scratch_base;		/* from KFD */
+	__u64 scratch_limit;		/* from KFD */
+	__u64 gpuvm_base;		/* from KFD */
+	__u64 gpuvm_limit;		/* from KFD */
+	__u32 gpu_id;		/* from KFD */
+	__u32 pad;
 };
 
 struct kfd_ioctl_get_process_apertures_args {
@@ -124,8 +124,8 @@ struct kfd_ioctl_get_process_apertures_args {
 			process_apertures[NUM_OF_SUPPORTED_GPUS];/* from KFD */
 
 	/* from KFD, should be in the range [1 - NUM_OF_SUPPORTED_GPUS] */
-	uint32_t num_of_nodes;
-	uint32_t pad;
+	__u32 num_of_nodes;
+	__u32 pad;
 };
 
 #define MAX_ALLOWED_NUM_POINTS    100
@@ -133,25 +133,25 @@ struct kfd_ioctl_get_process_apertures_args {
 #define MAX_ALLOWED_WAC_BUFF_SIZE  128
 
 struct kfd_ioctl_dbg_register_args {
-	uint32_t gpu_id;		/* to KFD */
-	uint32_t pad;
+	__u32 gpu_id;		/* to KFD */
+	__u32 pad;
 };
 
 struct kfd_ioctl_dbg_unregister_args {
-	uint32_t gpu_id;		/* to KFD */
-	uint32_t pad;
+	__u32 gpu_id;		/* to KFD */
+	__u32 pad;
 };
 
 struct kfd_ioctl_dbg_address_watch_args {
-	uint64_t content_ptr;		/* a pointer to the actual content */
-	uint32_t gpu_id;		/* to KFD */
-	uint32_t buf_size_in_bytes;	/*including gpu_id and buf_size */
+	__u64 content_ptr;		/* a pointer to the actual content */
+	__u32 gpu_id;		/* to KFD */
+	__u32 buf_size_in_bytes;	/*including gpu_id and buf_size */
 };
 
 struct kfd_ioctl_dbg_wave_control_args {
-	uint64_t content_ptr;		/* a pointer to the actual content */
-	uint32_t gpu_id;		/* to KFD */
-	uint32_t buf_size_in_bytes;	/*including gpu_id and buf_size */
+	__u64 content_ptr;		/* a pointer to the actual content */
+	__u32 gpu_id;		/* to KFD */
+	__u32 buf_size_in_bytes;	/*including gpu_id and buf_size */
 };
 
 /* Matching HSA_EVENTTYPE */
@@ -172,44 +172,44 @@ struct kfd_ioctl_dbg_wave_control_args {
 #define KFD_SIGNAL_EVENT_LIMIT			256
 
 struct kfd_ioctl_create_event_args {
-	uint64_t event_page_offset;	/* from KFD */
-	uint32_t event_trigger_data;	/* from KFD - signal events only */
-	uint32_t event_type;		/* to KFD */
-	uint32_t auto_reset;		/* to KFD */
-	uint32_t node_id;		/* to KFD - only valid for certain
+	__u64 event_page_offset;	/* from KFD */
+	__u32 event_trigger_data;	/* from KFD - signal events only */
+	__u32 event_type;		/* to KFD */
+	__u32 auto_reset;		/* to KFD */
+	__u32 node_id;		/* to KFD - only valid for certain
 							event types */
-	uint32_t event_id;		/* from KFD */
-	uint32_t event_slot_index;	/* from KFD */
+	__u32 event_id;		/* from KFD */
+	__u32 event_slot_index;	/* from KFD */
 };
 
 struct kfd_ioctl_destroy_event_args {
-	uint32_t event_id;		/* to KFD */
-	uint32_t pad;
+	__u32 event_id;		/* to KFD */
+	__u32 pad;
 };
 
 struct kfd_ioctl_set_event_args {
-	uint32_t event_id;		/* to KFD */
-	uint32_t pad;
+	__u32 event_id;		/* to KFD */
+	__u32 pad;
 };
 
 struct kfd_ioctl_reset_event_args {
-	uint32_t event_id;		/* to KFD */
-	uint32_t pad;
+	__u32 event_id;		/* to KFD */
+	__u32 pad;
 };
 
 struct kfd_memory_exception_failure {
-	uint32_t NotPresent;	/* Page not present or supervisor privilege */
-	uint32_t ReadOnly;	/* Write access to a read-only page */
-	uint32_t NoExecute;	/* Execute access to a page marked NX */
-	uint32_t pad;
+	__u32 NotPresent;	/* Page not present or supervisor privilege */
+	__u32 ReadOnly;	/* Write access to a read-only page */
+	__u32 NoExecute;	/* Execute access to a page marked NX */
+	__u32 pad;
 };
 
 /* memory exception data*/
 struct kfd_hsa_memory_exception_data {
 	struct kfd_memory_exception_failure failure;
-	uint64_t va;
-	uint32_t gpu_id;
-	uint32_t pad;
+	__u64 va;
+	__u32 gpu_id;
+	__u32 pad;
 };
 
 /* Event data*/
@@ -217,19 +217,19 @@ struct kfd_event_data {
 	union {
 		struct kfd_hsa_memory_exception_data memory_exception_data;
 	};				/* From KFD */
-	uint64_t kfd_event_data_ext;	/* pointer to an extension structure
+	__u64 kfd_event_data_ext;	/* pointer to an extension structure
 					   for future exception types */
-	uint32_t event_id;		/* to KFD */
-	uint32_t pad;
+	__u32 event_id;		/* to KFD */
+	__u32 pad;
 };
 
 struct kfd_ioctl_wait_events_args {
-	uint64_t events_ptr;		/* pointed to struct
+	__u64 events_ptr;		/* pointed to struct
 					   kfd_event_data array, to KFD */
-	uint32_t num_events;		/* to KFD */
-	uint32_t wait_for_all;		/* to KFD */
-	uint32_t timeout;		/* to KFD */
-	uint32_t wait_result;		/* from KFD */
+	__u32 num_events;		/* to KFD */
+	__u32 wait_for_all;		/* to KFD */
+	__u32 timeout;		/* to KFD */
+	__u32 wait_result;		/* from KFD */
 };
 
 #define AMDKFD_IOCTL_BASE 'K'
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 and __u64 from linux/types.h
  2017-08-06 16:43 ` [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
@ 2017-08-06 18:22   ` James Bottomley
       [not found]     ` <1502043773.2673.9.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: James Bottomley @ 2017-08-06 18:22 UTC (permalink / raw)
  To: Mikko Rapeli, linux-kernel, linux-api; +Cc: linux-scsi

On Sun, 2017-08-06 at 18:43 +0200, Mikko Rapeli wrote:
> Fixes userspace compilation errors like:
> 
> scsi/scsi_netlink_fc.h:60:2: error: expected specifier-qualifier-list 
> before ‘uint64_t’

Rather than patching the kernel, why not #include <stdint.h> in your
userspace programme?

James

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
  2017-08-06 16:44 ` [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli
@ 2017-08-06 20:23   ` Willem de Bruijn
  2017-08-06 20:26     ` Willem de Bruijn
       [not found]     ` <CAF=yD-L2ntuH54J_SwN9WcpBMgkV_v0e-Q2Pu2mrQ3+1RozGFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 2 replies; 90+ messages in thread
From: Willem de Bruijn @ 2017-08-06 20:23 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 6, 2017 at 12:44 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> linux/time.h conflicts with user space header time.h. Try to be compatible
> with both.
>
> Fixes userspace compilation error:
>
> error: array type has incomplete element type
>  struct timespec ts[3];
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Soheil Hassas Yeganeh <soheil@google.com>
> Cc: netdev@vger.kernel.org
> ---
>  include/uapi/linux/errqueue.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
> index 07bdce1f444a..b310b2c6d94f 100644
> --- a/include/uapi/linux/errqueue.h
> +++ b/include/uapi/linux/errqueue.h
> @@ -3,6 +3,12 @@
>
>  #include <linux/types.h>
>
> +#ifdef __KERNEL__
> +#include <linux/time.h>
> +#else
> +#include <time.h>
> +#endif /* __KERNEL__ */

This will break applications that include <linux/time.h> manually.

I previously sent a patch to use libc-compat to make compilation succeed
when both are included in the case where <linux/time.h> is included after
<time.h>.

  https://lkml.org/lkml/2016/9/12/872

The inverse will require changes to the libc header to avoid redefining
symbols already defined by <linux/time.h>

The second patch in that 2-patch set included <linux/time.h>
unconditionally after the fix. This broke builds that also included
<time.h> in the wrong order. I did not resubmit the first patch as a
stand-alone, as it is not sufficient to avoid breakage.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
  2017-08-06 20:23   ` Willem de Bruijn
@ 2017-08-06 20:26     ` Willem de Bruijn
  2017-08-06 20:58       ` Mikko Rapeli
       [not found]     ` <CAF=yD-L2ntuH54J_SwN9WcpBMgkV_v0e-Q2Pu2mrQ3+1RozGFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 90+ messages in thread
From: Willem de Bruijn @ 2017-08-06 20:26 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 6, 2017 at 4:23 PM, Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
> On Sun, Aug 6, 2017 at 12:44 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
>> linux/time.h conflicts with user space header time.h. Try to be compatible
>> with both.
>>
>> Fixes userspace compilation error:
>>
>> error: array type has incomplete element type
>>  struct timespec ts[3];
>>
>> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
>> Cc: Willem de Bruijn <willemb@google.com>
>> Cc: Soheil Hassas Yeganeh <soheil@google.com>
>> Cc: netdev@vger.kernel.org
>> ---
>>  include/uapi/linux/errqueue.h | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
>> index 07bdce1f444a..b310b2c6d94f 100644
>> --- a/include/uapi/linux/errqueue.h
>> +++ b/include/uapi/linux/errqueue.h
>> @@ -3,6 +3,12 @@
>>
>>  #include <linux/types.h>
>>
>> +#ifdef __KERNEL__
>> +#include <linux/time.h>
>> +#else
>> +#include <time.h>
>> +#endif /* __KERNEL__ */
>
> This will break applications that include <linux/time.h> manually.

Also, the patch title reads "include <linux/time.h> in user space",
but it includes <time.h> in that environment.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 and __u64 from linux/types.h
       [not found]     ` <1502043773.2673.9.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
@ 2017-08-06 20:42       ` Mikko Rapeli
  2017-08-06 22:09         ` James Bottomley
  0 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 20:42 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA

Hi,

On Sun, Aug 06, 2017 at 11:22:53AM -0700, James Bottomley wrote:
> On Sun, 2017-08-06 at 18:43 +0200, Mikko Rapeli wrote:
> > Fixes userspace compilation errors like:
> > 
> > scsi/scsi_netlink_fc.h:60:2: error: expected specifier-qualifier-list 
> > before ‘uint64_t’
> 
> Rather than patching the kernel, why not #include <stdint.h> in your
> userspace programme?

The userspace program is actually a test which checks that uapi headers
compile alone because several headers are not compiling at all and/or
require special tricks. The test is available here:

http://marc.info/?l=linux-kernel&m=150203944104544&w=2

I have tried that approach before but then:

https://lkml.org/lkml/2015/6/1/160

For some subsystems like fuse the above message was not enough and they
are including stdint.h in userspace. What shall we do with this old
scsi header file?

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
       [not found]     ` <CAF=yD-L2ntuH54J_SwN9WcpBMgkV_v0e-Q2Pu2mrQ3+1RozGFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-06 20:56       ` Mikko Rapeli
       [not found]         ` <20170806205654.GF28459-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 20:56 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 06, 2017 at 04:23:16PM -0400, Willem de Bruijn wrote:
> On Sun, Aug 6, 2017 at 12:44 PM, Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org> wrote:
> > linux/time.h conflicts with user space header time.h. Try to be compatible
> > with both.
> >
> > Fixes userspace compilation error:
> >
> > error: array type has incomplete element type
> >  struct timespec ts[3];
> >
> > Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> > Cc: Willem de Bruijn <willemb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> > Cc: Soheil Hassas Yeganeh <soheil-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> > Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > ---
> >  include/uapi/linux/errqueue.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
> > index 07bdce1f444a..b310b2c6d94f 100644
> > --- a/include/uapi/linux/errqueue.h
> > +++ b/include/uapi/linux/errqueue.h
> > @@ -3,6 +3,12 @@
> >
> >  #include <linux/types.h>
> >
> > +#ifdef __KERNEL__
> > +#include <linux/time.h>
> > +#else
> > +#include <time.h>
> > +#endif /* __KERNEL__ */
> 
> This will break applications that include <linux/time.h> manually.
> I previously sent a patch to use libc-compat to make compilation succeed
> when both are included in the case where <linux/time.h> is included after
> <time.h>.
> 
>   https://lkml.org/lkml/2016/9/12/872
> 
> The inverse will require changes to the libc header to avoid redefining
> symbols already defined by <linux/time.h>
> 
> The second patch in that 2-patch set included <linux/time.h>
> unconditionally after the fix. This broke builds that also included
> <time.h> in the wrong order. I did not resubmit the first patch as a
> stand-alone, as it is not sufficient to avoid breakage.

I wasn't aware of your change, but I was about to send this to fix the
case when glibc <time.h> is included before <linux/time.h>:

https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66

but you also ran into problems where <linux/time.h> is included before
<time.h> which need fixes in libc header side.

So how to proceed with these?

I don't like leaving a few dozen non-compiling header files into uapi.

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
  2017-08-06 20:26     ` Willem de Bruijn
@ 2017-08-06 20:58       ` Mikko Rapeli
  0 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 20:58 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 06, 2017 at 04:26:50PM -0400, Willem de Bruijn wrote:
> On Sun, Aug 6, 2017 at 4:23 PM, Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> > On Sun, Aug 6, 2017 at 12:44 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> >> linux/time.h conflicts with user space header time.h. Try to be compatible
> >> with both.
> >>
> >> Fixes userspace compilation error:
> >>
> >> error: array type has incomplete element type
> >>  struct timespec ts[3];
> >>
> >> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> >> Cc: Willem de Bruijn <willemb@google.com>
> >> Cc: Soheil Hassas Yeganeh <soheil@google.com>
> >> Cc: netdev@vger.kernel.org
> >> ---
> >>  include/uapi/linux/errqueue.h | 6 ++++++
> >>  1 file changed, 6 insertions(+)
> >>
> >> diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
> >> index 07bdce1f444a..b310b2c6d94f 100644
> >> --- a/include/uapi/linux/errqueue.h
> >> +++ b/include/uapi/linux/errqueue.h
> >> @@ -3,6 +3,12 @@
> >>
> >>  #include <linux/types.h>
> >>
> >> +#ifdef __KERNEL__
> >> +#include <linux/time.h>
> >> +#else
> >> +#include <time.h>
> >> +#endif /* __KERNEL__ */
> >
> > This will break applications that include <linux/time.h> manually.
> 
> Also, the patch title reads "include <linux/time.h> in user space",
> but it includes <time.h> in that environment.

Oops, missed while squashing some commits. Will fix. Thanks!

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
       [not found]         ` <20170806205654.GF28459-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
@ 2017-08-06 21:24           ` Willem de Bruijn
       [not found]             ` <CAF=yD-+w2sboybyUZ-6nKQy1s=Oi1S4Z5yZgksM-CzQjDRG+Vw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Willem de Bruijn @ 2017-08-06 21:24 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

>> > +#ifdef __KERNEL__
>> > +#include <linux/time.h>
>> > +#else
>> > +#include <time.h>
>> > +#endif /* __KERNEL__ */
>>
>> This will break applications that include <linux/time.h> manually.
>> I previously sent a patch to use libc-compat to make compilation succeed
>> when both are included in the case where <linux/time.h> is included after
>> <time.h>.
>>
>>   https://lkml.org/lkml/2016/9/12/872
>>
>> The inverse will require changes to the libc header to avoid redefining
>> symbols already defined by <linux/time.h>
>>
>> The second patch in that 2-patch set included <linux/time.h>
>> unconditionally after the fix. This broke builds that also included
>> <time.h> in the wrong order. I did not resubmit the first patch as a
>> stand-alone, as it is not sufficient to avoid breakage.
>
> I wasn't aware of your change, but I was about to send this to fix the
> case when glibc <time.h> is included before <linux/time.h>:
>
> https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66

There are a few differences between the two. Including <time.h> does not
unconditionally define all the symbols. Some are conditional on additional
state, such as __timespec_defined.

> but you also ran into problems where <linux/time.h> is included before
> <time.h> which need fixes in libc header side.
>
> So how to proceed with these?

The libc-compat change is a good fix that can be submitted on its own.

> I don't like leaving a few dozen non-compiling header files into uapi.

I agree, but I do not see a simple solution.

Unless libc has the analogous change, including either <time.h> or
<linux/time.h> in userspace can unfortunately cause breakage.

The added include if __KERNEL__ is defined should be safe, though.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
       [not found]             ` <CAF=yD-+w2sboybyUZ-6nKQy1s=Oi1S4Z5yZgksM-CzQjDRG+Vw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-06 21:33               ` Mikko Rapeli
  2017-08-06 21:42                 ` Willem de Bruijn
  0 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 21:33 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 06, 2017 at 05:24:20PM -0400, Willem de Bruijn wrote:
> >> > +#ifdef __KERNEL__
> >> > +#include <linux/time.h>
> >> > +#else
> >> > +#include <time.h>
> >> > +#endif /* __KERNEL__ */
> >>
> >> This will break applications that include <linux/time.h> manually.
> >> I previously sent a patch to use libc-compat to make compilation succeed
> >> when both are included in the case where <linux/time.h> is included after
> >> <time.h>.
> >>
> >>   https://lkml.org/lkml/2016/9/12/872
> >>
> >> The inverse will require changes to the libc header to avoid redefining
> >> symbols already defined by <linux/time.h>
> >>
> >> The second patch in that 2-patch set included <linux/time.h>
> >> unconditionally after the fix. This broke builds that also included
> >> <time.h> in the wrong order. I did not resubmit the first patch as a
> >> stand-alone, as it is not sufficient to avoid breakage.
> >
> > I wasn't aware of your change, but I was about to send this to fix the
> > case when glibc <time.h> is included before <linux/time.h>:
> >
> > https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66
> 
> There are a few differences between the two. Including <time.h> does not
> unconditionally define all the symbols. Some are conditional on additional
> state, such as __timespec_defined.

Yep, your patch seems better for libc-compat.h. Could you send it again?

> > but you also ran into problems where <linux/time.h> is included before
> > <time.h> which need fixes in libc header side.
> >
> > So how to proceed with these?
> 
> The libc-compat change is a good fix that can be submitted on its own.

Yes, please do so.

> > I don't like leaving a few dozen non-compiling header files into uapi.
> 
> I agree, but I do not see a simple solution.
> 
> Unless libc has the analogous change, including either <time.h> or
> <linux/time.h> in userspace can unfortunately cause breakage.
> 
> The added include if __KERNEL__ is defined should be safe, though.

Yes, for the kernel side, but your libc-compat change would nice for
userspace, where something will break for sure, but providing source
API compatibility is sometimes impossible.

To summarize, this change from me, and your libc-compat.c for time.h, or?

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
  2017-08-06 21:33               ` Mikko Rapeli
@ 2017-08-06 21:42                 ` Willem de Bruijn
       [not found]                   ` <CAF=yD-LN9b9q6sY38eCBM3VyfErQ8sqpQ_7fwkJzMxgjeRFtFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Willem de Bruijn @ 2017-08-06 21:42 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 6, 2017 at 5:33 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> On Sun, Aug 06, 2017 at 05:24:20PM -0400, Willem de Bruijn wrote:
>> >> > +#ifdef __KERNEL__
>> >> > +#include <linux/time.h>
>> >> > +#else
>> >> > +#include <time.h>
>> >> > +#endif /* __KERNEL__ */
>> >>
>> >> This will break applications that include <linux/time.h> manually.
>> >> I previously sent a patch to use libc-compat to make compilation succeed
>> >> when both are included in the case where <linux/time.h> is included after
>> >> <time.h>.
>> >>
>> >>   https://lkml.org/lkml/2016/9/12/872
>> >>
>> >> The inverse will require changes to the libc header to avoid redefining
>> >> symbols already defined by <linux/time.h>
>> >>
>> >> The second patch in that 2-patch set included <linux/time.h>
>> >> unconditionally after the fix. This broke builds that also included
>> >> <time.h> in the wrong order. I did not resubmit the first patch as a
>> >> stand-alone, as it is not sufficient to avoid breakage.
>> >
>> > I wasn't aware of your change, but I was about to send this to fix the
>> > case when glibc <time.h> is included before <linux/time.h>:
>> >
>> > https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66
>>
>> There are a few differences between the two. Including <time.h> does not
>> unconditionally define all the symbols. Some are conditional on additional
>> state, such as __timespec_defined.
>
> Yep, your patch seems better for libc-compat.h. Could you send it again?

Okay. Or feel free to include it in the patchset if that helps resolve
dependencies.

>> > I don't like leaving a few dozen non-compiling header files into uapi.
>>
>> I agree, but I do not see a simple solution.
>>
>> Unless libc has the analogous change, including either <time.h> or
>> <linux/time.h> in userspace can unfortunately cause breakage.
>>
>> The added include if __KERNEL__ is defined should be safe, though.
>
> Yes, for the kernel side, but your libc-compat change would nice for
> userspace, where something will break for sure, but providing source
> API compatibility is sometimes impossible.
>
> To summarize, this change from me, and your libc-compat.c for time.h, or?

I'm still afraid that this patch as is will break builds that include
<linux/time.h> first.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
       [not found]                   ` <CAF=yD-LN9b9q6sY38eCBM3VyfErQ8sqpQ_7fwkJzMxgjeRFtFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-06 21:52                     ` Mikko Rapeli
       [not found]                       ` <20170806215244.GB31101-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-06 21:52 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 06, 2017 at 05:42:13PM -0400, Willem de Bruijn wrote:
> On Sun, Aug 6, 2017 at 5:33 PM, Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org> wrote:
> > On Sun, Aug 06, 2017 at 05:24:20PM -0400, Willem de Bruijn wrote:
> >> >> > +#ifdef __KERNEL__
> >> >> > +#include <linux/time.h>
> >> >> > +#else
> >> >> > +#include <time.h>
> >> >> > +#endif /* __KERNEL__ */
> >> >>
> >> >> This will break applications that include <linux/time.h> manually.
> >> >> I previously sent a patch to use libc-compat to make compilation succeed
> >> >> when both are included in the case where <linux/time.h> is included after
> >> >> <time.h>.
> >> >>
> >> >>   https://lkml.org/lkml/2016/9/12/872
> >> >>
> >> >> The inverse will require changes to the libc header to avoid redefining
> >> >> symbols already defined by <linux/time.h>
> >> >>
> >> >> The second patch in that 2-patch set included <linux/time.h>
> >> >> unconditionally after the fix. This broke builds that also included
> >> >> <time.h> in the wrong order. I did not resubmit the first patch as a
> >> >> stand-alone, as it is not sufficient to avoid breakage.
> >> >
> >> > I wasn't aware of your change, but I was about to send this to fix the
> >> > case when glibc <time.h> is included before <linux/time.h>:
> >> >
> >> > https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66
> >>
> >> There are a few differences between the two. Including <time.h> does not
> >> unconditionally define all the symbols. Some are conditional on additional
> >> state, such as __timespec_defined.
> >
> > Yep, your patch seems better for libc-compat.h. Could you send it again?
> 
> Okay. Or feel free to include it in the patchset if that helps resolve
> dependencies.

If you don't have the time, I will send tomorrow a new version of this
patch which fixes the commit topic and before that your libc-compat.h change
so both could be applied together.

Feel free to be faster :)

> >> > I don't like leaving a few dozen non-compiling header files into uapi.
> >>
> >> I agree, but I do not see a simple solution.
> >>
> >> Unless libc has the analogous change, including either <time.h> or
> >> <linux/time.h> in userspace can unfortunately cause breakage.
> >>
> >> The added include if __KERNEL__ is defined should be safe, though.
> >
> > Yes, for the kernel side, but your libc-compat change would nice for
> > userspace, where something will break for sure, but providing source
> > API compatibility is sometimes impossible.
> >
> > To summarize, this change from me, and your libc-compat.c for time.h, or?
> 
> I'm still afraid that this patch as is will break builds that include
> <linux/time.h> first.

I agree, but I also want uapi headers to cleanly compile. I know this might
break stuff on userspace side which rely on these broken header file
dependencies, but if the fix to just re-order include
statements I'm fine with it, also when the complaints hit my inbox.

If I had the CPU time, memory and disk space, I'd do a full yocto distro
build to see how badly userspace could break but I don't at home.

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
       [not found]                       ` <20170806215244.GB31101-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
@ 2017-08-06 22:03                         ` Willem de Bruijn
  0 siblings, 0 replies; 90+ messages in thread
From: Willem de Bruijn @ 2017-08-06 22:03 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: LKML, Linux API, Willem de Bruijn, Soheil Hassas Yeganeh,
	Network Development

On Sun, Aug 6, 2017 at 5:52 PM, Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org> wrote:
> On Sun, Aug 06, 2017 at 05:42:13PM -0400, Willem de Bruijn wrote:
>> On Sun, Aug 6, 2017 at 5:33 PM, Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org> wrote:
>> > On Sun, Aug 06, 2017 at 05:24:20PM -0400, Willem de Bruijn wrote:
>> >> >> > +#ifdef __KERNEL__
>> >> >> > +#include <linux/time.h>
>> >> >> > +#else
>> >> >> > +#include <time.h>
>> >> >> > +#endif /* __KERNEL__ */
>> >> >>
>> >> >> This will break applications that include <linux/time.h> manually.
>> >> >> I previously sent a patch to use libc-compat to make compilation succeed
>> >> >> when both are included in the case where <linux/time.h> is included after
>> >> >> <time.h>.
>> >> >>
>> >> >>   https://lkml.org/lkml/2016/9/12/872
>> >> >>
>> >> >> The inverse will require changes to the libc header to avoid redefining
>> >> >> symbols already defined by <linux/time.h>
>> >> >>
>> >> >> The second patch in that 2-patch set included <linux/time.h>
>> >> >> unconditionally after the fix. This broke builds that also included
>> >> >> <time.h> in the wrong order. I did not resubmit the first patch as a
>> >> >> stand-alone, as it is not sufficient to avoid breakage.
>> >> >
>> >> > I wasn't aware of your change, but I was about to send this to fix the
>> >> > case when glibc <time.h> is included before <linux/time.h>:
>> >> >
>> >> > https://github.com/mcfrisk/linux/commit/f3952a27b8a21c6478d26e6246055383483f6a66
>> >>
>> >> There are a few differences between the two. Including <time.h> does not
>> >> unconditionally define all the symbols. Some are conditional on additional
>> >> state, such as __timespec_defined.
>> >
>> > Yep, your patch seems better for libc-compat.h. Could you send it again?
>>
>> Okay. Or feel free to include it in the patchset if that helps resolve
>> dependencies.
>
> If you don't have the time, I will send tomorrow a new version of this
> patch which fixes the commit topic and before that your libc-compat.h change
> so both could be applied together.

Please do. Thanks!

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 and __u64 from linux/types.h
  2017-08-06 20:42       ` Mikko Rapeli
@ 2017-08-06 22:09         ` James Bottomley
       [not found]           ` <1502057361.2673.21.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: James Bottomley @ 2017-08-06 22:09 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: linux-kernel, linux-api, linux-scsi

On Sun, 2017-08-06 at 23:42 +0300, Mikko Rapeli wrote:
> Hi,
> 
> On Sun, Aug 06, 2017 at 11:22:53AM -0700, James Bottomley wrote:
> > 
> > On Sun, 2017-08-06 at 18:43 +0200, Mikko Rapeli wrote:
> > > 
> > > Fixes userspace compilation errors like:
> > > 
> > > scsi/scsi_netlink_fc.h:60:2: error: expected specifier-qualifier-
> > > list  before ‘uint64_t’
> > 
> > Rather than patching the kernel, why not #include <stdint.h> in
> > your userspace programme?
> 
> The userspace program is actually a test which checks that uapi
> headers compile alone because several headers are not compiling at
> all and/or require special tricks. The test is available here:
> 
> http://marc.info/?l=linux-kernel&m=150203944104544&w=2

But you don't seem to be detecting or fixing an existing problem.
 These types are width unambiguous and all current consumers of these
headers include stdint.h so you're churning the kernel for a problem
which doesn't currently exist for any consumer of this header.

I can agree not adding any more external uint<x>_t types for newly
exported headers so new consumers don't depend on an external standard
is reasonable, so checkpatch should warn if someone tries to add them;
I just don't see the benefit of going over the whole kernel changing
stuff that has worked fine for years.  Now if you can tell me there's
an actual bug somewhere, that's different ...

James

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 and __u64 from linux/types.h
       [not found]           ` <1502057361.2673.21.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
@ 2017-08-07  6:08             ` Mikko Rapeli
  0 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-07  6:08 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA

On Sun, Aug 06, 2017 at 03:09:21PM -0700, James Bottomley wrote:
> On Sun, 2017-08-06 at 23:42 +0300, Mikko Rapeli wrote:
> > Hi,
> > 
> > On Sun, Aug 06, 2017 at 11:22:53AM -0700, James Bottomley wrote:
> > > 
> > > On Sun, 2017-08-06 at 18:43 +0200, Mikko Rapeli wrote:
> > > > 
> > > > Fixes userspace compilation errors like:
> > > > 
> > > > scsi/scsi_netlink_fc.h:60:2: error: expected specifier-qualifier-
> > > > list  before ‘uint64_t’
> > > 
> > > Rather than patching the kernel, why not #include <stdint.h> in
> > > your userspace programme?
> > 
> > The userspace program is actually a test which checks that uapi
> > headers compile alone because several headers are not compiling at
> > all and/or require special tricks. The test is available here:
> > 
> > http://marc.info/?l=linux-kernel&m=150203944104544&w=2
> 
> But you don't seem to be detecting or fixing an existing problem.
>  These types are width unambiguous and all current consumers of these
> headers include stdint.h so you're churning the kernel for a problem
> which doesn't currently exist for any consumer of this header.

The header file dependencies of scsi/scsi_netlink_fc.h are not explicit.
I will propose a patch which includes <stdint.h> in userspace then.

> I can agree not adding any more external uint<x>_t types for newly
> exported headers so new consumers don't depend on an external standard
> is reasonable, so checkpatch should warn if someone tries to add them;
> I just don't see the benefit of going over the whole kernel changing
> stuff that has worked fine for years.  Now if you can tell me there's
> an actual bug somewhere, that's different ...

Tools parsing and checking uapi headers need to be able to compile them
and thus need the explicit list of dependencies. If <stdint.h> is a
required dependency, then scsi/scsi_netlink_fc.h should include it.

scsi/scsi_netlink_fc.h is one of 42 problematic headers left in current
kernel and I want to fix it one way or the other.

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 32/36] uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and uint64_t
       [not found]   ` <20170806164428.2273-33-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-07  9:47     ` Daniel Vetter
  0 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2017-08-07  9:47 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Emil Velikov, Russell King,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Russell King

On Sun, Aug 06, 2017 at 06:44:23PM +0200, Mikko Rapeli wrote:
> These are defined in linux/types.h or drm/drm.h. Fixes
> user space compilation errors like:
> 
> drm/armada_drm.h:26:2: error: unknown type name ‘uint32_t’
>   uint32_t handle;
>   ^~~~~~~~
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: Emil Velikov <emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Gabriel Laskar <gabriel-tU7rkvAWjlwhT4uAktR2oQ@public.gmane.org>
> Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> Cc: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Applied to drm-misc, thanks.
-Daniel

> ---
>  include/uapi/drm/armada_drm.h | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/include/uapi/drm/armada_drm.h b/include/uapi/drm/armada_drm.h
> index 72e326f9c7de..0cb932416cfe 100644
> --- a/include/uapi/drm/armada_drm.h
> +++ b/include/uapi/drm/armada_drm.h
> @@ -23,27 +23,27 @@ extern "C" {
>  	DRM_##dir(DRM_COMMAND_BASE + DRM_ARMADA_##name, struct drm_armada_##str)
>  
>  struct drm_armada_gem_create {
> -	uint32_t handle;
> -	uint32_t size;
> +	__u32 handle;
> +	__u32 size;
>  };
>  #define DRM_IOCTL_ARMADA_GEM_CREATE \
>  	ARMADA_IOCTL(IOWR, GEM_CREATE, gem_create)
>  
>  struct drm_armada_gem_mmap {
> -	uint32_t handle;
> -	uint32_t pad;
> -	uint64_t offset;
> -	uint64_t size;
> -	uint64_t addr;
> +	__u32 handle;
> +	__u32 pad;
> +	__u64 offset;
> +	__u64 size;
> +	__u64 addr;
>  };
>  #define DRM_IOCTL_ARMADA_GEM_MMAP \
>  	ARMADA_IOCTL(IOWR, GEM_MMAP, gem_mmap)
>  
>  struct drm_armada_gem_pwrite {
> -	uint64_t ptr;
> -	uint32_t handle;
> -	uint32_t offset;
> -	uint32_t size;
> +	__u64 ptr;
> +	__u32 handle;
> +	__u32 offset;
> +	__u32 size;
>  };
>  #define DRM_IOCTL_ARMADA_GEM_PWRITE \
>  	ARMADA_IOCTL(IOW, GEM_PWRITE, gem_pwrite)
> -- 
> 2.13.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t
  2017-08-06 16:44 ` [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-07 14:30   ` Arnd Bergmann
  2017-08-08 22:50   ` Dmitry V. Levin
  1 sibling, 0 replies; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-07 14:30 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: Linux Kernel Mailing List, Linux API, Al Viro, H . Peter Anvin,
	Thomas Gleixner, Ingo Molnar, the arch/x86 maintainers

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

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t
  2017-08-06 16:44 ` [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-07 15:00   ` Arnd Bergmann
  2017-08-08 23:11   ` Dmitry V. Levin
  1 sibling, 0 replies; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-07 15:00 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: Linux Kernel Mailing List, Linux API, linux-omap, Tomi Valkeinen,
	Aaro Koskinen

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: linux-omap@vger.kernel.org
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t
       [not found]     ` <20170806164428.2273-37-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-07 15:01       ` Arnd Bergmann
  2017-09-02 12:30         ` Oded Gabbay
  0 siblings, 1 reply; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-07 15:01 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: Linux Kernel Mailing List, Linux API, Yair Shachar, Oded Gabbay,
	Andrew Lewycky, dri-devel

On Sun, Aug 6, 2017 at 6:44 PM, Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org> wrote:
> Include <drm/drm.h> instead of <linux/types.h> which on Linux includes
> <linux/types.h> and on non-Linux platforms defines __u32 etc types.
>
> Fixes user space compilation errors like:
>
> linux/kfd_ioctl.h:33:2: error: unknown type name ‘uint32_t’
>   uint32_t major_version; /* from KFD */
>   ^~~~~~~~
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: Yair Shachar <yair.shachar-5C7GfCeVMHo@public.gmane.org>
> Cc: Oded Gabbay <oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Andrew Lewycky <Andrew.Lewycky-5C7GfCeVMHo@public.gmane.org>

Looks good to me,

Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 23/36] uapi linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace
       [not found]   ` <20170806164428.2273-24-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-07 15:06     ` Arnd Bergmann
  0 siblings, 0 replies; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-07 15:06 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: Linux Kernel Mailing List, Linux API, Jan Harkes,
	codalist-/uMB558Y47wP4a1z8dhFYw, coda-ETDLCGt7PQU3uPMLIKxrzw

On Sun, Aug 6, 2017 at 6:44 PM, Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org> wrote:
> Fixes userspace compilation errors about unknown pid_t, u_short etc types.
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: Jan Harkes <jaharkes-ETDLCGt7PQU3uPMLIKxrzw@public.gmane.org>
> Cc: codalist-/uMB558Y47wP4a1z8dhFYw@public.gmane.org
> ---
>  include/uapi/linux/coda.h | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/coda.h b/include/uapi/linux/coda.h
> index 695fade33c64..2985ca00d63b 100644
> --- a/include/uapi/linux/coda.h
> +++ b/include/uapi/linux/coda.h
> @@ -100,7 +100,14 @@ typedef unsigned long long u_quad_t;
>  #if defined(__linux__)
>  #include <linux/time.h>
>  #define cdev_t u_quad_t
> +
>  #ifndef __KERNEL__
> +typedef unsigned long u_long;
> +typedef unsigned int u_int;
> +typedef unsigned short u_short;
> +typedef u_long ino_t;
> +typedef u_long dev_t;
> +typedef void *caddr_t;

This looks suspicious: obviously anyone who is including this
header today has to define those types somewhere. If you add
another definition, that will clash with the existing one.

Have you tried replacing the custom types with the regular
kernel types instead?

I would not worry about breaking other operating systems here,
in fact it may be better to remove the #ifdef for those altogether.

>  #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
>  #define _UQUAD_T_ 1
>  typedef unsigned long long u_quad_t;
> @@ -295,8 +302,8 @@ struct coda_statfs {
>  struct coda_in_hdr {
>      u_int32_t opcode;
>      u_int32_t unique;      /* Keep multiple outstanding msgs distinct */
> -    pid_t pid;
> -    pid_t pgid;
> +    __kernel_pid_t pid;
> +    __kernel_pid_t pgid;
>      vuid_t uid;
>  };

This looks like an actual bugfix: pid_t might differ between libc and
the kernel, so the kernel interface has to use types that the kernel
defines. This is probably ok on any supported version of glibc,
so it's unlikely to have caused runtime problems, but it should be
fixed nonetheless.

       Arnd

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 21/36] uapi linux/kexec.h: use __kernel_size_t instead of size_t
       [not found]     ` <20170806164428.2273-22-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-07 15:12       ` Arnd Bergmann
  0 siblings, 0 replies; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-07 15:12 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: Linux Kernel Mailing List, Linux API,
	kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Eric Biederman

On Sun, Aug 6, 2017 at 6:44 PM, Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org> wrote:
> Fixes userspace compilation error:
>
> error: unknown type name ‘size_t’
>   size_t bufsz;
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> Cc: Eric Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>

Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t
       [not found]   ` <20170806164428.2273-34-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-07 15:54     ` Darrick J. Wong
  2017-08-07 16:01       ` Arnd Bergmann
  0 siblings, 1 reply; 90+ messages in thread
From: Darrick J. Wong @ 2017-08-07 15:54 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Theodore Ts'o

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-X3B1VOXEql0@public.gmane.org>
> Cc: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t
  2017-08-07 15:54     ` Darrick J. Wong
@ 2017-08-07 16:01       ` Arnd Bergmann
       [not found]         ` <CAK8P3a3sVWu9wiqct4h9njZC53qUOrLbM_wXL7XXZ8hfiuK7Lg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-07 16:01 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Theodore Ts'o

On Mon, Aug 7, 2017 at 5:54 PM, Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 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-X3B1VOXEql0@public.gmane.org>
>> Cc: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> ---
>>  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

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t
       [not found]         ` <CAK8P3a3sVWu9wiqct4h9njZC53qUOrLbM_wXL7XXZ8hfiuK7Lg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-07 16:45           ` Darrick J. Wong
  2017-08-07 20:20             ` Arnd Bergmann
  0 siblings, 1 reply; 90+ messages in thread
From: Darrick J. Wong @ 2017-08-07 16:45 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Theodore Ts'o

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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 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-X3B1VOXEql0@public.gmane.org>
> >> Cc: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> >> ---
> >>  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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t
  2017-08-07 16:45           ` Darrick J. Wong
@ 2017-08-07 20:20             ` Arnd Bergmann
  2017-08-08 23:08               ` Darrick J. Wong
  0 siblings, 1 reply; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-07 20:20 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Theodore Ts'o

On Mon, Aug 7, 2017 at 6:45 PM, Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 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

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t
       [not found]     ` <20170806164428.2273-6-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-08 22:34       ` Dmitry V. Levin
  2017-08-09  7:18         ` Mikko Rapeli
  0 siblings, 1 reply; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 22:34 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	David S . Miller, Matthew Whitehead, Joel Scherpelz,
	Lorenzo Colitti

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

On Sun, Aug 06, 2017 at 06:43:56PM +0200, Mikko Rapeli wrote:
> Fixes userspace compilation error:
> 
> error: unknown type name ‘size_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> ---
>  include/uapi/linux/sysctl.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
> index e13d48058b8d..35a4b8b417fe 100644
> --- a/include/uapi/linux/sysctl.h
> +++ b/include/uapi/linux/sysctl.h
> @@ -35,9 +35,9 @@ struct __sysctl_args {
>  	int __user *name;
>  	int nlen;
>  	void __user *oldval;
> -	size_t __user *oldlenp;
> +	__kernel_size_t __user *oldlenp;
>  	void __user *newval;
> -	size_t newlen;
> +	__kernel_size_t newlen;
>  	unsigned long __unused[4];
>  };

You should be extremely careful when replacing size_t with __kernel_size_t
because e.g. on x32 you have sizeof(size_t) < sizeof(__kernel_size_t).

In case of sysctl.h this replacement would be wrong.

I submitted an alternative fix for this bug some time ago, see
http://lkml.kernel.org/r/20170222230652.GA14373-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes
  2017-08-06 16:43 ` [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes Mikko Rapeli
@ 2017-08-08 22:42   ` Dmitry V. Levin
  0 siblings, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 22:42 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel, linux-api, H . J . Lu, H . Peter Anvin,
	Arnd Bergmann, linux-arch

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

On Sun, Aug 06, 2017 at 06:43:59PM +0200, Mikko Rapeli wrote:
> Include linux/types.h and asm/msgbuf.h and use __kernel_size_t instead
> of size_t.
> 
> Fixes userspace compilation errors like:
> 
> error: field ‘shm_perm’ has incomplete type
> struct ipc64_perm shm_perm; /* operation perms */
> error: unknown type name ‘size_t’
> error: unknown type name ‘__kernel_time_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Cc: H.J. Lu <hjl.tools@gmail.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> ---
>  include/uapi/asm-generic/shmbuf.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
> index 7e9fb2f0853b..ae867ad1e5e4 100644
> --- a/include/uapi/asm-generic/shmbuf.h
> +++ b/include/uapi/asm-generic/shmbuf.h
> @@ -1,7 +1,9 @@
>  #ifndef __ASM_GENERIC_SHMBUF_H
>  #define __ASM_GENERIC_SHMBUF_H
>  
> +#include <linux/types.h>
>  #include <asm/bitsperlong.h>
> +#include <asm/msgbuf.h>
>  
>  /*
>   * The shmid64_ds structure for x86 architecture.
> @@ -24,7 +26,7 @@
>  
>  struct shmid64_ds {
>  	struct ipc64_perm	shm_perm;	/* operation perms */
> -	size_t			shm_segsz;	/* size of segment (bytes) */
> +	__kernel_size_t		shm_segsz;	/* size of segment (bytes) */
>  	__kernel_time_t		shm_atime;	/* last attach time */
>  #if __BITS_PER_LONG != 64
>  	unsigned long		__unused1;

Surprisingly enough, this replacement of size_t with __kernel_size_t
is not just correct, it's a fix for a more subtle bug on x32, see
http://lkml.kernel.org/r/20170302004607.GE27132@altlinux.org

I recommend splitting the change into "include" fix and "size_t" fix
like I did some time ago, see
http://lkml.kernel.org/r/20170302002253.GC27132@altlinux.org


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h
  2017-08-06 16:44 ` [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
@ 2017-08-08 22:45   ` Dmitry V. Levin
  0 siblings, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 22:45 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel, linux-api, H . J . Lu, H . Peter Anvin,
	Arnd Bergmann, linux-arch

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

On Sun, Aug 06, 2017 at 06:44:00PM +0200, Mikko Rapeli wrote:
> Fixes userspace compilation errors like:
> 
> error: field ‘msg_perm’ has incomplete type
> struct ipc64_perm msg_perm;
> error: unknown type name ‘__kernel_ulong_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Cc: H.J. Lu <hjl.tools@gmail.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> ---
>  include/uapi/asm-generic/sembuf.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/uapi/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h
> index 4cb2c13e5090..17d523f86923 100644
> --- a/include/uapi/asm-generic/sembuf.h
> +++ b/include/uapi/asm-generic/sembuf.h
> @@ -2,6 +2,8 @@
>  #define __ASM_GENERIC_SEMBUF_H
>  
>  #include <asm/bitsperlong.h>
> +#include <asm/posix_types.h>
> +#include <asm/ipcbuf.h>

I don't think you need to include <asm/posix_types.h> here,
<asm/ipcbuf.h> is necessary and enough, see
http://lkml.kernel.org/r/20170302002228.GB27132@altlinux.org


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t
  2017-08-06 16:44 ` [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
  2017-08-07 14:30   ` Arnd Bergmann
@ 2017-08-08 22:50   ` Dmitry V. Levin
  1 sibling, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 22:50 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel, linux-api, Al Viro, Arnd Bergmann, H . Peter Anvin,
	Thomas Gleixner, Ingo Molnar, x86

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h
       [not found]   ` <20170806164428.2273-14-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-08 22:54     ` Dmitry V. Levin
  0 siblings, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 22:54 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Al Viro, Arnd Bergmann,
	H . Peter Anvin, Thomas Gleixner, Ingo Molnar,
	x86-DgEjT+Ai2ygdnm+yROfE0A

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

On Sun, Aug 06, 2017 at 06:44:04PM +0200, Mikko Rapeli wrote:
> Fixes userspace compile errors like:
> 
> error: field ‘sem_perm’ has incomplete type
>   struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
> error: unknown type name ‘__kernel_time_t’
>   __kernel_time_t sem_otime; /* last semop time */
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
> Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> Cc: H. Peter Anvin <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
> ---
>  arch/x86/include/uapi/asm/sembuf.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h
> index cc2d6a3aeae7..f11ed5282eec 100644
> --- a/arch/x86/include/uapi/asm/sembuf.h
> +++ b/arch/x86/include/uapi/asm/sembuf.h
> @@ -1,6 +1,9 @@
>  #ifndef _ASM_X86_SEMBUF_H
>  #define _ASM_X86_SEMBUF_H
>  
> +#include <linux/types.h>
> +#include <linux/ipc.h>

I'd recommend to include <asm/ipcbuf.h> instead like I did some time ago,
see http://lkml.kernel.org/r/20170302002228.GB27132-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace
  2017-08-06 16:44 ` [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace Mikko Rapeli
@ 2017-08-08 22:57   ` Dmitry V. Levin
       [not found]     ` <20170808225739.GF10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 22:57 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel, linux-api, Arnd Bergmann, Russell King, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space
       [not found]   ` <20170806164428.2273-16-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-08 23:00     ` Dmitry V. Levin
       [not found]       ` <20170808230041.GG10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 23:00 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

On Sun, Aug 06, 2017 at 06:44:06PM +0200, Mikko Rapeli wrote:
> This libc header has sockaddr definition in user space.
> 
> Fixes user space compilation errors like these from kernel headers including
> only linux/socket.h:
> 
> error: field ‘ifru_addr’ has incomplete type
> struct sockaddr ifru_addr;
> error: field ‘_sockaddr’ has incomplete type
> struct sockaddr  _sockaddr;
> error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’
> 
> With this following uapi headers now compile in user space:
> 
> rdma/rdma_user_rxe.h
> linux/vm_sockets.h
> linux/ncp_fs.h
> linux/nfc.h
> linux/phonet.h
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Dmitry V. Levin <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
> ---
>  include/uapi/linux/socket.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
> index 76ab0c68561e..8a81197cc08b 100644
> --- a/include/uapi/linux/socket.h
> +++ b/include/uapi/linux/socket.h
> @@ -1,6 +1,10 @@
>  #ifndef _UAPI_LINUX_SOCKET_H
>  #define _UAPI_LINUX_SOCKET_H
>  
> +#ifndef __KERNEL__
> +#include <sys/socket.h>
> +#endif

This is scary because of infamous libc vs uapi interoperability issues.
Couldn't we fix affected headers instead?


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t
  2017-08-07 20:20             ` Arnd Bergmann
@ 2017-08-08 23:08               ` Darrick J. Wong
  2017-08-09  8:24                 ` Arnd Bergmann
  0 siblings, 1 reply; 90+ messages in thread
From: Darrick J. Wong @ 2017-08-08 23:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Theodore Ts'o

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

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t
  2017-08-06 16:44 ` [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
  2017-08-07 15:00   ` Arnd Bergmann
@ 2017-08-08 23:11   ` Dmitry V. Levin
  1 sibling, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 23:11 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel, linux-api, linux-omap, Tomi Valkeinen, Aaro Koskinen

[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]

On Sun, Aug 06, 2017 at 06:44:10PM +0200, Mikko Rapeli wrote:
> Fixes userspace compilation error:
> 
> error: unknown type name ‘size_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: linux-omap@vger.kernel.org
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> ---
>  include/uapi/linux/omapfb.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/omapfb.h b/include/uapi/linux/omapfb.h
> index 7c97bc00ac6d..b637a924618f 100644
> --- a/include/uapi/linux/omapfb.h
> +++ b/include/uapi/linux/omapfb.h
> @@ -181,7 +181,7 @@ struct omapfb_memory_read {
>  	__u16 y;
>  	__u16 w;
>  	__u16 h;
> -	size_t buffer_size;
> +	__kernel_size_t buffer_size;
>  	void __user *buffer;
>  };

You generally cannot replace size_t with __kernel_size_t in a header that
affects x32, but this case is really bad one: the kernel treats
struct omapfb_memory_read.buffer_size as __kernel_size_t, while
x32 userspace treats it as size_t.  As result, the offset of
struct omapfb_memory_read.buffer on x32 is different between the kernel
and userspace.

In other words, the whole thing seems to be totally broken on x32 already
and it's not important whether you use __kernel_size_t or
__kernel_uapi_size_t as a type of struct omapfb_memory_read.buffer_size.

This deserves a word in the commit message, though.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h
       [not found]     ` <20170806164428.2273-31-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-08 23:13       ` Jason Gunthorpe
       [not found]         ` <20170808231306.GH29372-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Jason Gunthorpe @ 2017-08-08 23:13 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Moni Shoua, Doug Ledford

On Sun, Aug 06, 2017 at 06:44:21PM +0200, Mikko Rapeli wrote:
> Fixes these userspace compilation errors when rdma_user_rxe.h is compiled
> alone:
> 
> rdma/rdma_user_rxe.h:59:20: error: field ???_sockaddr??? has incomplete type
>    struct sockaddr  _sockaddr;
>                     ^~~~~~~~~
> rdma/rdma_user_rxe.h:60:22: error: field ???_sockaddr_in??? has incomplete type
>    struct sockaddr_in _sockaddr_in;
>                       ^~~~~~~~~~~~
> rdma/rdma_user_rxe.h:61:23: error: field ???_sockaddr_in6??? has incomplete type
>    struct sockaddr_in6 _sockaddr_in6;
>                        ^~~~~~~~~~~~~

I'm not sure this is a good idea, linux/in.h should not be included in
userspace users of this file, 'sockaddr_in' needs to come from glibc's
'netinet/in.h' instead..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 21/36] uapi linux/kexec.h: use __kernel_size_t instead of size_t
  2017-08-06 16:44   ` [PATCH v06 21/36] uapi linux/kexec.h: " Mikko Rapeli
       [not found]     ` <20170806164428.2273-22-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-08 23:15     ` Dmitry V. Levin
  1 sibling, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 23:15 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: linux-kernel, linux-api, kexec, Eric Biederman

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

On Sun, Aug 06, 2017 at 06:44:12PM +0200, Mikko Rapeli wrote:
> Fixes userspace compilation error:
> 
> error: unknown type name ‘size_t’
>   size_t bufsz;
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: kexec@lists.infradead.org
> Cc: Eric Biederman <ebiederm@xmission.com>
> ---
>  include/uapi/linux/kexec.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h
> index aae5ebf2022b..f964d83b2757 100644
> --- a/include/uapi/linux/kexec.h
> +++ b/include/uapi/linux/kexec.h
> @@ -51,9 +51,9 @@
>   */
>  struct kexec_segment {
>  	const void *buf;
> -	size_t bufsz;
> +	__kernel_size_t bufsz;
>  	const void *mem;
> -	size_t memsz;
> +	__kernel_size_t memsz;

No, this is definitely wrong as it breaks x32.
I submitted an alternative fix some time ago, see
http://lkml.kernel.org/r/20170222224646.GC14311@altlinux.org


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t
  2017-08-06 16:44 ` [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t Mikko Rapeli
@ 2017-08-08 23:17   ` Dmitry V. Levin
  0 siblings, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 23:17 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: linux-kernel, linux-api, reiserfs-devel

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space
  2017-08-06 16:44 ` [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space Mikko Rapeli
@ 2017-08-08 23:25   ` Dmitry V. Levin
  2017-09-04 16:15     ` Dmitry V. Levin
  0 siblings, 1 reply; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-08 23:25 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel, linux-api, Dave Watson, Ilya Lesokhin,
	Aviad Yehezkel, netdev

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

On Sun, Aug 06, 2017 at 06:44:26PM +0200, Mikko Rapeli wrote:
> It is not needed and not part of uapi headers, but causes
> user space compilation error:
> 
> fatal error: net/tcp.h: No such file or directory
>  #include <net/tcp.h>
>                      ^
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Dave Watson <davejwatson@fb.com>
> Cc: Ilya Lesokhin <ilyal@mellanox.com>
> Cc: Aviad Yehezkel <aviadye@mellanox.com>
> ---
>  include/uapi/linux/tls.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
> index cc1d21db35d8..d87c698623f2 100644
> --- a/include/uapi/linux/tls.h
> +++ b/include/uapi/linux/tls.h
> @@ -37,7 +37,9 @@
>  #include <asm/byteorder.h>
>  #include <linux/socket.h>
>  #include <linux/tcp.h>
> +#ifdef __KERNEL__
>  #include <net/tcp.h>
> +#endif

Let's move it to include/net/tls.h instead.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t
  2017-08-08 22:34       ` Dmitry V. Levin
@ 2017-08-09  7:18         ` Mikko Rapeli
  0 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-08-09  7:18 UTC (permalink / raw)
  To: Dmitry V. Levin, linux-kernel, linux-api, Al Viro, Arnd Bergmann,
	H . Peter Anvin, Thomas Gleixner, Ingo Molnar, x86,
	reiserfs-devel
  Cc: David S . Miller, Matthew Whitehead, Joel Scherpelz,
	Lorenzo Colitti, H . J . Lu, linux-arch, Russell King,
	linux-arm-kernel, kexec, Eric Biederman

Hi Dmitry and thanks for the comments.

I have only one question: why haven't your patches been applied yet?

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t
  2017-08-08 23:08               ` Darrick J. Wong
@ 2017-08-09  8:24                 ` Arnd Bergmann
  0 siblings, 0 replies; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-09  8:24 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Theodore Ts'o

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

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space
       [not found]       ` <20170808230041.GG10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
@ 2017-08-09 12:32         ` Arnd Bergmann
  0 siblings, 0 replies; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-09 12:32 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Networking

On Wed, Aug 9, 2017 at 1:00 AM, Dmitry V. Levin <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
> On Sun, Aug 06, 2017 at 06:44:06PM +0200, Mikko Rapeli wrote:
>> This libc header has sockaddr definition in user space.
>>
>> Fixes user space compilation errors like these from kernel headers including
>> only linux/socket.h:
>>
>> error: field ‘ifru_addr’ has incomplete type
>> struct sockaddr ifru_addr;
>> error: field ‘_sockaddr’ has incomplete type
>> struct sockaddr  _sockaddr;
>> error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’
>>
>> With this following uapi headers now compile in user space:
>>
>> rdma/rdma_user_rxe.h
>> linux/vm_sockets.h
>> linux/ncp_fs.h
>> linux/nfc.h
>> linux/phonet.h
>>

>>
>> +#ifndef __KERNEL__
>> +#include <sys/socket.h>
>> +#endif
>
> This is scary because of infamous libc vs uapi interoperability issues.
> Couldn't we fix affected headers instead?

Yes, I think that would be better. Maybe we can introduce a
'struct __kernel_sockaddr' in include/uapi/linux/socket.h to
go along with __kernel_sa_family_t and __kernel_sockaddr_storage,
and then use those types in the other kernel headers?

       Arnd

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace
       [not found]     ` <20170808225739.GF10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
@ 2017-08-09 12:41       ` Arnd Bergmann
       [not found]         ` <CAK8P3a30Vd2JquMvZ88tTO4jFAUMJGtUpvLuDmDPp2UFBYXDLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Arnd Bergmann @ 2017-08-09 12:41 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Russell King,
	Linux ARM

On Wed, Aug 9, 2017 at 12:57 AM, Dmitry V. Levin <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
> On Sun, Aug 06, 2017 at 06:44:05PM +0200, Mikko Rapeli wrote:
>> Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> 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-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.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

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace
       [not found]         ` <CAK8P3a30Vd2JquMvZ88tTO4jFAUMJGtUpvLuDmDPp2UFBYXDLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-09 12:52           ` Dmitry V. Levin
  0 siblings, 0 replies; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-09 12:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mikko Rapeli, Linux Kernel Mailing List, Linux API, Russell King,
	Linux ARM

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

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-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
> > On Sun, Aug 06, 2017 at 06:44:05PM +0200, Mikko Rapeli wrote:
> >> Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> 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-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h
       [not found]         ` <20170808231306.GH29372-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-08-09 13:48           ` Moni Shoua
  2017-08-09 15:52             ` Jason Gunthorpe
  0 siblings, 1 reply; 90+ messages in thread
From: Moni Shoua @ 2017-08-09 13:48 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Mikko Rapeli, Linux Kernel Mailinglist,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Sean Hefty, Hal Rosenstock,
	linux-rdma, Doug Ledford

>
> I'm not sure this is a good idea, linux/in.h should not be included in
> userspace users of this file, 'sockaddr_in' needs to come from glibc's
> 'netinet/in.h' instead..
>
> Jason
Is it wrong to include include/uapi/linux/in.h from userspace?

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h
  2017-08-09 13:48           ` Moni Shoua
@ 2017-08-09 15:52             ` Jason Gunthorpe
       [not found]               ` <20170809155241.GB15586-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Jason Gunthorpe @ 2017-08-09 15:52 UTC (permalink / raw)
  To: Moni Shoua
  Cc: Mikko Rapeli, Linux Kernel Mailinglist, linux-api, Sean Hefty,
	Hal Rosenstock, linux-rdma, Doug Ledford

On Wed, Aug 09, 2017 at 04:48:08PM +0300, Moni Shoua wrote:
> >
> > I'm not sure this is a good idea, linux/in.h should not be included in
> > userspace users of this file, 'sockaddr_in' needs to come from glibc's
> > 'netinet/in.h' instead..

> Is it wrong to include include/uapi/linux/in.h from userspace?

Generally speaking userspace should always use the glibc version of
the headers and not headers from under linux/

Even if it is OK to include both today, that may not be true as glibc
or the kernel changes, and we end up with broken builds.

For instance look at this commit for a real problem caused by mixing
net/if.h and linux/if.h:

commit dc386fcf4a6d5dc0cc0052437c1cb161b7781592
Author: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date:   Fri Oct 14 12:04:42 2016 -0600

    verbs: Use cmake to detect if net/if.h vs netling/route/link.h is broken
    
    If not then just use the header directly, otherwise use the work around.
    
    The issue is that old libnl libraries include linux/if.h and the
    declarations there conflict with net/if.h. New libraries do not
    do this.
    
    Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h
       [not found]               ` <20170809155241.GB15586-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-08-10  2:47                 ` Dmitry V. Levin
       [not found]                   ` <20170810024747.GA30198-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Dmitry V. Levin @ 2017-08-10  2:47 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Moni Shoua, Mikko Rapeli, Linux Kernel Mailinglist,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Sean Hefty, Hal Rosenstock,
	linux-rdma, Doug Ledford

[-- Attachment #1: Type: text/plain, Size: 718 bytes --]

On Wed, Aug 09, 2017 at 09:52:41AM -0600, Jason Gunthorpe wrote:
> On Wed, Aug 09, 2017 at 04:48:08PM +0300, Moni Shoua wrote:
> > >
> > > I'm not sure this is a good idea, linux/in.h should not be included in
> > > userspace users of this file, 'sockaddr_in' needs to come from glibc's
> > > 'netinet/in.h' instead..
> 
> > Is it wrong to include include/uapi/linux/in.h from userspace?
> 
> Generally speaking userspace should always use the glibc version of
> the headers and not headers from under linux/

Sorry?  Isn't the main idea of UAPI in providing the Linux interface for
userspace, unlike glibc headers that provide other more or less standard
interfaces like GNU, POSIX, etc?


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h
       [not found]                   ` <20170810024747.GA30198-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
@ 2017-08-10 16:19                     ` Jason Gunthorpe
  0 siblings, 0 replies; 90+ messages in thread
From: Jason Gunthorpe @ 2017-08-10 16:19 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Moni Shoua, Mikko Rapeli, Linux Kernel Mailinglist,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Sean Hefty, Hal Rosenstock,
	linux-rdma, Doug Ledford

On Thu, Aug 10, 2017 at 05:47:48AM +0300, Dmitry V. Levin wrote:
> On Wed, Aug 09, 2017 at 09:52:41AM -0600, Jason Gunthorpe wrote:
> > On Wed, Aug 09, 2017 at 04:48:08PM +0300, Moni Shoua wrote:
> > > >
> > > > I'm not sure this is a good idea, linux/in.h should not be included in
> > > > userspace users of this file, 'sockaddr_in' needs to come from glibc's
> > > > 'netinet/in.h' instead..
> > 
> > > Is it wrong to include include/uapi/linux/in.h from userspace?
> > 
> > Generally speaking userspace should always use the glibc version of
> > the headers and not headers from under linux/
> 
> Sorry?  Isn't the main idea of UAPI in providing the Linux interface for
> userspace, unlike glibc headers that provide other more or less standard
> interfaces like GNU, POSIX, etc?

The issue is when glibc and linux provide the same standards based API
(eg in.h) - then the uapi version of in.h is really only for
consumption by glibc and other very special cases.

Forcing apps that need to access the rdma uapi that is not implemented
in glibc to deal with that mess is what is problematic. The uapi
system has a number of issues like this :|

If you make it so I cannot include rdma_user_rxe.h and netinet/in.h,
(for instance) in the same file then you broke user space use of the
header and things are worse off..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Xen-devel] [PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace
  2017-08-06 16:44 ` [PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace Mikko Rapeli
@ 2017-08-15 22:58   ` Stefano Stabellini
  0 siblings, 0 replies; 90+ messages in thread
From: Stefano Stabellini @ 2017-08-15 22:58 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel, linux-api, Juergen Gross, Stefano Stabellini,
	Russell King, Paul Durrant, David Vrabel, xen-devel,
	Boris Ostrovsky

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2191 bytes --]

On Sun, 6 Aug 2017, Mikko Rapeli wrote:
> xen/interface/xen.h is not exported from kernel headers so remove the
> dependency and provide needed defines for domid_t and xen_pfn_t if they
> are not already defined by some other e.g. Xen specific headers.
> 
> Suggested by Andrew Cooper <andrew.cooper3@citrix.com> on lkml message
> <5569F9C9.8000607@citrix.com>.
> 
> The ifdef for ARM is ugly but did not find better solutions for it.
> 
> Then use __kernel_size_t instead of size_t since that is available in
> uapi headers in user space.
> 
> Fixes userspace compilation errors:
> 
> xen/privcmd.h:38:31: fatal error: xen/interface/xen.h: No such file or directory
> xen/privcmd.h:92:2: error: unknown type name ‘size_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: Paul Durrant <paul.durrant@citrix.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Russell King <linux@armlinux.org.uk>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

> ---
>  include/uapi/xen/privcmd.h | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/xen/privcmd.h b/include/uapi/xen/privcmd.h
> index 63ee95c9dabb..565f3003741d 100644
> --- a/include/uapi/xen/privcmd.h
> +++ b/include/uapi/xen/privcmd.h
> @@ -35,7 +35,17 @@
>  
>  #include <linux/types.h>
>  #include <linux/compiler.h>
> -#include <xen/interface/xen.h>
> +
> +/* Defined by include/xen/interface/xen.h, but it is not part of Linux uapi */
> +#ifndef __XEN_PUBLIC_XEN_H__
> +typedef __u16 domid_t;
> +
> +#if (defined __ARMEL__ || defined __ARMEB__)
> +typedef __u64 xen_pfn_t;
> +#else
> +typedef unsigned long xen_pfn_t;
> +#endif /* (defined __ARMEL__ || defined __ARMEB__) */
> +#endif /* __XEN_PUBLIC_XEN_H__ */
>  
>  struct privcmd_hypercall {
>  	__u64 op;
> @@ -79,7 +89,7 @@ struct privcmd_mmapbatch_v2 {
>  
>  struct privcmd_dm_op_buf {
>  	void __user *uptr;
> -	size_t size;
> +	__kernel_size_t size;
>  };
>  
>  struct privcmd_dm_op {
> -- 
> 2.13.3
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
> 

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t
       [not found]   ` <20170806164428.2273-28-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2017-08-21 13:33     ` Juergen Gross
       [not found]       ` <ff3e726a-8e03-4543-7190-e6f8229b9e99-IBi9RG/b67k@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Juergen Gross @ 2017-08-21 13:33 UTC (permalink / raw)
  To: Mikko Rapeli, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Boris Ostrovsky
  Cc: xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b, Andrew Morton,
	Masahiro Yamada

On 06/08/17 18:44, Mikko Rapeli wrote:
> Both are needed to compile <xen/gntdev.h> in userspace. Fixes these
> userspace compile errors:
> 
> xen/gntdev.h:151:4: error: unknown type name ‘grant_ref_t’
>     grant_ref_t ref;
>     ^
> xen/gntdev.h:153:4: error: unknown type name ‘domid_t’
>     domid_t domid;
>     ^
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> Cc: Boris Ostrovsky <boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Cc: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
> Cc: xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org
> ---
>  include/uapi/xen/gntdev.h           | 6 ++++++
>  include/xen/interface/grant_table.h | 6 +-----
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h
> index d0661977667e..f208706b07c9 100644
> --- a/include/uapi/xen/gntdev.h
> +++ b/include/uapi/xen/gntdev.h
> @@ -34,6 +34,12 @@
>  #define __LINUX_PUBLIC_GNTDEV_H__
>  
>  #include <linux/types.h>
> +#include <xen/privcmd.h>
> +
> +/*
> + * Reference to a grant entry in a specified domain's grant table.
> + */
> +typedef __u32 grant_ref_t;
>  
>  struct ioctl_gntdev_grant_ref {
>  	/* The domain ID of the grant to be mapped. */
> diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
> index 7fb7112d667c..29b3724aec2c 100644
> --- a/include/xen/interface/grant_table.h
> +++ b/include/xen/interface/grant_table.h
> @@ -29,6 +29,7 @@
>  #define __XEN_PUBLIC_GRANT_TABLE_H__
>  
>  #include <xen/interface/xen.h>
> +#include <uapi/xen/gntdev.h> /* for grant_ref_t */

Hmm, I really don't like this. We import the Xen headers from the Xen
source repository. The Xen specific types shouldn't be taken from
non-Xen headers.

>  
>  /***********************************
>   * GRANT TABLE REPRESENTATION
> @@ -85,11 +86,6 @@
>   */
>  
>  /*
> - * Reference to a grant entry in a specified domain's grant table.
> - */
> -typedef uint32_t grant_ref_t;
> -
> -/*
>   * A grant table comprises a packed array of grant entries in one or more
>   * page frames shared between Xen and a guest.
>   * [XEN]: This field is written by Xen and read by the sharing guest.
> 

I'd rather use __u32 instead of grant_ref_t in the uapi headers.

Boris, what do you think?


Juergen

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t
       [not found]       ` <ff3e726a-8e03-4543-7190-e6f8229b9e99-IBi9RG/b67k@public.gmane.org>
@ 2017-08-21 14:31         ` Boris Ostrovsky
       [not found]           ` <c4766f8b-fcd0-4158-2d70-72417bf4afbb-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Boris Ostrovsky @ 2017-08-21 14:31 UTC (permalink / raw)
  To: Juergen Gross, Mikko Rapeli, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b, Andrew Morton,
	Masahiro Yamada

On 08/21/2017 09:33 AM, Juergen Gross wrote:
> On 06/08/17 18:44, Mikko Rapeli wrote:
>> Both are needed to compile <xen/gntdev.h> in userspace. Fixes these
>> userspace compile errors:
>>
>> xen/gntdev.h:151:4: error: unknown type name ‘grant_ref_t’
>>     grant_ref_t ref;
>>     ^
>> xen/gntdev.h:153:4: error: unknown type name ‘domid_t’
>>     domid_t domid;
>>     ^
>>
>> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
>> Cc: Boris Ostrovsky <boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>> Cc: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
>> Cc: xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org
>> ---
>>  include/uapi/xen/gntdev.h           | 6 ++++++
>>  include/xen/interface/grant_table.h | 6 +-----
>>  2 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h
>> index d0661977667e..f208706b07c9 100644
>> --- a/include/uapi/xen/gntdev.h
>> +++ b/include/uapi/xen/gntdev.h
>> @@ -34,6 +34,12 @@
>>  #define __LINUX_PUBLIC_GNTDEV_H__
>>  
>>  #include <linux/types.h>
>> +#include <xen/privcmd.h>
>> +
>> +/*
>> + * Reference to a grant entry in a specified domain's grant table.
>> + */
>> +typedef __u32 grant_ref_t;
>>  
>>  struct ioctl_gntdev_grant_ref {
>>  	/* The domain ID of the grant to be mapped. */
>> diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
>> index 7fb7112d667c..29b3724aec2c 100644
>> --- a/include/xen/interface/grant_table.h
>> +++ b/include/xen/interface/grant_table.h
>> @@ -29,6 +29,7 @@
>>  #define __XEN_PUBLIC_GRANT_TABLE_H__
>>  
>>  #include <xen/interface/xen.h>
>> +#include <uapi/xen/gntdev.h> /* for grant_ref_t */
> Hmm, I really don't like this. We import the Xen headers from the Xen
> source repository. The Xen specific types shouldn't be taken from
> non-Xen headers.
>
>>  
>>  /***********************************
>>   * GRANT TABLE REPRESENTATION
>> @@ -85,11 +86,6 @@
>>   */
>>  
>>  /*
>> - * Reference to a grant entry in a specified domain's grant table.
>> - */
>> -typedef uint32_t grant_ref_t;
>> -
>> -/*
>>   * A grant table comprises a packed array of grant entries in one or more
>>   * page frames shared between Xen and a guest.
>>   * [XEN]: This field is written by Xen and read by the sharing guest.
>>
> I'd rather use __u32 instead of grant_ref_t in the uapi headers.
>
> Boris, what do you think?

I agree that including a non-Xen file into include/xen/interface is not
especially desirable.

Can we ifdef __KERNEL__grant_ref_t usage in uapi header, with else
clause using __u32? And maybe stick BUILD_BUG_ON somewhere to check that
sizes are still the same ?

-boris

-boris

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t
       [not found]           ` <c4766f8b-fcd0-4158-2d70-72417bf4afbb-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2017-08-21 14:46             ` Juergen Gross
  2017-08-21 14:59               ` Boris Ostrovsky
  0 siblings, 1 reply; 90+ messages in thread
From: Juergen Gross @ 2017-08-21 14:46 UTC (permalink / raw)
  To: Boris Ostrovsky, Mikko Rapeli,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b, Andrew Morton,
	Masahiro Yamada

On 21/08/17 16:31, Boris Ostrovsky wrote:
> On 08/21/2017 09:33 AM, Juergen Gross wrote:
>> On 06/08/17 18:44, Mikko Rapeli wrote:
>>> Both are needed to compile <xen/gntdev.h> in userspace. Fixes these
>>> userspace compile errors:
>>>
>>> xen/gntdev.h:151:4: error: unknown type name ‘grant_ref_t’
>>>     grant_ref_t ref;
>>>     ^
>>> xen/gntdev.h:153:4: error: unknown type name ‘domid_t’
>>>     domid_t domid;
>>>     ^
>>>
>>> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
>>> Cc: Boris Ostrovsky <boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>>> Cc: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
>>> Cc: xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org
>>> ---
>>>  include/uapi/xen/gntdev.h           | 6 ++++++
>>>  include/xen/interface/grant_table.h | 6 +-----
>>>  2 files changed, 7 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h
>>> index d0661977667e..f208706b07c9 100644
>>> --- a/include/uapi/xen/gntdev.h
>>> +++ b/include/uapi/xen/gntdev.h
>>> @@ -34,6 +34,12 @@
>>>  #define __LINUX_PUBLIC_GNTDEV_H__
>>>  
>>>  #include <linux/types.h>
>>> +#include <xen/privcmd.h>
>>> +
>>> +/*
>>> + * Reference to a grant entry in a specified domain's grant table.
>>> + */
>>> +typedef __u32 grant_ref_t;
>>>  
>>>  struct ioctl_gntdev_grant_ref {
>>>  	/* The domain ID of the grant to be mapped. */
>>> diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
>>> index 7fb7112d667c..29b3724aec2c 100644
>>> --- a/include/xen/interface/grant_table.h
>>> +++ b/include/xen/interface/grant_table.h
>>> @@ -29,6 +29,7 @@
>>>  #define __XEN_PUBLIC_GRANT_TABLE_H__
>>>  
>>>  #include <xen/interface/xen.h>
>>> +#include <uapi/xen/gntdev.h> /* for grant_ref_t */
>> Hmm, I really don't like this. We import the Xen headers from the Xen
>> source repository. The Xen specific types shouldn't be taken from
>> non-Xen headers.
>>
>>>  
>>>  /***********************************
>>>   * GRANT TABLE REPRESENTATION
>>> @@ -85,11 +86,6 @@
>>>   */
>>>  
>>>  /*
>>> - * Reference to a grant entry in a specified domain's grant table.
>>> - */
>>> -typedef uint32_t grant_ref_t;
>>> -
>>> -/*
>>>   * A grant table comprises a packed array of grant entries in one or more
>>>   * page frames shared between Xen and a guest.
>>>   * [XEN]: This field is written by Xen and read by the sharing guest.
>>>
>> I'd rather use __u32 instead of grant_ref_t in the uapi headers.
>>
>> Boris, what do you think?
> 
> I agree that including a non-Xen file into include/xen/interface is not
> especially desirable.
> 
> Can we ifdef __KERNEL__grant_ref_t usage in uapi header, with else
> clause using __u32? And maybe stick BUILD_BUG_ON somewhere to check that
> sizes are still the same ?

I'd rather use __u32 unconditionally and have the BUILD_BUG_ON in the
grant or privcmd driver.

Otherwise we'd depend on the sequence of #includes (what happens if a
driver includes the uapi header before xen/interface/xen.h?)


Juergen

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t
  2017-08-21 14:46             ` Juergen Gross
@ 2017-08-21 14:59               ` Boris Ostrovsky
  0 siblings, 0 replies; 90+ messages in thread
From: Boris Ostrovsky @ 2017-08-21 14:59 UTC (permalink / raw)
  To: Juergen Gross, Mikko Rapeli, linux-kernel, linux-api
  Cc: xen-devel, Andrew Morton, Masahiro Yamada

On 08/21/2017 10:46 AM, Juergen Gross wrote:
> On 21/08/17 16:31, Boris Ostrovsky wrote:
>> On 08/21/2017 09:33 AM, Juergen Gross wrote:
>>> On 06/08/17 18:44, Mikko Rapeli wrote:
>>>> Both are needed to compile <xen/gntdev.h> in userspace. Fixes these
>>>> userspace compile errors:
>>>>
>>>> xen/gntdev.h:151:4: error: unknown type name ‘grant_ref_t’
>>>>     grant_ref_t ref;
>>>>     ^
>>>> xen/gntdev.h:153:4: error: unknown type name ‘domid_t’
>>>>     domid_t domid;
>>>>     ^
>>>>
>>>> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
>>>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>>>> Cc: Juergen Gross <jgross@suse.com>
>>>> Cc: xen-devel@lists.xenproject.org
>>>> ---
>>>>  include/uapi/xen/gntdev.h           | 6 ++++++
>>>>  include/xen/interface/grant_table.h | 6 +-----
>>>>  2 files changed, 7 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h
>>>> index d0661977667e..f208706b07c9 100644
>>>> --- a/include/uapi/xen/gntdev.h
>>>> +++ b/include/uapi/xen/gntdev.h
>>>> @@ -34,6 +34,12 @@
>>>>  #define __LINUX_PUBLIC_GNTDEV_H__
>>>>  
>>>>  #include <linux/types.h>
>>>> +#include <xen/privcmd.h>
>>>> +
>>>> +/*
>>>> + * Reference to a grant entry in a specified domain's grant table.
>>>> + */
>>>> +typedef __u32 grant_ref_t;
>>>>  
>>>>  struct ioctl_gntdev_grant_ref {
>>>>  	/* The domain ID of the grant to be mapped. */
>>>> diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
>>>> index 7fb7112d667c..29b3724aec2c 100644
>>>> --- a/include/xen/interface/grant_table.h
>>>> +++ b/include/xen/interface/grant_table.h
>>>> @@ -29,6 +29,7 @@
>>>>  #define __XEN_PUBLIC_GRANT_TABLE_H__
>>>>  
>>>>  #include <xen/interface/xen.h>
>>>> +#include <uapi/xen/gntdev.h> /* for grant_ref_t */
>>> Hmm, I really don't like this. We import the Xen headers from the Xen
>>> source repository. The Xen specific types shouldn't be taken from
>>> non-Xen headers.
>>>
>>>>  
>>>>  /***********************************
>>>>   * GRANT TABLE REPRESENTATION
>>>> @@ -85,11 +86,6 @@
>>>>   */
>>>>  
>>>>  /*
>>>> - * Reference to a grant entry in a specified domain's grant table.
>>>> - */
>>>> -typedef uint32_t grant_ref_t;
>>>> -
>>>> -/*
>>>>   * A grant table comprises a packed array of grant entries in one or more
>>>>   * page frames shared between Xen and a guest.
>>>>   * [XEN]: This field is written by Xen and read by the sharing guest.
>>>>
>>> I'd rather use __u32 instead of grant_ref_t in the uapi headers.
>>>
>>> Boris, what do you think?
>> I agree that including a non-Xen file into include/xen/interface is not
>> especially desirable.
>>
>> Can we ifdef __KERNEL__grant_ref_t usage in uapi header, with else
>> clause using __u32? And maybe stick BUILD_BUG_ON somewhere to check that
>> sizes are still the same ?
> I'd rather use __u32 unconditionally and have the BUILD_BUG_ON in the
> grant or privcmd driver.
>
> Otherwise we'd depend on the sequence of #includes (what happens if a
> driver includes the uapi header before xen/interface/xen.h?)

OK, good point.

-boris

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t
  2017-08-07 15:01       ` Arnd Bergmann
@ 2017-09-02 12:30         ` Oded Gabbay
  0 siblings, 0 replies; 90+ messages in thread
From: Oded Gabbay @ 2017-09-02 12:30 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mikko Rapeli, Andrew Lewycky, Linux Kernel Mailing List,
	dri-devel, Linux API

On Mon, Aug 7, 2017 at 6:01 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Sun, Aug 6, 2017 at 6:44 PM, Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
>> Include <drm/drm.h> instead of <linux/types.h> which on Linux includes
>> <linux/types.h> and on non-Linux platforms defines __u32 etc types.
>>
>> Fixes user space compilation errors like:
>>
>> linux/kfd_ioctl.h:33:2: error: unknown type name ‘uint32_t’
>>   uint32_t major_version; /* from KFD */
>>   ^~~~~~~~
>>
>> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
>> Cc: Yair Shachar <yair.shachar@amd.com>
>> Cc: Oded Gabbay <oded.gabbay@gmail.com>
>> Cc: Andrew Lewycky <Andrew.Lewycky@amd.com>
>
> Looks good to me,
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Thanks!
Applied to amdkfd -next tree

Oded
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space
  2017-08-08 23:25   ` Dmitry V. Levin
@ 2017-09-04 16:15     ` Dmitry V. Levin
       [not found]       ` <20170904161510.GA16001-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 90+ messages in thread
From: Dmitry V. Levin @ 2017-09-04 16:15 UTC (permalink / raw)
  To: linux-kernel, linux-api, Mikko Rapeli, Dave Watson,
	Ilya Lesokhin, Aviad Yehezkel, netdev

[-- Attachment #1: Type: text/plain, Size: 1173 bytes --]

On Wed, Aug 09, 2017 at 02:25:54AM +0300, Dmitry V. Levin wrote:
> On Sun, Aug 06, 2017 at 06:44:26PM +0200, Mikko Rapeli wrote:
> > It is not needed and not part of uapi headers, but causes
> > user space compilation error:
> > 
> > fatal error: net/tcp.h: No such file or directory
> >  #include <net/tcp.h>
> >                      ^
> > 
> > Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> > Cc: Dave Watson <davejwatson@fb.com>
> > Cc: Ilya Lesokhin <ilyal@mellanox.com>
> > Cc: Aviad Yehezkel <aviadye@mellanox.com>
> > ---
> >  include/uapi/linux/tls.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
> > index cc1d21db35d8..d87c698623f2 100644
> > --- a/include/uapi/linux/tls.h
> > +++ b/include/uapi/linux/tls.h
> > @@ -37,7 +37,9 @@
> >  #include <asm/byteorder.h>
> >  #include <linux/socket.h>
> >  #include <linux/tcp.h>
> > +#ifdef __KERNEL__
> >  #include <net/tcp.h>
> > +#endif
> 
> Let's move it to include/net/tls.h instead.

So everybody ignored this and *new* uapi header was released
in a totally unusable form along with v4.13.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space
       [not found]       ` <20170904161510.GA16001-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
@ 2017-09-18 12:57         ` Mikko Rapeli
  0 siblings, 0 replies; 90+ messages in thread
From: Mikko Rapeli @ 2017-09-18 12:57 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Dave Watson, Ilya Lesokhin,
	Aviad Yehezkel, netdev-u79uwXL29TY76Z2rM5mHXA

On Mon, Sep 04, 2017 at 07:15:11PM +0300, Dmitry V. Levin wrote:
> On Wed, Aug 09, 2017 at 02:25:54AM +0300, Dmitry V. Levin wrote:
> > On Sun, Aug 06, 2017 at 06:44:26PM +0200, Mikko Rapeli wrote:
> > > It is not needed and not part of uapi headers, but causes
> > > user space compilation error:
> > > 
> > > fatal error: net/tcp.h: No such file or directory
> > >  #include <net/tcp.h>
> > >                      ^
> > > 
> > > Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> > > Cc: Dave Watson <davejwatson-b10kYP2dOMg@public.gmane.org>
> > > Cc: Ilya Lesokhin <ilyal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > Cc: Aviad Yehezkel <aviadye-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > ---
> > >  include/uapi/linux/tls.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
> > > index cc1d21db35d8..d87c698623f2 100644
> > > --- a/include/uapi/linux/tls.h
> > > +++ b/include/uapi/linux/tls.h
> > > @@ -37,7 +37,9 @@
> > >  #include <asm/byteorder.h>
> > >  #include <linux/socket.h>
> > >  #include <linux/tcp.h>
> > > +#ifdef __KERNEL__
> > >  #include <net/tcp.h>
> > > +#endif
> > 
> > Let's move it to include/net/tls.h instead.
> 
> So everybody ignored this and *new* uapi header was released
> in a totally unusable form along with v4.13.

Should issues like these be filed into bugzilla instead?

Maybe emails are easier to ignore than bugzilla tickets.

-Mikko

^ permalink raw reply	[flat|nested] 90+ messages in thread

end of thread, other threads:[~2017-09-18 12:57 UTC | newest]

Thread overview: 90+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 02/36] uapi scsi/scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 03/36] uapi scsi/scsi_netlink.h: use __u8, __u16 " Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
2017-08-06 18:22   ` James Bottomley
     [not found]     ` <1502043773.2673.9.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-08-06 20:42       ` Mikko Rapeli
2017-08-06 22:09         ` James Bottomley
     [not found]           ` <1502057361.2673.21.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-08-07  6:08             ` Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 06/36] uapi asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 07/36] uapi asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes Mikko Rapeli
2017-08-08 22:42   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
2017-08-08 22:45   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 10/36] uapi asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 11/36] uapi asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-07 14:30   ` Arnd Bergmann
2017-08-08 22:50   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli
     [not found]   ` <20170806164428.2273-14-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 22:54     ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace Mikko Rapeli
2017-08-08 22:57   ` Dmitry V. Levin
     [not found]     ` <20170808225739.GF10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-08-09 12:41       ` Arnd Bergmann
     [not found]         ` <CAK8P3a30Vd2JquMvZ88tTO4jFAUMJGtUpvLuDmDPp2UFBYXDLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-09 12:52           ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space Mikko Rapeli
     [not found]   ` <20170806164428.2273-16-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 23:00     ` Dmitry V. Levin
     [not found]       ` <20170808230041.GG10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-08-09 12:32         ` Arnd Bergmann
2017-08-06 16:44 ` [PATCH v06 16/36] uapi linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 17/36] uapi linux/sctp.h: use __u8, __u16 and __u32 from linux/types.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli
2017-08-06 20:23   ` Willem de Bruijn
2017-08-06 20:26     ` Willem de Bruijn
2017-08-06 20:58       ` Mikko Rapeli
     [not found]     ` <CAF=yD-L2ntuH54J_SwN9WcpBMgkV_v0e-Q2Pu2mrQ3+1RozGFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-06 20:56       ` Mikko Rapeli
     [not found]         ` <20170806205654.GF28459-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2017-08-06 21:24           ` Willem de Bruijn
     [not found]             ` <CAF=yD-+w2sboybyUZ-6nKQy1s=Oi1S4Z5yZgksM-CzQjDRG+Vw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-06 21:33               ` Mikko Rapeli
2017-08-06 21:42                 ` Willem de Bruijn
     [not found]                   ` <CAF=yD-LN9b9q6sY38eCBM3VyfErQ8sqpQ_7fwkJzMxgjeRFtFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-06 21:52                     ` Mikko Rapeli
     [not found]                       ` <20170806215244.GB31101-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2017-08-06 22:03                         ` Willem de Bruijn
2017-08-06 16:44 ` [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-07 15:00   ` Arnd Bergmann
2017-08-08 23:11   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 20/36] uapi linux/scc.h: include linux/sockios.h Mikko Rapeli
     [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-06 16:43   ` [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli
     [not found]     ` <20170806164428.2273-6-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 22:34       ` Dmitry V. Levin
2017-08-09  7:18         ` Mikko Rapeli
2017-08-06 16:44   ` [PATCH v06 21/36] uapi linux/kexec.h: " Mikko Rapeli
     [not found]     ` <20170806164428.2273-22-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:12       ` Arnd Bergmann
2017-08-08 23:15     ` Dmitry V. Levin
2017-08-06 16:44   ` [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Mikko Rapeli
     [not found]     ` <20170806164428.2273-31-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 23:13       ` Jason Gunthorpe
     [not found]         ` <20170808231306.GH29372-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-08-09 13:48           ` Moni Shoua
2017-08-09 15:52             ` Jason Gunthorpe
     [not found]               ` <20170809155241.GB15586-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-08-10  2:47                 ` Dmitry V. Levin
     [not found]                   ` <20170810024747.GA30198-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-08-10 16:19                     ` Jason Gunthorpe
2017-08-06 16:44   ` [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
     [not found]     ` <20170806164428.2273-37-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:01       ` Arnd Bergmann
2017-09-02 12:30         ` Oded Gabbay
2017-08-06 16:44 ` [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-08 23:17   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 23/36] uapi linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli
     [not found]   ` <20170806164428.2273-24-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:06     ` Arnd Bergmann
2017-08-06 16:44 ` [PATCH v06 24/36] uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 25/36] uapi linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace Mikko Rapeli
2017-08-15 22:58   ` [Xen-devel] " Stefano Stabellini
2017-08-06 16:44 ` [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t Mikko Rapeli
     [not found]   ` <20170806164428.2273-28-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-21 13:33     ` Juergen Gross
     [not found]       ` <ff3e726a-8e03-4543-7190-e6f8229b9e99-IBi9RG/b67k@public.gmane.org>
2017-08-21 14:31         ` Boris Ostrovsky
     [not found]           ` <c4766f8b-fcd0-4158-2d70-72417bf4afbb-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-08-21 14:46             ` Juergen Gross
2017-08-21 14:59               ` Boris Ostrovsky
2017-08-06 16:44 ` [PATCH v06 28/36] uapi xen/evtchn.h: include xen/privcmd.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 29/36] uapi linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 31/36] uapi linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 32/36] uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
     [not found]   ` <20170806164428.2273-33-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07  9:47     ` Daniel Vetter
2017-08-06 16:44 ` [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Mikko Rapeli
     [not found]   ` <20170806164428.2273-34-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:54     ` Darrick J. Wong
2017-08-07 16:01       ` Arnd Bergmann
     [not found]         ` <CAK8P3a3sVWu9wiqct4h9njZC53qUOrLbM_wXL7XXZ8hfiuK7Lg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-07 16:45           ` Darrick J. Wong
2017-08-07 20:20             ` Arnd Bergmann
2017-08-08 23:08               ` Darrick J. Wong
2017-08-09  8:24                 ` Arnd Bergmann
2017-08-06 16:44 ` [PATCH v06 34/36] uapi: break dependency loop between <linux/hdlc/ioctl.h> and <linux/if.h> Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space Mikko Rapeli
2017-08-08 23:25   ` Dmitry V. Levin
2017-09-04 16:15     ` Dmitry V. Levin
     [not found]       ` <20170904161510.GA16001-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-09-18 12:57         ` Mikko Rapeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).