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:   Tue, 3 Mar 2020 08:45:21 -0500
From:   Arvind Sankar <nivedita@...m.mit.edu>
To:     Mika Penttilä <mika.penttila@...tfour.com>
Cc:     Arvind Sankar <nivedita@...m.mit.edu>,
        Ard Biesheuvel <ardb@...nel.org>,
        "linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5] efi/x86: Decompress at start of PE image load address

On Tue, Mar 03, 2020 at 06:28:20AM +0000, Mika Penttilä wrote:
> 
> 
> On 2.3.2020 1.05, Arvind Sankar wrote:
> > When booted via PE loader, define image_offset to hold the offset of
> > startup_32 from the start of the PE image, and use it as the start of
> > the decompression buffer.
> >
> > Signed-off-by: Arvind Sankar <nivedita@...m.mit.edu>
> > ---
> >  arch/x86/boot/compressed/head_32.S      | 17 +++++++++++
> >  arch/x86/boot/compressed/head_64.S      | 38 +++++++++++++++++++++++--
> >  drivers/firmware/efi/libstub/x86-stub.c | 12 ++++++--
> >  3 files changed, 61 insertions(+), 6 deletions(-)
> 
> ...
> > --- a/drivers/firmware/efi/libstub/x86-stub.c
> > +++ b/drivers/firmware/efi/libstub/x86-stub.c
> > @@ -19,6 +19,7 @@
> >  
> >  static efi_system_table_t *sys_table;
> >  extern const bool efi_is64;
> > +extern u32 image_offset;
> >  
> >  __pure efi_system_table_t *efi_system_table(void)
> >  {
> > @@ -364,6 +365,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
> >  	struct boot_params *boot_params;
> >  	struct setup_header *hdr;
> >  	efi_loaded_image_t *image;
> > +	void *image_base;
> >  	efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
> >  	int options_size = 0;
> >  	efi_status_t status;
> > @@ -384,7 +386,10 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
> >  		efi_exit(handle, status);
> >  	}
> >  
> > -	hdr = &((struct boot_params *)efi_table_attr(image, image_base))->hdr;
> > +	image_base = efi_table_attr(image, image_base);
> > +	image_offset = (void *)startup_32 - image_base;
> 
> startup_32 == 0, so maybe something like
> 
> leaq	startup_32(%rip) - image_base
> 
> should be used ?
> 

That's what it already uses. All the files in this directory are
compiled to be position-independent, so it uses rip-relative addressing
on 64-bit and GOT-relative addressing on 32-bit.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ