[PATCH] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h

From: Ingo Molnar
Date: Thu Sep 03 2015 - 03:42:40 EST

* Mikko Rapeli <mikko.rapeli@xxxxxx> 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?