Module Name:    src
Committed By:   maxv
Date:           Sun Jun 24 18:24:54 UTC 2018

Modified Files:
        src/sys/arch/amd64/conf: kern.ldscript.Xen
        src/sys/arch/i386/conf: kern.ldscript kern.ldscript.Xen

Log Message:
Sync the ld scripts:

 * Force a PAGE_SIZE alignment of .bss on i386. Normally that's not
   required since the bootloader ensures page alignment, but let's be
   safe. Same on Xen-i386.

 * Fill the .text section padding with int3 instructions on Xen kernels,
   to prevent FALLTHROUGHs if a pointer goes crazy, same as native.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/conf/kern.ldscript.Xen
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/conf/kern.ldscript
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/conf/kern.ldscript.Xen

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/conf/kern.ldscript.Xen
diff -u src/sys/arch/amd64/conf/kern.ldscript.Xen:1.15 src/sys/arch/amd64/conf/kern.ldscript.Xen:1.16
--- src/sys/arch/amd64/conf/kern.ldscript.Xen:1.15	Sun Jun 24 17:11:57 2018
+++ src/sys/arch/amd64/conf/kern.ldscript.Xen	Sun Jun 24 18:24:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript.Xen,v 1.15 2018/06/24 17:11:57 jdolecek Exp $	*/
+/*	$NetBSD: kern.ldscript.Xen,v 1.16 2018/06/24 18:24:53 maxv Exp $	*/
 
 #include "assym.h"
 
@@ -7,12 +7,13 @@ __PAGE_SIZE = 0x1000 ;
 ENTRY(_start)
 SECTIONS
 {
-	.text :
+	.text : AT (ADDR(.text))
 	{
 		*(.text)
 		*(.text.*)
 		*(.stub)
-	}
+		. = ALIGN(__PAGE_SIZE);
+	} =0xCC
 	_etext = . ;
 	PROVIDE (etext = .) ;
 
@@ -77,11 +78,3 @@ SECTIONS
 	}
 }
 
-SECTIONS
-{
-	.text :
-	AT (ADDR(.text))
-	{
-		*(.text)
-	} = 0
-}

Index: src/sys/arch/i386/conf/kern.ldscript
diff -u src/sys/arch/i386/conf/kern.ldscript:1.21 src/sys/arch/i386/conf/kern.ldscript:1.22
--- src/sys/arch/i386/conf/kern.ldscript:1.21	Sun Jan  7 12:42:47 2018
+++ src/sys/arch/i386/conf/kern.ldscript	Sun Jun 24 18:24:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript,v 1.21 2018/01/07 12:42:47 maxv Exp $	*/
+/*	$NetBSD: kern.ldscript,v 1.22 2018/06/24 18:24:53 maxv Exp $	*/
 
 #include "assym.h"
 
@@ -62,7 +62,7 @@ SECTIONS
 		*(.bss)
 		*(.bss.*)
 		*(COMMON)
-		. = ALIGN(32 / 8);
+		. = ALIGN(__PAGE_SIZE);
 	}
 
 	. = ALIGN(__PAGE_SIZE);

Index: src/sys/arch/i386/conf/kern.ldscript.Xen
diff -u src/sys/arch/i386/conf/kern.ldscript.Xen:1.15 src/sys/arch/i386/conf/kern.ldscript.Xen:1.16
--- src/sys/arch/i386/conf/kern.ldscript.Xen:1.15	Sun Jan  7 12:42:47 2018
+++ src/sys/arch/i386/conf/kern.ldscript.Xen	Sun Jun 24 18:24:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript.Xen,v 1.15 2018/01/07 12:42:47 maxv Exp $	*/
+/*	$NetBSD: kern.ldscript.Xen,v 1.16 2018/06/24 18:24:53 maxv Exp $	*/
 
 #include "assym.h"
 
@@ -6,12 +6,13 @@ __PAGE_SIZE = 0x1000 ;
 
 SECTIONS
 {
-	.text :
+	.text : AT (ADDR(.text))
 	{
 		*(.text)
 		*(.text.*)
 		*(.stub)
-	}
+		. = ALIGN(__PAGE_SIZE);
+	} =0xCC
 	_etext = . ;
 	PROVIDE (etext = .) ;
 
@@ -60,28 +61,19 @@ SECTIONS
 		*(.bss)
 		*(.bss.*)
 		*(COMMON)
-		. = ALIGN(32 / 8);
+		. = ALIGN(__PAGE_SIZE);
 	}
-	. = ALIGN(32 / 8);
-	_end = . ;
-	PROVIDE (end = .) ;
 
 	. = ALIGN(__PAGE_SIZE);
 
 	/* End of the kernel image */
 	__kernel_end = . ;
 
+	_end = . ;
+	PROVIDE (end = .) ;
 	.note.netbsd.ident :
 	{
 		KEEP(*(.note.netbsd.ident));
 	}
 }
 
-SECTIONS
-{
-	.text :
-	AT (ADDR(.text))
-	{
-		*(.text)
-	} = 0
-}

Reply via email to