diff options
author | 2020-02-19 16:55:04 +0000 | |
---|---|---|
committer | 2020-02-19 16:55:04 +0000 | |
commit | 4cffaa08f4cca192545e7da30b8d78fc6cb884a8 (patch) | |
tree | 03f45b866f99c89073a3248835fc7870f25904bb | |
parent | A few fixes to make modifier keys and dragging work - need to remove the (diff) | |
download | wireguard-openbsd-4cffaa08f4cca192545e7da30b8d78fc6cb884a8.tar.xz wireguard-openbsd-4cffaa08f4cca192545e7da30b8d78fc6cb884a8.zip |
Make sure the first 2MB page of the kernel is actually mapped RO in the
direct map by using a properly aligned address. To prevent further
confusion, remove __kernel_base_phys from the linker script and rename
__kernel_end_phys into __kernel_phys_end.
Hinted at by Maxime Villard.
ok millert@, deraadt@, mpi@
-rw-r--r-- | sys/arch/amd64/amd64/locore0.S | 6 | ||||
-rw-r--r-- | sys/arch/amd64/conf/ld.script | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/locore0.S b/sys/arch/amd64/amd64/locore0.S index 62d31e89917..9699385dbf2 100644 --- a/sys/arch/amd64/amd64/locore0.S +++ b/sys/arch/amd64/amd64/locore0.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore0.S,v 1.18 2020/01/24 05:27:31 kettenis Exp $ */ +/* $OpenBSD: locore0.S,v 1.19 2020/02/19 16:55:04 kettenis Exp $ */ /* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */ /* @@ -511,9 +511,9 @@ map_tables: movl $(NDML2_ENTRIES * NPDPG), %ecx 1: orl $(PG_V|PG_KW|PG_PS), %eax orl RELOC(pg_g_kern), %eax - cmpl $__kernel_base_phys, %eax + cmpl $__kernel_phys_base, %eax jl store_pte - cmpl $__kernel_end_phys, %eax + cmpl $__kernel_phys_end, %eax jg store_pte andl $(~PG_KW), %eax store_pte: diff --git a/sys/arch/amd64/conf/ld.script b/sys/arch/amd64/conf/ld.script index 418eb5ba533..bc7ce33756e 100644 --- a/sys/arch/amd64/conf/ld.script +++ b/sys/arch/amd64/conf/ld.script @@ -1,4 +1,4 @@ -/* $OpenBSD: ld.script,v 1.15 2019/11/09 20:07:00 guenther Exp $ */ +/* $OpenBSD: ld.script,v 1.16 2020/02/19 16:55:04 kettenis Exp $ */ /* * Copyright (c) 2009 Tobias Weingartner <weingart@tepid.org> @@ -40,13 +40,13 @@ __ALIGN_SIZE = 0x1000; __kernel_base = 0xffffffff80000000; __kernel_virt_base = __kernel_base + 0x1000000; __kernel_phys_base = 0x1000000; -__kernel_base_phys = __kernel_phys_base + SIZEOF_HEADERS; __kernel_virt_to_phys = __kernel_phys_base - __kernel_virt_base; ENTRY(start) SECTIONS { - .text (__kernel_virt_base + SIZEOF_HEADERS) : AT (__kernel_base_phys) + .text (__kernel_virt_base + SIZEOF_HEADERS) : + AT (__kernel_phys_base + SIZEOF_HEADERS) { start = .; locore0.o(.text) @@ -148,7 +148,7 @@ SECTIONS . = ALIGN(0x200000); _end = .; PROVIDE (end = .); - __kernel_end_phys = . + __kernel_virt_to_phys; + __kernel_phys_end = . + __kernel_virt_to_phys; /* XXX - hack alert, since we are not C++, nuke these */ /DISCARD/ : |