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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 24 Oct 2017 17:16:02 +0800
From:   jeffy <jeffy.chen@...k-chips.com>
To:     Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Russell King - ARM Linux <linux@...linux.org.uk>
CC:     Ingo Molnar <mingo@...nel.org>,
        Chris Zhong <chris.zhong@...k-chips.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] ARM: Fix zImage file size not aligned with CONFIG_EFI_STUB
 enabled

Hi guys,

On 10/24/2017 04:09 PM, Ard Biesheuvel wrote:
> The following patch appears to fix the issue as well:
>
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.S
> b/arch/arm/boot/compressed/vmlinux.lds.S
> index 7a4c59154361..0e0f504e256e 100644
> --- a/arch/arm/boot/compressed/vmlinux.lds.S
> +++ b/arch/arm/boot/compressed/vmlinux.lds.S
> @@ -83,7 +83,9 @@ SECTIONS
>     __pecoff_data_rawsize = . - ADDR(.data);
>   #endif
>
> -  _edata = .;
> +  .edata (NOLOAD) : {
> +    _edata = .;
> +  }
>
>     _magic_sig = ZIMAGE_MAGIC(0x016f2818);
>     _magic_start = ZIMAGE_MAGIC(_start);
>
> because the NOLOAD triggers the linker to emit all PROGBITS sections
> before _edata, including unknown ones.
>
> E.g., in my binary, it gives me
>
> 00798020 D __pecoff_data_end
> 00798200 d __ksymtab_sort
> 00798208 B __bss_start
> 00798208 D _edata

this works too:

+++ b/arch/arm/boot/compressed/vmlinux.lds.S
@@ -70,10 +70,6 @@ SECTIONS
    .got                 : { *(.got) }
    _got_end = .;

-  /* ensure the zImage file size is always a multiple of 64 bits */
-  /* (without a dummy byte, ld just ignores the empty section) */
-  .pad                 : { BYTE(0); . = ALIGN(8); }
-
  #ifdef CONFIG_EFI_STUB
    .data : ALIGN(4096) {
      __pecoff_data_start = .;
@@ -93,7 +89,10 @@ SECTIONS
    __pecoff_data_rawsize = . - ADDR(.data);
  #endif

-  _edata = .;
+  /* ensure the zImage file size is always a multiple of 64 bits */
+  .edata : ALIGN(8) {
+    _edata = .;
+  }



    339: 006cf200     8 OBJECT  LOCAL  DEFAULT    9 __ksymtab_sort
...
    528: 006cf208     0 NOTYPE  GLOBAL DEFAULT    9 _edata



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ