summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2016-05-16 01:19:28 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2016-05-16 01:19:28 +0000
commitedf8efab5fa26c4bc105d8c6e9805a7b7156e014 (patch)
treef6fcae4bc68cafa593fee4b120c0a869e29e7d30
parentaa94d813ac15b199cd5c03e8d728522b43e8c562 (diff)
Use int3 padding instead of nop in the ACPI resume trampoline, as it is
certain no intentional nop sled is required here. ok deraadt@
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c7
-rw-r--r--sys/arch/amd64/amd64/acpi_wakecode.S34
-rw-r--r--sys/arch/i386/i386/acpi_wakecode.S22
3 files changed, 34 insertions, 29 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index ac620bfec54..f6885b292a7 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.72 2016/01/10 16:59:42 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.73 2016/05/16 01:19:27 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -297,6 +297,11 @@ acpi_attach_machdep(struct acpi_softc *sc)
pmap_kenter_pa(ACPI_TRAMP_DATA, ACPI_TRAMP_DATA,
PROT_READ | PROT_WRITE);
+ /* Fill the trampoline pages with int3 */
+ memset((caddr_t)ACPI_TRAMPOLINE, 0xcc, PAGE_SIZE);
+ memset((caddr_t)ACPI_TRAMP_DATA, 0xcc, PAGE_SIZE);
+
+ /* Copy over real trampoline pages (code and data) */
memcpy((caddr_t)ACPI_TRAMPOLINE, acpi_real_mode_resume,
acpi_resume_end - acpi_real_mode_resume);
memcpy((caddr_t)ACPI_TRAMP_DATA, acpi_tramp_data_start,
diff --git a/sys/arch/amd64/amd64/acpi_wakecode.S b/sys/arch/amd64/amd64/acpi_wakecode.S
index 68fe65b83af..7823861205b 100644
--- a/sys/arch/amd64/amd64/acpi_wakecode.S
+++ b/sys/arch/amd64/amd64/acpi_wakecode.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_wakecode.S,v 1.37 2015/09/11 14:26:12 sf Exp $ */
+/* $OpenBSD: acpi_wakecode.S,v 1.38 2016/05/16 01:19:27 mlarkin Exp $ */
/*
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
* Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
@@ -84,7 +84,7 @@
*/
.text
.code16
- .align 4
+ .align 4, 0xcc
.global _C_LABEL(acpi_real_mode_resume)
.global _C_LABEL(acpi_protected_mode_resume)
.global _C_LABEL(acpi_long_mode_resume)
@@ -157,7 +157,7 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
ljmpl $0x8, $acpi_protected_mode_trampoline
.code32
- .align 16
+ .align 16, 0xcc
_ACPI_TRMP_LABEL(acpi_protected_mode_trampoline)
_C_LABEL(acpi_protected_mode_resume):
nop
@@ -225,7 +225,7 @@ _C_LABEL(acpi_protected_mode_resume):
ljmp $0x8, $acpi_long_mode_trampoline
.code64
- .align 16
+ .align 16, 0xcc
_ACPI_TRMP_LABEL(acpi_long_mode_trampoline)
_C_LABEL(acpi_long_mode_resume):
@@ -479,7 +479,7 @@ _ACPI_TRMP_DATA_OFFSET(tmp_gdt)
.word tmp_gdt_end - tmp_gdtable
.long tmp_gdtable
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(tmp_gdtable)
/*
* null
@@ -519,30 +519,30 @@ _ACPI_TRMP_DATA_LABEL(tmp_gdtable)
.byte 0, 0x93, 0xcf, 0
_ACPI_TRMP_DATA_LABEL(tmp_gdt_end)
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_OFFSET(clean_idt)
.word 0xffff
.long 0
.word 0
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(tmp_gdt64)
.word tmp_gdt64_end - tmp_gdtable64
.long tmp_gdtable64
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(tmp_gdtable64)
.quad 0x0000000000000000
.quad 0x00af9a000000ffff
.quad 0x00cf92000000ffff
_ACPI_TRMP_DATA_LABEL(tmp_gdt64_end)
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(tmp_gdt6416)
.word tmp_gdt6416_end - tmp_gdtable6416
.quad tmp_gdtable6416
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(tmp_gdtable6416)
.quad 0x0000000000000000
.quad 0x00af9a000000ffff
@@ -551,7 +551,7 @@ _ACPI_TRMP_DATA_LABEL(tmp_gdtable6416)
.byte (ACPI_TRAMPOLINE >> 16), 0x9a, 0, 0
_ACPI_TRMP_DATA_LABEL(tmp_gdt6416_end)
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(acpi_saved_rbx)
.quad 0
_ACPI_TRMP_DATA_LABEL(acpi_saved_rcx)
@@ -597,26 +597,26 @@ _ACPI_TRMP_DATA_LABEL(acpi_saved_cr8)
_ACPI_TRMP_DATA_LABEL(acpi_saved_ret)
.quad 0
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(acpi_saved_idt)
.space 10
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(acpi_saved_gdt)
.space 10
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(acpi_saved_ldt)
.space 10
_ACPI_TRMP_DATA_LABEL(acpi_saved_tr)
.short 0
- .align 4
+ .align 4, 0xcc
_ACPI_TRMP_DATA_LABEL(acpi_saved_efer)
.long 0
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_DATA_LABEL(acpi_saved_fsbase)
.quad 0
_ACPI_TRMP_DATA_LABEL(acpi_saved_gsbase)
@@ -636,7 +636,7 @@ _ACPI_TRMP_DATA_LABEL(acpi_saved_apicbase)
.quad 0
#endif
- .align 4
+ .align 4, 0xcc
_ACPI_TRMP_DATA_LABEL(acpi_pdirpa)
.long 0
#ifdef HIBERNATE
diff --git a/sys/arch/i386/i386/acpi_wakecode.S b/sys/arch/i386/i386/acpi_wakecode.S
index 5cd7170b607..ae21ed92fec 100644
--- a/sys/arch/i386/i386/acpi_wakecode.S
+++ b/sys/arch/i386/i386/acpi_wakecode.S
@@ -81,7 +81,7 @@
.text
.code16
- .align 4
+ .align 4, 0xcc
.global _C_LABEL(acpi_real_mode_resume)
.global _C_LABEL(acpi_protected_mode_resume)
.global _C_LABEL(acpi_resume_end)
@@ -159,7 +159,7 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
ljmpl $0x8, $acpi_protected_mode_trampoline
.code32
- .align 16
+ .align 16, 0xcc
_ACPI_TRMP_LABEL(acpi_protected_mode_trampoline)
_C_LABEL(acpi_protected_mode_resume):
nop
@@ -401,12 +401,12 @@ NENTRY(hibernate_flush)
#endif /* HIBERNATE */
.code16
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_OFFSET(tmp_gdt)
.word tmp_gdt_end - tmp_gdtable
.long tmp_gdtable
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_LABEL(tmp_gdtable)
/*
* null
@@ -446,7 +446,7 @@ _ACPI_TRMP_LABEL(tmp_gdtable)
.byte 0, 0x93, 0xcf, 0
_ACPI_TRMP_LABEL(tmp_gdt_end)
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_OFFSET(clean_idt)
.word 0xffff
.long 0
@@ -456,12 +456,12 @@ _ACPI_TRMP_OFFSET(clean_idt)
* gdt_16 is the gdt used when returning to real mode for bios
* reads/writes (sets up a 16 bit segment)
*/
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_LABEL(gdt_16)
.word gdt_16_end - gdt_16_table
.long gdt_16_table
- .align 8
+ .align 8, 0xcc
_ACPI_TRMP_LABEL(gdt_16_table)
/*
* null
@@ -502,7 +502,7 @@ _ACPI_TRMP_LABEL(gdt_16_table)
_ACPI_TRMP_LABEL(gdt_16_end)
- .align 4
+ .align 4, 0xcc
_ACPI_TRMP_LABEL(acpi_saved_ebx)
.long 0
_ACPI_TRMP_LABEL(acpi_saved_ecx)
@@ -530,15 +530,15 @@ _ACPI_TRMP_LABEL(acpi_saved_cr4)
_ACPI_TRMP_LABEL(acpi_saved_ret)
.long 0
- .align 16
+ .align 16, 0xcc
_ACPI_TRMP_LABEL(acpi_saved_idt)
.space 6
- .align 16
+ .align 16, 0xcc
_ACPI_TRMP_LABEL(acpi_saved_gdt)
.space 6
- .align 16
+ .align 16, 0xcc
_ACPI_TRMP_LABEL(acpi_saved_ldt)
.short 0
_ACPI_TRMP_LABEL(acpi_saved_cs)