Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/conf Split each kernel section into sub-block...
details: https://anonhg.NetBSD.org/src/rev/9faaab1271e1
branches: trunk
changeset: 357535:9faaab1271e1
user: maxv <maxv%NetBSD.org@localhost>
date: Tue Nov 14 10:15:40 2017 +0000
description:
Split each kernel section into sub-blocks of approximately 2MB. The newly
created sections are named .origname.i, for example:
.text -> { .text .text.0 .text.1 .text.2 .text.3 .text.4 }
Each section is randomized independently by the prekern - and in a random
order obviously. As a result we can get intertwined mappings, of the type:
+-------+-----------+------+---------+-----------+-------+-------+------+-
| text1 | NOTMAPPED | bss0 | rodata1 | NOTMAPPED | data2 | text3 | bss1 |
+-------+-----------+------+---------+-----------+-------+-------+------+-
---------+-
rodata0 | ...
---------+-
The CTF section is dropped completely, because (a) when split it becomes
enormous for some reason (that I don't quite understand, verily), and (b)
the kernel expects only one CTF and can't handle several of them.
diffstat:
sys/arch/amd64/conf/Makefile.amd64 | 4 ++--
sys/arch/amd64/conf/kern.ldscript.kaslr | 8 +++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r 810f3bcbf3f0 -r 9faaab1271e1 sys/arch/amd64/conf/Makefile.amd64
--- a/sys/arch/amd64/conf/Makefile.amd64 Tue Nov 14 09:56:26 2017 +0000
+++ b/sys/arch/amd64/conf/Makefile.amd64 Tue Nov 14 10:15:40 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.amd64,v 1.62 2017/11/14 09:56:26 maxv Exp $
+# $NetBSD: Makefile.amd64,v 1.63 2017/11/14 10:15:40 maxv Exp $
# Makefile for NetBSD
#
@@ -62,7 +62,7 @@
##
TEXTADDR?= 0xffffffff80200000
.if defined(KASLR)
-EXTRA_LINKFLAGS= -r -d
+EXTRA_LINKFLAGS= --split-by-file=0x200000 -r -d
KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
.else
EXTRA_LINKFLAGS= -z max-page-size=0x200000
diff -r 810f3bcbf3f0 -r 9faaab1271e1 sys/arch/amd64/conf/kern.ldscript.kaslr
--- a/sys/arch/amd64/conf/kern.ldscript.kaslr Tue Nov 14 09:56:26 2017 +0000
+++ b/sys/arch/amd64/conf/kern.ldscript.kaslr Tue Nov 14 10:15:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern.ldscript.kaslr,v 1.2 2017/11/13 20:01:48 maxv Exp $ */
+/* $NetBSD: kern.ldscript.kaslr,v 1.3 2017/11/14 10:15:40 maxv Exp $ */
#include "assym.h"
@@ -57,4 +57,10 @@
{
KEEP(*(.note.netbsd.ident));
}
+
+ /DISCARD/ :
+ {
+ *(.SUNW_ctf)
+ *(.SUNW_ctf.*)
+ }
}
Home |
Main Index |
Thread Index |
Old Index