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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 4 Sep 2015 15:18:27 +0300
From:	Mikko Rapeli <mikko.rapeli@....fi>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Borislav Petkov <bp@...en8.de>,
	Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH] x86/headers: Fix (old) header file dependency bug in
 uapi/asm/sigcontext32.h

On Fri, Sep 04, 2015 at 10:58:31AM +0200, Ingo Molnar wrote:
> 
> * Mikko Rapeli <mikko.rapeli@....fi> wrote:
> 
> > On Thu, Sep 03, 2015 at 09:42:32AM +0200, Ingo Molnar wrote:
> > > 
> > > * Mikko Rapeli <mikko.rapeli@....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
--
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