summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-02-27 21:46:35 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-02-27 21:46:35 +0000
commit3d3b75f61b57504b71451e352de59d6ff8ffd6a4 (patch)
treeaa67cddd2071a9889c25893dca5e26f7fd5e8e16
parent9f90d65a0fbf0bc1e0d988b66dbae20ffedfa5a4 (diff)
Don't dump duplicate data in stack segments of core dumps when the stack
memory map is fragmented. Avoids ridiculously large core dumps. ok miod@
-rw-r--r--sys/uvm/uvm_unix.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index b81d7aa8958..b4027953956 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.32 2008/01/05 00:36:13 miod Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.33 2008/02/27 21:46:34 kettenis Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -166,7 +166,7 @@ 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;
+ vaddr_t start, end, top;
struct coreseg cseg;
off_t offset;
int flag, error = 0;
@@ -202,13 +202,17 @@ uvm_coredump(p, vp, cred, chdr)
#ifdef MACHINE_STACK_GROWS_UP
if (USRSTACK <= start && start < (USRSTACK + MAXSSIZ)) {
- end = round_page(USRSTACK + ptoa(vm->vm_ssize));
+ top = round_page(USRSTACK + ptoa(vm->vm_ssize));
+ if (end > top)
+ end = top;
+
if (start >= end)
continue;
- start = USRSTACK;
#else
if (start >= (vaddr_t)vm->vm_maxsaddr) {
- start = trunc_page(USRSTACK - ptoa(vm->vm_ssize));
+ top = trunc_page(USRSTACK - ptoa(vm->vm_ssize));
+ if (start < top)
+ start = top;
if (start >= end)
continue;