summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_hibernate.c
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2018-06-21 07:49:13 +0000
committermlarkin <mlarkin@openbsd.org>2018-06-21 07:49:13 +0000
commita552a180a403f7b107a1582c8100d432aa87fb14 (patch)
tree33a3a60c2fed619c5886269024a9d71dd31e0466 /sys/kern/subr_hibernate.c
parentGrab the KERNEL_LOCK() rather than asserting that it is held. (diff)
downloadwireguard-openbsd-a552a180a403f7b107a1582c8100d432aa87fb14.tar.xz
wireguard-openbsd-a552a180a403f7b107a1582c8100d432aa87fb14.zip
don't let the retguard skip region exceed the space we have reserved for
it in the piglet during unhibernate. Missed this block during the previous commit. We'll panic, which will likely just reboot the machine, but that's better than trashing a chunk and causing mystery errors later.
Diffstat (limited to 'sys/kern/subr_hibernate.c')
-rw-r--r--sys/kern/subr_hibernate.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index 05dec26e810..bcae1db1eaa 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.124 2018/06/21 07:33:30 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.125 2018/06/21 07:49:13 mlarkin Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -807,6 +807,15 @@ hibernate_inflate_region(union hibernate_info *hib, paddr_t dest,
hib->piglet_pa + (110 * PAGE_SIZE) +
hib->retguard_ofs, 0);
hib->retguard_ofs += PAGE_SIZE;
+ if (hib->retguard_ofs > 255 * PAGE_SIZE) {
+ /*
+ * XXX - this will likely reboot/hang most
+ * machines since the console output
+ * buffer will be unmapped, but there's
+ * not much else we can do here.
+ */
+ panic("retguard move error, out of space");
+ }
} else {
hibernate_enter_resume_mapping(
HIBERNATE_INFLATE_PAGE, dest, 0);