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]
Message-Id: <20071011074037.9C15C4D026B@magilla.localdomain>
Date:	Thu, 11 Oct 2007 00:40:37 -0700 (PDT)
From:	Roland McGrath <roland@...hat.com>
To:	"Andrew Morton <akpm@...ux-foundation.org>Andi Kleen" <ak@...e.de>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] x86_64 vDSO linker script cleanup

This replaces my earlier patch by the same title:
x86_64-vdso-linker-script-cleanup.patch


Thanks,
Roland

---

[PATCH] x86_64 vDSO linker script cleanup

This reorganizes the x86_64 vDSO layout to pack the contents better.
This yields a smaller image, while keeping code cache-aligned away
from data, and leaving more room to grow both in the .note section
(where --build-id can add some), and in the code (.text) section,
before the image grows past one 4kb page.

Signed-off-by: Roland McGrath <roland@...hat.com>
Cc: Andi Kleen <ak@...e.de>
---
 arch/x86_64/vdso/vdso.lds.S |   47 +++++++++++++++++++++++++++++-------------
 1 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/arch/x86_64/vdso/vdso.lds.S b/arch/x86_64/vdso/vdso.lds.S
index b9a60e6..726bc6d 100644
--- a/arch/x86_64/vdso/vdso.lds.S
+++ b/arch/x86_64/vdso/vdso.lds.S
@@ -20,30 +20,47 @@ SECTIONS
   .gnu.version_d  : { *(.gnu.version_d) }
   .gnu.version_r  : { *(.gnu.version_r) }
 
+  /* The kernel does not need to know these addresses,
+     so they don't need to be before VDSO_TEXT_OFFSET.
+     Pack these in here to sop up the space used for the alignment.  */
+  .note		  : { *(.note.*) }		:text :note
+  .useless        : {
+  	*(.got.plt) *(.got)
+	*(.gnu.linkonce.d.*)
+	*(.gnu.linkonce.b.*)
+  }						:text
+
   /* This linker script is used both with -r and with -shared.
      For the layouts to match, we need to skip more than enough
      space for the dynamic symbol table et al.  If this amount
-     is insufficient, ld -shared will barf.  Just increase it here.  */
+     is insufficient, ld -shared will barf.
+     Just increase VDSO_TEXT_OFFSET (in voffset.h).  */
   . = VDSO_PRELINK + VDSO_TEXT_OFFSET;
 
-  .text           : { *(.text) }		:text
-  .text.ptr       : { *(.text.ptr) }		:text
-  . = VDSO_PRELINK + 0x900;
-  .data           : { *(.data) }		:text
-  .bss            : { *(.bss) }			:text
+  .rodata         : { *(.rodata*) }		:text
+  .data		  : {
+	*(.data*)
+	*(.sdata*)
+	*(.bss*)
+	*(.dynbss*)
+  }						:text
 
-  .altinstructions : { *(.altinstructions) }			:text
-  .altinstr_replacement  : { *(.altinstr_replacement) }	:text
+  .dynamic        : { *(.dynamic) }		:text :dynamic
 
-  .note		  : { *(.note.*) }		:text :note
   .eh_frame_hdr   : { *(.eh_frame_hdr) }	:text :eh_frame_hdr
   .eh_frame       : { KEEP (*(.eh_frame)) }	:text
-  .dynamic        : { *(.dynamic) }		:text :dynamic
-  .useless        : {
-  	*(.got.plt) *(.got)
-	*(.gnu.linkonce.d.*)
-	*(.dynbss)
-	*(.gnu.linkonce.b.*)
+
+  .altinstructions : { *(.altinstructions) }		:text
+  .altinstr_replacement  : { *(.altinstr_replacement) }	:text
+
+  /* Separate actual executed code from other data for happy caches.  */
+  . = ALIGN(128);
+
+  .text           : {
+  	FILL(0x90909090);
+	*(.text .stub .text.* .gnu.linkonce.t.*)
+    	KEEP (*(.text.*personality*))
+  	. = ALIGN(128);
   }						:text
 }
 
-
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