diff options
author | 2014-07-09 12:43:51 +0000 | |
---|---|---|
committer | 2014-07-09 12:43:51 +0000 | |
commit | bd831450ecfa352a2566676139bdad6cd231d422 (patch) | |
tree | 4c134337665912dcb0788b3d0b521f4d97809843 | |
parent | expire IPcomp SAs too; ok mikeb (some time ago) (diff) | |
download | wireguard-openbsd-bd831450ecfa352a2566676139bdad6cd231d422.tar.xz wireguard-openbsd-bd831450ecfa352a2566676139bdad6cd231d422.zip |
Use suspending kernel's stack smash guard to avoid panicing during unpack.
ok deraadt@
-rw-r--r-- | sys/kern/subr_hibernate.c | 16 | ||||
-rw-r--r-- | sys/sys/hibernate.h | 5 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index 375720be0b6..c5f8879d50b 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_hibernate.c,v 1.92 2014/05/31 04:36:59 mlarkin Exp $ */ +/* $OpenBSD: subr_hibernate.c,v 1.93 2014/07/09 12:43:51 mlarkin Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -77,6 +77,10 @@ int hib_debug = 99; #define DNPRINTF(n,x...) #endif +#ifndef NO_PROPOLICE +extern long __guard_local; +#endif /* ! NO_PROPOLICE */ + void hibernate_copy_chunk_to_piglet(paddr_t, vaddr_t, size_t); /* @@ -643,6 +647,11 @@ get_hibernate_info(union hibernate_info *hib, int suspend) struct disklabel dl; char err_string[128], *dl_ret; +#ifndef NO_PROPOLICE + /* Save propolice guard */ + hib->guard = __guard_local; +#endif /* ! NO_PROPOLICE */ + /* Determine I/O function to use */ hib->io_func = get_hibernate_io_function(); if (hib->io_func == NULL) @@ -1175,6 +1184,11 @@ hibernate_resume(void) /* Switch stacks */ hibernate_switch_stack_machdep(); +#ifndef NO_PROPOLICE + /* Start using suspended kernel's propolice guard */ + __guard_local = disk_hib.guard; +#endif /* ! NO_PROPOLICE */ + /* Unpack and resume */ hibernate_unpack_image(&disk_hib); diff --git a/sys/sys/hibernate.h b/sys/sys/hibernate.h index e49dbea95a1..0ff5c1470f6 100644 --- a/sys/sys/hibernate.h +++ b/sys/sys/hibernate.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hibernate.h,v 1.30 2013/11/09 06:54:00 mlarkin Exp $ */ +/* $OpenBSD: hibernate.h,v 1.31 2014/07/09 12:43:51 mlarkin Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -95,6 +95,9 @@ union hibernate_info { char kernel_version[128]; hibio_fn io_func; void *io_page; +#ifndef NO_PROPOLICE + long guard; +#endif /* ! NO_PROPOLICE */ }; /* XXX - remove restriction to have this union fit in a single block */ |