lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1433000370-19509-1-git-send-email-mikko.rapeli@iki.fi>
Date:	Sat, 30 May 2015 17:37:52 +0200
From:	Mikko Rapeli <mikko.rapeli@....fi>
To:	linux-kernel@...r.kernel.org
Cc:	Mikko Rapeli <mikko.rapeli@....fi>
Subject: [PATCH v03 00/98] Userspace compile test and fixes for exported uapi header files

v3:
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 many of the userspace header compilation failures.

Changes are also available in headers_test_v03 branch at github:
https://github.com/mcfrisk/linux/tree/headers_test_v03

The patch set includes some obvious hacks for which I'd like to get some
feedback and suggestions how to properly fix them.

Here's how to run the userspace compile tests:

$ make headers_install && cd usr/include && \
  ../../scripts/headers_compile_test.sh

Additionally tested an allyesconfig compilation on 32bit x86.

Mikko Rapeli (98):
  headers_install.sh: enhance error handling
  scripts/headers_compile_test.sh: compile test script for exported
    headers
  drm.h: use __kernel_size_t instead of size_t
  drm_mode.h: use __u32 and __u64 from linux/types.h
  exynos_drm.h: use __u64 from linux/types.h
  nouveau_drm.h: use __u32 and __u64 from linux/types.h
  radeon_drm.h: use __u32 and __u64 from linux/types.h
  r128_drm.h: include drm/drm.h
  via_drm.h: include linux/types.h instead of non-existing
    via_drmclient.h
  via_drm.h: hide struct via_file_private in userspace
  savage_drm.h: include <drm/drm.h>
  sis_drm.h: hide sis_file_private in userspace
  drm/i810_drm.h: include drm/drm.h
  include/uapi/drm/vmwgfx_drm.h: use __s32, __u32 and __u64 from
    linux/types.h
  include/uapi/drm/qxl_drm.h: use __s32, __u32 and __u64 from
    linux/types.h
  include/uapi/drm/msm_drm.h: use __s32, __s64, __u32 and __u64 from
    linux/types.h
  include/uapi/linux/agpgart.h: include stdlib.h in userspace
  include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP
    etc macros
  dm-log-userspace.h: use __u32, __s32 and __u64 from linux/types.h
  hsi_char.h: use __u32 from linux/types.h
  include/uapi/linux/hsi/cs-protocol.h: include linux/time.h
  ebtables.h: use __u64 from linux/types.h
  cld.h: use __u8, __u16, __s16, __u32 and __s64 from linux/types.h
  rds.h: use __u8, __u16, __s16, __u32 and __s64 from linux/types.h
  sctp.h: use __u8 and __u32 from linux/types.h
  scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h
  scsi_netlink.h: use __u8, __u16 and __u64 from linux/types.h
  scsi_netlink_fc.h: use __u16, __u32 and __u64 from linux/types.h
  scsi_netlink_fc.h: include stdint.h in userspace
  hdspm.h: use __u8, __u32 and __u64 from linux/types.h
  gntalloc.h: use __u16, __u32 and __u64 from linux/types.h
  gntdev.h: use __u32 and __u64 from linux/types.h
  include/uapi/linux/sysctl.h: use __kernel_size_t instead of size_t
  include/uapi/asm-generic/ipcbuf.h: include linux/posix_types.h
  include/uapi/asm-generic/msgbuf.h: include asm/ipcbuf.h
  include/uapi/asm-generic/shmbuf.h: include fixes
  asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h
  include/uapi/asm-generic/signal.h: use __kernel_size_t instead of
    size_t
  include/uapi/linux/socket.h: include sys/socket.h in userspace
  include/uapi/linux/rds.h: include linux/socket.h and linux/types.h
  include/uapi/linux/if_pppox.h: include linux/if.h
  include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and
    linux/in6.h
  include/uapi/linux/hdlc/ioctl.h: include linux/if.h
  nf_conntrack_tuple_common.h: include linux/types.h and
    linux/netfilter.h
  include/uapi/linux/ipv6_route.h: include linux/in6.h
  include/uapi/linux/ipv6_route.h: include linux/in6.h
  include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h
  include/uapi/linux/if_pppox.h: include linux/in.h and linux/in6.h
  Break dependency loop between linux/if.h and linux/hdlc/ioctl.h
  include/uapi/linux/packet_diag.h: include linux/netdevice.h
  include/uapi/linux/llc.h: include linux/if.h
  include/uapi/linux/mqueue.h: include linux/types.h
  include/uapi/linux/mroute.h: include linux/in.h
  include/uapi/linux/dlm_netlink.h: include linux/dlmconstants.h
  include/uapi/linux/ip6_tunnel.h: include linux/if.h and linux/in6.h
  include/uapi/linux/netfilter.h: include in.h and in6.h
  include/uapi/linux/netfilter_bridge.h: include in.h
  include/uapi/linux/netfilter_ipv4/ip_tables.h: include linux/if.h
  include/uapi/linux/netfilter: include linux/if.h in several headers
  include/uapi/linux/netfilter/xt_osf.h: include linux/ip.h and
    linux/tcp.h
  include/uapi/linux/netfilter_ipv6/ip6t_rt.h: include linux/in6.h
  include/uapi/linux/netfilter_bridge/ebt_ip6.h: include linux/in6.h
  include/uapi/linux/netfilter/xt_policy.h: include linux/in.h and
    linux/in6.h
  include/uapi/linux/netfilter_bridge/ebt_arp.h: include
    linux/if_ether.h
  include/uapi/linux/netfilter_bridge/ebt_arpreply.h: include
    linux/if_ether.h
  include/uapi/linux/netfilter_bridge/ebt_nat.h: include
    linux/if_ether.h
  include/uapi/linux/netfilter/ipset/ip_set_bitmap.h: include
    linux/netfilter/ipset/ip_set.h
  include/uapi/linux/netfilter/ipset/ip_set_hash.h: include
    linux/netfilter/ipset/ip_set.h
  include/uapi/linux/netfilter/ipset/ip_set_list.h: include
    linux/netfilter/ipset/ip_set.h
  include/uapi/linux/netfilter/xt_HMARK.h: include linux/netfilter.h
  include/uapi/linux/netfilter/xt_TEE.h: include linux/netfilter.h
  include/uapi/linux/netfilter/xt_TPROXY.h: include linux/netfilter.h
  include/uapi/linux/netfilter/xt_ipvs.h: include linux/netfilter.h
  include/uapi/linux/netfilter/xt_mac.h: include linux/if_ether.h
  include/uapi/linux/netfilter/xt_sctp.h: use _Bool type, 1 for true and
    0 for false
  include/uapi/linux/netfilter/xt_recent.h: include linux/netfilter.h
  include/uapi/linux/errqueue.h: include linux/time.h
  include/uapi/asm-generic/ucontext.h: include asm/signal.h and
    asm/sigcontext.h
  arch/x86/include/uapi/asm/signal.h: use __kernel_size_t instead of
    size_t
  include/uapi/linux/auto_fs.h: include linux/limits.h
  include/uapi/linux/openvswitch.h: use __u32 from linux/types.h
  include/uapi/linux/target_core_user.h: use __u8, __u16, __u32 and
    __u64 from linux/types.h
  include/uapi/linux/omapfb.h: use __kernel_size_t instead of size_t
  include/uapi/linux/atm_zatm.h: include linux/time.h
  include/uapi/linux/scc.h: include linux/sockios.h
  include/uapi/linux/btrfs.h: define NULL
  include/uapi/linux/kexec.h: use __kernel_size_t instead of size_t
  include/uapi/linux/reiserfs_xattr.h: use __kernel_size_t instead of
    size_t
  include/uapi/linux/patchkey.h: change #error to #warning if file
    included directly
  include/uapi/linux/coda.h: use __kernel_pid_t and add u_short etc
    definitions for userspace
  include/uapi/linux/android/binder.h: use __kernel_pid_t and
    __kernel_uid_t
  arch/x86/include/uapi/asm/sembuf.h: include linux/types.h and
    linux/ipc.h
  include/uapi/linux/virtio_balloon.h: include linux/virtio_types.h
  HACK arch/x86/include/uapi/asm/sigcontext32.h: remove _fpx_sw_bytes
    from union
  HACK: fix include/uapi/xen/privcmd.h compilation in userspace
  HACK include/uapi/linux/coda_psdev.h: fix compilation in userspace
  HACK include/uapi/linux/elfcore.h: use __kernel_pid_t and remove
    elf_greg_t stuff in userspace
  HACK include/uapi/linux/errqueue.h: include time.h in userspace

 arch/x86/include/asm/pvclock-abi.h                 |  41 +-
 arch/x86/include/asm/xen/interface.h               | 185 +----
 arch/x86/include/asm/xen/interface_32.h            |  98 +--
 arch/x86/include/asm/xen/interface_64.h            | 144 +---
 arch/x86/include/uapi/asm/Kbuild                   |   2 +
 arch/x86/include/uapi/asm/pvclock-abi.h            |  47 ++
 arch/x86/include/uapi/asm/sembuf.h                 |   3 +
 arch/x86/include/uapi/asm/sigcontext32.h           |   1 -
 arch/x86/include/uapi/asm/signal.h                 |   2 +-
 arch/x86/include/uapi/asm/xen/Kbuild               |   5 +
 arch/x86/include/uapi/asm/xen/interface.h          | 198 ++++++
 arch/x86/include/uapi/asm/xen/interface_32.h       | 103 +++
 arch/x86/include/uapi/asm/xen/interface_64.h       | 150 ++++
 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/drm.h                             |   8 +-
 include/uapi/drm/drm_mode.h                        |  16 +-
 include/uapi/drm/exynos_drm.h                      |   7 +-
 include/uapi/drm/i810_drm.h                        |   2 +
 include/uapi/drm/msm_drm.h                         |  76 +--
 include/uapi/drm/nouveau_drm.h                     |  86 +--
 include/uapi/drm/qxl_drm.h                         |  74 +-
 include/uapi/drm/r128_drm.h                        |   2 +
 include/uapi/drm/radeon_drm.h                      | 129 ++--
 include/uapi/drm/savage_drm.h                      |   2 +
 include/uapi/drm/sis_drm.h                         |   2 +
 include/uapi/drm/via_drm.h                         |   6 +-
 include/uapi/drm/vmwgfx_drm.h                      | 260 +++----
 include/uapi/linux/agpgart.h                       |   1 +
 include/uapi/linux/android/binder.h                |   4 +-
 include/uapi/linux/atm_zatm.h                      |   1 +
 include/uapi/linux/auto_fs.h                       |   1 +
 include/uapi/linux/btrfs.h                         |   6 +
 include/uapi/linux/coda.h                          |  11 +-
 include/uapi/linux/coda_psdev.h                    |  13 +-
 include/uapi/linux/dlm_netlink.h                   |   1 +
 include/uapi/linux/dm-log-userspace.h              |  43 +-
 include/uapi/linux/elfcore.h                       |  14 +-
 include/uapi/linux/errqueue.h                      |   6 +
 include/uapi/linux/hdlc/ioctl.h                    |   4 +
 include/uapi/linux/hsi/cs-protocol.h               |   1 +
 include/uapi/linux/hsi/hsi_char.h                  |  17 +-
 include/uapi/linux/if.h                            |   4 +
 include/uapi/linux/if_pppol2tp.h                   |   3 +-
 include/uapi/linux/if_pppox.h                      |   3 +
 include/uapi/linux/if_tunnel.h                     |   3 +
 include/uapi/linux/ip6_tunnel.h                    |   2 +
 include/uapi/linux/ipv6_route.h                    |   1 +
 include/uapi/linux/kexec.h                         |   4 +-
 include/uapi/linux/llc.h                           |   1 +
 include/uapi/linux/mqueue.h                        |   2 +
 include/uapi/linux/mroute.h                        |   1 +
 include/uapi/linux/mroute6.h                       |   1 +
 include/uapi/linux/netfilter.h                     |   3 +-
 include/uapi/linux/netfilter/ipset/ip_set_bitmap.h |   2 +
 include/uapi/linux/netfilter/ipset/ip_set_hash.h   |   2 +
 include/uapi/linux/netfilter/ipset/ip_set_list.h   |   2 +
 .../linux/netfilter/nf_conntrack_tuple_common.h    |   3 +
 include/uapi/linux/netfilter/xt_HMARK.h            |   1 +
 include/uapi/linux/netfilter/xt_RATEEST.h          |   1 +
 include/uapi/linux/netfilter/xt_TEE.h              |   2 +
 include/uapi/linux/netfilter/xt_TPROXY.h           |   1 +
 include/uapi/linux/netfilter/xt_hashlimit.h        |   1 +
 include/uapi/linux/netfilter/xt_ipvs.h             |   1 +
 include/uapi/linux/netfilter/xt_mac.h              |   2 +
 include/uapi/linux/netfilter/xt_osf.h              |   2 +
 include/uapi/linux/netfilter/xt_physdev.h          |   2 +-
 include/uapi/linux/netfilter/xt_policy.h           |   2 +
 include/uapi/linux/netfilter/xt_rateest.h          |   1 +
 include/uapi/linux/netfilter/xt_recent.h           |   1 +
 include/uapi/linux/netfilter/xt_sctp.h             |  12 +-
 include/uapi/linux/netfilter_arp/arp_tables.h      |   1 +
 include/uapi/linux/netfilter_bridge.h              |   1 +
 include/uapi/linux/netfilter_bridge/ebt_arp.h      |   1 +
 include/uapi/linux/netfilter_bridge/ebt_arpreply.h |   2 +
 include/uapi/linux/netfilter_bridge/ebt_ip6.h      |   1 +
 include/uapi/linux/netfilter_bridge/ebt_nat.h      |   2 +
 include/uapi/linux/netfilter_bridge/ebtables.h     |   6 +-
 include/uapi/linux/netfilter_ipv4/ip_tables.h      |   1 +
 include/uapi/linux/netfilter_ipv6/ip6_tables.h     |   1 +
 include/uapi/linux/netfilter_ipv6/ip6t_rt.h        |   2 +-
 include/uapi/linux/nfsd/cld.h                      |  14 +-
 include/uapi/linux/omapfb.h                        |   2 +-
 include/uapi/linux/openvswitch.h                   |   4 +-
 include/uapi/linux/packet_diag.h                   |   1 +
 include/uapi/linux/patchkey.h                      |   2 +-
 include/uapi/linux/rds.h                           | 103 +--
 include/uapi/linux/reiserfs_xattr.h                |   2 +-
 include/uapi/linux/scc.h                           |   1 +
 include/uapi/linux/sctp.h                          |   8 +-
 include/uapi/linux/socket.h                        |   4 +
 include/uapi/linux/sysctl.h                        |   4 +-
 include/uapi/linux/target_core_user.h              |  22 +-
 include/uapi/linux/virtio_balloon.h                |   1 +
 include/uapi/scsi/scsi_bsg_fc.h                    |  54 +-
 include/uapi/scsi/scsi_netlink.h                   |  22 +-
 include/uapi/scsi/scsi_netlink_fc.h                |  21 +-
 include/uapi/sound/emu10k1.h                       |  23 +-
 include/uapi/sound/hdspm.h                         |  40 +-
 include/uapi/xen/Kbuild                            |   1 +
 include/uapi/xen/gntalloc.h                        |  22 +-
 include/uapi/xen/gntdev.h                          |  34 +-
 include/uapi/xen/interface/Kbuild                  |   2 +
 include/uapi/xen/interface/xen.h                   | 759 +++++++++++++++++++++
 include/xen/interface/xen.h                        | 754 +-------------------
 scripts/headers_compile_test.sh                    | 143 ++++
 scripts/headers_install.sh                         |  14 +-
 111 files changed, 2142 insertions(+), 1786 deletions(-)
 create mode 100644 arch/x86/include/uapi/asm/pvclock-abi.h
 create mode 100644 arch/x86/include/uapi/asm/xen/Kbuild
 create mode 100644 arch/x86/include/uapi/asm/xen/interface.h
 create mode 100644 arch/x86/include/uapi/asm/xen/interface_32.h
 create mode 100644 arch/x86/include/uapi/asm/xen/interface_64.h
 create mode 100644 include/uapi/xen/interface/Kbuild
 create mode 100644 include/uapi/xen/interface/xen.h
 create mode 100755 scripts/headers_compile_test.sh

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ