summaryrefslogtreecommitdiffstats
path: root/sys/uvm/uvm_unix.c
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2003-02-18 18:50:54 +0000
committermickey <mickey@openbsd.org>2003-02-18 18:50:54 +0000
commit82a6945b11db7f9e802f8a04a22b39b023fd0c2f (patch)
treed7d074f47497a1f1b1ca075987940e49b517c7dd /sys/uvm/uvm_unix.c
parentmissed in lzs addition: allow LZS as an comp type (diff)
downloadwireguard-openbsd-82a6945b11db7f9e802f8a04a22b39b023fd0c2f.tar.xz
wireguard-openbsd-82a6945b11db7f9e802f8a04a22b39b023fd0c2f.zip
fix the way stack is written into the core file on the upward growing stack machines. the other case is not affected. miod@ deraadt@ ok
Diffstat (limited to 'sys/uvm/uvm_unix.c')
-rw-r--r--sys/uvm/uvm_unix.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index 50311c3b11b..6337a31f58a 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.24 2002/12/20 03:01:00 mickey Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.25 2003/02/18 18:50:54 mickey Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -188,13 +188,12 @@ uvm_coredump(p, vp, cred, chdr)
struct vmspace *vm = p->p_vmspace;
vm_map_t map = &vm->vm_map;
vm_map_entry_t entry;
- vaddr_t start, end, maxstack;
+ vaddr_t start, end;
struct coreseg cseg;
off_t offset;
int flag, error = 0;
offset = chdr->c_hdrsize + chdr->c_seghdrsize + chdr->c_cpusize;
- maxstack = trunc_page(USRSTACK - ctob(vm->vm_ssize));
for (entry = map->header.next; entry != &map->header;
entry = entry->next) {
@@ -218,14 +217,18 @@ uvm_coredump(p, vp, cred, chdr)
#ifdef MACHINE_STACK_GROWS_UP
if (start >= USRSTACK) {
+ end = round_page(USRSTACK + ctob(vm->vm_ssize));
+ if (start >= end)
+ continue;
start = USRSTACK;
#else
if (start >= (vaddr_t)vm->vm_maxsaddr) {
start = trunc_page(USRSTACK - ctob(vm->vm_ssize));
-#endif
- flag = CORE_STACK;
+
if (start >= end)
continue;
+#endif
+ flag = CORE_STACK;
} else
flag = CORE_DATA;