Messages in this thread Patch in this message |  | | Date | Thu, 3 Sep 2015 09:42:32 +0200 | From | Ingo Molnar <> | Subject | [PATCH] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h |
| |
* 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?
Thanks,
Ingo
=========================> From 0bcdebb70e1ae246139df71acfa744ab1629d877 Mon Sep 17 00:00:00 2001 From: Ingo Molnar <mingo@kernel.org> Date: Thu, 3 Sep 2015 09:35:19 +0200 Subject: [PATCH] x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
Mikko Rapeli reported that the following standalone user-space header does not compile:
#include <asm/sigcontext32.h>
Due to undefined 'struct __fpx_sw_bytes' which is defined in asm/sigcontext.h.
The following header order works:
#include <asm/sigcontext.h> #include <asm/sigcontext32.h>
and that's probably how everyone's been using these headers for the past decade or so, but it's a legit header file dependency bug, so include asm/sigcontext.h in sigcontext32.h to allow it to be built standlone.
Reported-by: Mikko Rapeli <mikko.rapeli@iki.fi> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/include/uapi/asm/sigcontext32.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h index ad1478c4ae12..ff7826c41a1c 100644 --- a/arch/x86/include/uapi/asm/sigcontext32.h +++ b/arch/x86/include/uapi/asm/sigcontext32.h @@ -3,6 +3,8 @@ #include <linux/types.h> +#include <asm/sigcontext.h> + /* signal context for 32bit programs. */ #define X86_FXSR_MAGIC 0x0000
|  |