summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-07-09 09:47:43 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-07-09 09:47:43 +0000
commitbf74915ff70bba0b9075646f992943c92e466576 (patch)
tree7f7289f6bacfb50a53c7259d57ec5545c92a4a9a /sys
parentf12b70bf17e6f642855f864ea1f5a9f3468c2fa2 (diff)
DVACT_SUSPEND must be done at cold with interrupts disabled. Failure
to read a hibernate image should restore the spl ok mlarkin
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_hibernate.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index 673df70751b..388c2d8ba9e 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.39 2012/07/08 21:11:49 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.40 2012/07/09 09:47:42 deraadt Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -1102,10 +1102,10 @@ hibernate_resume(void)
* If on-disk and in-memory hibernate signatures match,
* this means we should do a resume from hibernate.
*/
- if (hibernate_compare_signature(&hiber_info, &disk_hiber_info))
+ if (hibernate_compare_signature(&hiber_info, &disk_hiber_info)) {
+ splx(s);
return;
-
- uvm_pmr_zero_everything();
+ }
/* Read the image from disk into the image (pig) area */
if (hibernate_read_image(&disk_hiber_info))
@@ -1114,15 +1114,20 @@ hibernate_resume(void)
if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_QUIESCE) != 0)
goto fail;
- if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND) != 0)
+ (void) splhigh();
+ disable_intr();
+ cold = 1;
+
+ if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND) != 0) {
+ cold = 0;
+ enable_intr();
goto fail;
+ }
/* Point of no return ... */
- disable_intr();
- cold = 1;
-
- pmap_kenter_pa(HIBERNATE_HIBALLOC_PAGE, HIBERNATE_HIBALLOC_PAGE, VM_PROT_ALL);
+ pmap_kenter_pa(HIBERNATE_HIBALLOC_PAGE, HIBERNATE_HIBALLOC_PAGE,
+ VM_PROT_ALL);
pmap_activate(curproc);
/* Switch stacks */
@@ -1144,6 +1149,7 @@ hibernate_resume(void)
hibernate_resume_machdep();
fail:
+ splx(s);
printf("Unable to resume hibernated image\n");
}