linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@iki.fi>
To: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
Date: Fri, 4 Sep 2015 15:18:27 +0300	[thread overview]
Message-ID: <20150904121827.GB9187@lakka.kapsi.fi> (raw)
In-Reply-To: <20150904085831.GA17456@gmail.com>

On Fri, Sep 04, 2015 at 10:58:31AM +0200, Ingo Molnar wrote:
> 
> * Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> 
> > On Thu, Sep 03, 2015 at 09:42:32AM +0200, Ingo Molnar wrote:
> > > 
> > > * Mikko Rapeli <mikko.rapeli@iki.fi> wrote:
> > > 
> > > > Hi Ingo, Thomas and Peter,
> > > > 
> > > > Do you have any pointers for me how arch/x86/include/uapi/asm/sigcontext32.h
> > > > could be fixed to also compile in userspace? Is definition of _fpx_sw_bytes
> > > > or _fpstate_ia32 even needed there?
> > > > 
> > > > Instructions to reproduce the userspace build failure are here:
> > > > https://lkml.org/lkml/2015/5/30/98
> > > 
> > > Yeah, so this is a real bug in the headers, good find.
> > > 
> > > Also note that somewhat luckily your testcase is artificial, no real user-space 
> > > code can contain that code at the moment because the header never built standalone 
> > > in the past either AFAICS.
> > > 
> > > So it's an old header file dependency bug, to make it build in user-space you need 
> > > to do this workaround:
> > > 
> > >  #include <asm/sigcontext.h>
> > >  #include <asm/sigcontext32.h>
> > > 
> > > If you only include sigcontext32.h:
> > > 
> > >  #include <asm/sigcontext32.h>
> > > 
> > > it will fail to build.
> > > 
> > > To fix the bug:
> > > 
> > > > > --- a/arch/x86/include/uapi/asm/sigcontext32.h
> > > > > +++ b/arch/x86/include/uapi/asm/sigcontext32.h
> > > > > @@ -45,7 +45,6 @@ struct _fpstate_ia32 {
> > > > >  	__u32	padding[44];
> > > > >  	union {
> > > > >  		__u32 padding2[12];
> > > > > -		struct _fpx_sw_bytes sw_reserved;
> > > > >  	};
> > > > >  };
> > > 
> > > No, those fields are real and compat sigframe handling user-space might be relying 
> > > on them.
> > >
> > > Does the fix below work for you?
> > 
> > Unfortunately no:
> > 
> > cc -Wall -c -nostdinc -I /usr/lib/gcc/i586-linux-gnu/5/include -I /usr/lib/gcc/i
> > 586-linux-gnu/5/include-fixed -I . -I ../headers_compile_test_include -I ../head
> > ers_compile_test_include/i586-linux-gnu ./asm/sigcontext32.c
> > In file included from ./asm/sigcontext32.c:1:0:
> > ./asm/sigcontext32.h:12:8: error: redefinition of ‘struct _fpreg’
> >  struct _fpreg {
> >         ^
> > In file included from ./asm/sigcontext32.h:6:0,
> >                  from ./asm/sigcontext32.c:1:
> > ./asm/sigcontext.h:56:8: note: originally defined here
> >  struct _fpreg {
> >         ^
> > In file included from ./asm/sigcontext32.c:1:0:
> > ./asm/sigcontext32.h:17:8: error: redefinition of ‘struct _fpxreg’
> >  struct _fpxreg {
> >         ^
> > In file included from ./asm/sigcontext32.h:6:0,
> >                  from ./asm/sigcontext32.c:1:
> > ./asm/sigcontext.h:61:8: note: originally defined here
> >  struct _fpxreg {
> >         ^
> > In file included from ./asm/sigcontext32.c:1:0:
> > ./asm/sigcontext32.h:23:8: error: redefinition of ‘struct _xmmreg’
> >  struct _xmmreg {
> >         ^
> > In file included from ./asm/sigcontext32.h:6:0,
> >                  from ./asm/sigcontext32.c:1:
> > ./asm/sigcontext.h:67:8: note: originally defined here
> >  struct _xmmreg {
> >         ^
> > FAILED: ./asm/sigcontext32.h
> > 
> > I guess this was the reason why I ended with the hack.
> 
> sigcontext32.h is a 64-bit only header (for compat functionality), and you are 
> trying to build this on i386, right?

Yes, i386 32bit.

> In theory we could unify them mostly, the two structures match mostly, except that 
> '_fpstate_ia32::padding' is named 'padding1' in _fpstate, and there's also some 
> legacy uglies wrt. user-space sigcontext definitions.
> 
> So this either gets cleaned up properly, with the legacy hacks/wrappers clearly 
> isolated, or we could state that you shouldn't build 64-bit headers in 32-bit 
> environments.

Should the sigcontext32.h have some 32bit ifdefs maybe?

I assume that the exported header files should be the same for both 64 and 32
bit i386/x86

-Mikko

  reply	other threads:[~2015-09-04 12:18 UTC|newest]

Thread overview: 143+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30 15:37 [PATCH v03 00/98] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
2015-05-30 15:37 ` [PATCH 01/98] headers_install.sh: enhance error handling Mikko Rapeli
2015-05-30 15:37 ` [PATCH 02/98] scripts/headers_compile_test.sh: compile test script for exported headers Mikko Rapeli
2015-05-30 15:37 ` [PATCH 03/98] drm.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-06-03 17:19   ` Emil Velikov
2015-08-30 10:42     ` Mikko Rapeli
2015-10-15  6:49     ` Daniel Vetter
2015-05-30 15:37 ` [PATCH 04/98] drm_mode.h: use __u32 and __u64 from linux/types.h Mikko Rapeli
2015-05-30 19:58   ` Frans Klaver
2015-05-30 15:37 ` [PATCH 05/98] exynos_drm.h: use " Mikko Rapeli
2015-05-30 16:46   ` Russell King - ARM Linux
2015-06-01  8:20     ` Christian König
2015-06-01  8:56       ` Russell King - ARM Linux
2015-06-01  9:08         ` Christian König
2015-06-01  9:14           ` Frans Klaver
2015-06-01  9:38           ` Russell King - ARM Linux
2015-06-01  9:51             ` Christian König
2015-06-01  9:15       ` Mikko Rapeli
2015-06-02 18:59     ` Mikko Rapeli
2015-05-30 15:37 ` [PATCH 06/98] nouveau_drm.h: use __u32 and " Mikko Rapeli
2015-05-30 15:37 ` [PATCH 07/98] radeon_drm.h: " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 08/98] r128_drm.h: include drm/drm.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 09/98] via_drm.h: include linux/types.h instead of non-existing via_drmclient.h Mikko Rapeli
2015-06-03 17:16   ` Emil Velikov
2015-06-04 11:34     ` Emil Velikov
2015-05-30 15:38 ` [PATCH 10/98] via_drm.h: hide struct via_file_private in userspace Mikko Rapeli
2015-06-03 16:50   ` Emil Velikov
2015-09-02 19:17     ` Mikko Rapeli
2015-05-30 15:38 ` [PATCH 11/98] savage_drm.h: include <drm/drm.h> Mikko Rapeli
2015-05-30 15:38 ` [PATCH 12/98] sis_drm.h: hide sis_file_private in userspace Mikko Rapeli
2015-05-30 15:38 ` [PATCH 13/98] drm/i810_drm.h: include drm/drm.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 14/98] include/uapi/drm/vmwgfx_drm.h: use __s32, __u32 and __u64 from linux/types.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 15/98] include/uapi/drm/qxl_drm.h: " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 16/98] include/uapi/drm/msm_drm.h: use __s32, __s64, " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 17/98] include/uapi/linux/agpgart.h: include stdlib.h in userspace Mikko Rapeli
2015-05-30 15:38 ` [PATCH 18/98] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP etc macros Mikko Rapeli
2015-05-31  7:18   ` Takashi Iwai
2015-05-31  8:12     ` Takashi Iwai
2015-06-02 19:08       ` Mikko Rapeli
2015-05-30 15:38 ` [PATCH 19/98] dm-log-userspace.h: use __u32, __s32 and __u64 from linux/types.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 20/98] hsi_char.h: use __u32 " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 21/98] include/uapi/linux/hsi/cs-protocol.h: include linux/time.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 22/98] ebtables.h: use __u64 from linux/types.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 23/98] cld.h: use __u8, __u16, __s16, __u32 and __s64 " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 24/98] rds.h: " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 25/98] sctp.h: use __u8 and __u32 " Mikko Rapeli
2015-06-01 13:40   ` Neil Horman
2015-05-30 15:38 ` [PATCH 26/98] scsi_bsg_fc.h: use __u8, __u32 and __u64 " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 27/98] scsi_netlink.h: use __u8, __u16 " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 28/98] scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 29/98] scsi_netlink_fc.h: include stdint.h in userspace Mikko Rapeli
2015-05-30 20:17   ` Frans Klaver
2015-06-02 19:14     ` Mikko Rapeli
2015-05-30 15:38 ` [PATCH 30/98] hdspm.h: use __u8, __u32 and __u64 from linux/types.h Mikko Rapeli
2015-05-31  7:11   ` Takashi Iwai
2015-06-02 19:18     ` Mikko Rapeli
2015-05-30 15:38 ` [PATCH 31/98] gntalloc.h: use __u16, " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 32/98] gntdev.h: use " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 33/98] include/uapi/linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-05-30 15:38 ` [PATCH 34/98] include/uapi/asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 35/98] include/uapi/asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 36/98] include/uapi/asm-generic/shmbuf.h: include fixes Mikko Rapeli
2015-05-30 15:38 ` [PATCH 37/98] asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 38/98] include/uapi/asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-05-30 15:38 ` [PATCH 39/98] include/uapi/linux/socket.h: include sys/socket.h in userspace Mikko Rapeli
2015-05-30 15:38 ` [PATCH 40/98] include/uapi/linux/rds.h: include linux/socket.h and linux/types.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 41/98] include/uapi/linux/if_pppox.h: include linux/if.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 42/98] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 43/98] include/uapi/linux/hdlc/ioctl.h: include linux/if.h Mikko Rapeli
2015-05-30 20:22   ` Frans Klaver
2015-06-02 19:34     ` Mikko Rapeli
2015-05-30 15:38 ` [PATCH 44/98] nf_conntrack_tuple_common.h: include linux/types.h and linux/netfilter.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 45/98] include/uapi/linux/ipv6_route.h: include linux/in6.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 46/98] " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 47/98] include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 48/98] include/uapi/linux/if_pppox.h: " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 49/98] Break dependency loop between linux/if.h and linux/hdlc/ioctl.h Mikko Rapeli
2015-05-30 19:52   ` Frans Klaver
2015-05-30 15:38 ` [PATCH 50/98] include/uapi/linux/packet_diag.h: include linux/netdevice.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 51/98] include/uapi/linux/llc.h: include linux/if.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 52/98] include/uapi/linux/mqueue.h: include linux/types.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 53/98] include/uapi/linux/mroute.h: include linux/in.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 54/98] include/uapi/linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 55/98] include/uapi/linux/ip6_tunnel.h: include linux/if.h and linux/in6.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 56/98] include/uapi/linux/netfilter.h: include in.h and in6.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 57/98] include/uapi/linux/netfilter_bridge.h: include in.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 58/98] include/uapi/linux/netfilter_ipv4/ip_tables.h: include linux/if.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 59/98] include/uapi/linux/netfilter: include linux/if.h in several headers Mikko Rapeli
2015-05-30 15:38 ` [PATCH 60/98] include/uapi/linux/netfilter/xt_osf.h: include linux/ip.h and linux/tcp.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 61/98] include/uapi/linux/netfilter_ipv6/ip6t_rt.h: include linux/in6.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 62/98] include/uapi/linux/netfilter_bridge/ebt_ip6.h: " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 63/98] include/uapi/linux/netfilter/xt_policy.h: include linux/in.h and linux/in6.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 64/98] include/uapi/linux/netfilter_bridge/ebt_arp.h: include linux/if_ether.h Mikko Rapeli
2015-05-30 15:38 ` [PATCH 65/98] include/uapi/linux/netfilter_bridge/ebt_arpreply.h: " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 66/98] include/uapi/linux/netfilter_bridge/ebt_nat.h: " Mikko Rapeli
2015-05-30 15:38 ` [PATCH 67/98] include/uapi/linux/netfilter/ipset/ip_set_bitmap.h: include linux/netfilter/ipset/ip_set.h Mikko Rapeli
2015-05-31 18:15   ` Jozsef Kadlecsik
2015-06-02 19:42     ` Mikko Rapeli
2015-05-30 15:39 ` [PATCH 68/98] include/uapi/linux/netfilter/ipset/ip_set_hash.h: " Mikko Rapeli
2015-05-30 15:39 ` [PATCH 69/98] include/uapi/linux/netfilter/ipset/ip_set_list.h: " Mikko Rapeli
2015-05-30 15:39 ` [PATCH 70/98] include/uapi/linux/netfilter/xt_HMARK.h: include linux/netfilter.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 71/98] include/uapi/linux/netfilter/xt_TEE.h: " Mikko Rapeli
2015-05-30 15:39 ` [PATCH 72/98] include/uapi/linux/netfilter/xt_TPROXY.h: " Mikko Rapeli
2015-05-30 15:39 ` [PATCH 73/98] include/uapi/linux/netfilter/xt_ipvs.h: " Mikko Rapeli
2015-05-30 15:39 ` [PATCH 74/98] include/uapi/linux/netfilter/xt_mac.h: include linux/if_ether.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 75/98] include/uapi/linux/netfilter/xt_sctp.h: use _Bool type, 1 for true and 0 for false Mikko Rapeli
2015-05-30 15:39 ` [PATCH 76/98] include/uapi/linux/netfilter/xt_recent.h: include linux/netfilter.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 77/98] include/uapi/linux/errqueue.h: include linux/time.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 78/98] include/uapi/asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 79/98] arch/x86/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-05-30 15:39 ` [PATCH 80/98] include/uapi/linux/auto_fs.h: include linux/limits.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 81/98] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 82/98] include/uapi/linux/target_core_user.h: use __u8, __u16, __u32 and __u64 " Mikko Rapeli
2015-05-30 15:39 ` [PATCH 83/98] include/uapi/linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-05-30 15:39 ` [PATCH 84/98] include/uapi/linux/atm_zatm.h: include linux/time.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 85/98] include/uapi/linux/scc.h: include linux/sockios.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 86/98] include/uapi/linux/btrfs.h: define NULL Mikko Rapeli
2015-05-30 15:39 ` [PATCH 87/98] include/uapi/linux/kexec.h: use __kernel_size_t instead of size_t Mikko Rapeli
2015-05-30 15:39 ` [PATCH 88/98] include/uapi/linux/reiserfs_xattr.h: " Mikko Rapeli
2015-05-30 15:39 ` [PATCH 89/98] include/uapi/linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli
2015-05-30 15:39 ` [PATCH 90/98] include/uapi/linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli
2015-05-30 15:39 ` [PATCH 91/98] include/uapi/linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli
2015-05-30 15:39 ` [PATCH 92/98] arch/x86/include/uapi/asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 93/98] include/uapi/linux/virtio_balloon.h: include linux/virtio_types.h Mikko Rapeli
2015-05-30 15:39 ` [PATCH 94/98] HACK arch/x86/include/uapi/asm/sigcontext32.h: remove _fpx_sw_bytes from union Mikko Rapeli
2015-09-02 19:34   ` Mikko Rapeli
2015-09-03  7:42     ` [PATCH] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h Ingo Molnar
2015-09-04  7:10       ` Mikko Rapeli
2015-09-04  8:58         ` Ingo Molnar
2015-09-04 12:18           ` Mikko Rapeli [this message]
2015-09-05  7:32             ` Ingo Molnar
2015-05-30 15:39 ` [PATCH 95/98] HACK: fix include/uapi/xen/privcmd.h compilation in userspace Mikko Rapeli
2015-05-30 17:56   ` [Xen-devel] " Andrew Cooper
2015-09-10 19:46     ` Mikko Rapeli
2015-05-30 15:39 ` [PATCH 96/98] HACK include/uapi/linux/coda_psdev.h: fix " Mikko Rapeli
2015-05-31 11:19   ` Jan Harkes
2015-09-10 19:48     ` Mikko Rapeli
2015-05-30 15:39 ` [PATCH 97/98] HACK include/uapi/linux/elfcore.h: use __kernel_pid_t and remove elf_greg_t stuff " Mikko Rapeli
2015-10-06 19:20   ` Mikko Rapeli
2015-05-30 15:39 ` [PATCH 98/98] HACK include/uapi/linux/errqueue.h: include time.h " Mikko Rapeli
2015-10-06 19:56   ` Mikko Rapeli
2015-05-30 20:12 ` [PATCH v03 00/98] Userspace compile test and fixes for exported uapi header files Richard Weinberger
2015-05-31  4:05   ` Mikko Rapeli

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20150904121827.GB9187@lakka.kapsi.fi \
    --to=mikko.rapeli@iki.fi \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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).