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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 11 Aug 2014 16:23:35 -0400
From:	Vivek Goyal <vgoyal@...hat.com>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Shaun Ruffell <sruffell@...ium.com>, linux-kernel@...r.kernel.org,
	kexec@...ts.infradead.org, ebiederm@...ssion.com,
	mjg59@...f.ucam.org, greg@...ah.com, bp@...en8.de,
	dyoung@...hat.com, chaowang@...hat.com, bhe@...hat.com,
	akpm@...ux-foundation.org
Subject: Re: [PATCH 11/15] purgatory: Core purgatory functionality

On Mon, Aug 11, 2014 at 11:08:48AM -0700, H. Peter Anvin wrote:
> On 08/11/2014 11:02 AM, Vivek Goyal wrote:
> > 
> > Hi hpa,
> > 
> > I took it because kexec-tools uses it and in one of the committs Eric
> > gave following reasoning.
> > 
> >     On x86_64 use -mcmodel=large so that the code is built without
> >     any 32bit assumptions.  -mcmodel=medium and -mcmodel=small
> >     result int code that has 32bit relocations against variables
> >     that can live anywhere in the address space
> > 
> > We do want to load purgatory anywhere in the address space. 
> > 
> > But if there are other ways to achieve the same thing, I will do that
> > change.
> > 
> > So when you say "small PIC", I need to use -mcmodel=small and -fPIC?
> > 
> 
> Actually -fPIE is probably better than -fPIC.
> 
> -mcmodel=large is incompatible with all other code out there, which
> means that even though it is supposed to work it will be poorly tested
> at best.  So even despite the gcc version issue, using the small PIC
> model would be better.

Hi hpa,

I have not introduced a new config option for new system call. It compiles
under existing config option CONFIG_KEXEC and I think that's the reason
Shaun is running into this issue.

I passed -mcmodel=small and -fPIE for purgaotry build.

KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
-fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os
-mcmodel=small -fPIE

On the surface I see new reclocation types. 

000000000022  003000000004 R_X86_64_PLT32    00000000000000d8 sha256_init - 4
000000000034  003f00000004 R_X86_64_PLT32    000000000000011a sha256_update - 4
000000000049  004100000004 R_X86_64_PLT32    0000000000001d4d sha256_final - 4

Current code does not take care of these. I am hoping these can be
managed.

I also see undefined symbol.

    64: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_

And current purgatory relocation code does not expect any undefined
symbols and errors out. IIUC, undefined symbols expect to be resolved
externally by linking against somehing else. But in case of purgatory
this is suppoed to be stand alone and does not link against anything
else. So I am not sure how to take care of this.

I doubt that I can get this code working with -fPIE in short
amount of time (Given my lack of knowledge in this area). So while we
continue to explore it, will it make sense that I also work on a patch to
hide all the new functionality behind a new config option
(say CONFIG_KEXEC_FILE). That way existing users will not be impacted and
only users of the new syscall will be expected to have newer gcc with
-mcmodel=large.

And then I can continue to look into how to get rid of -mcmodel=large
requirement.

Thanks
Vivek
--
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