summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2014-04-25 14:37:06 +0000
committermlarkin <mlarkin@openbsd.org>2014-04-25 14:37:06 +0000
commitec527653e3c18ef7989803fe457b94c85d781ed3 (patch)
tree9055125b66775f81f307d33f714da84ffe51772e
parentFix a minor optimization i broke in bsd.lv rev. 1.163 on August 20, 2010: (diff)
downloadwireguard-openbsd-ec527653e3c18ef7989803fe457b94c85d781ed3.tar.xz
wireguard-openbsd-ec527653e3c18ef7989803fe457b94c85d781ed3.zip
Defer the free of the hibernate structures until later, when it is safe to
do so. Freeing the hibernate structures too early leads to inadvertent calls into splx when we aren't ready for them yet. Found when trapping splx calls in the resume path. discussed with deraadt@ at m2k14
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c9
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c9
-rw-r--r--sys/dev/acpi/acpi.c10
3 files changed, 11 insertions, 17 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index ec4be74cfa7..540469e52d5 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.59 2014/03/27 10:24:40 dlg Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.60 2014/04/25 14:37:06 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -327,13 +327,6 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
}
/* Resume path */
-#ifdef HIBERNATE
- if (state == ACPI_STATE_S4) {
- hibernate_free();
- uvm_pmr_dirty_everything();
- }
-#endif
-
/* Reset the vectors */
sc->sc_facs->wakeup_vector = 0;
if (sc->sc_facs->length > 32 && sc->sc_facs->version >= 1)
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index 2af0f10c6f3..fb803618f7e 100644
--- a/sys/arch/i386/i386/acpi_machdep.c
+++ b/sys/arch/i386/i386/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.52 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.53 2014/04/25 14:37:06 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -350,13 +350,6 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
}
/* Resume path */
-#ifdef HIBERNATE
- if (state == ACPI_STATE_S4) {
- hibernate_free();
- uvm_pmr_dirty_everything();
- }
-#endif
-
/* Reset the vectors */
sc->sc_facs->wakeup_vector = 0;
if (sc->sc_facs->length > 32 && sc->sc_facs->version >= 1)
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 759344b4b52..a045de8178b 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.256 2014/04/13 14:43:01 mlarkin Exp $ */
+/* $OpenBSD: acpi.c,v 1.257 2014/04/25 14:37:06 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -2202,6 +2202,14 @@ fail_quiesce:
acpi_record_event(sc, APM_NORMAL_RESUME);
acpi_indicator(sc, ACPI_SST_WORKING);
+
+#ifdef HIBERNATE
+ if (state == ACPI_STATE_S4) {
+ hibernate_free();
+ uvm_pmr_dirty_everything();
+ }
+#endif /* HIBERNATE */
+
fail_tts:
return (error);
}