> Date: Sat, 23 Feb 2008 13:58:55 +0000
> From: Alexander Nasonov <[EMAIL PROTECTED]>
>
> Hi,
> If I set a core limit to "unlimited" and a stack limit to 32768,
> then run a program with indefinite recursion, the system would
> generate 8G coredump file.
Does the attached diff fix your problem?
Index: uvm_unix.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_unix.c,v
retrieving revision 1.32
diff -u -p -r1.32 uvm_unix.c
--- uvm_unix.c 5 Jan 2008 00:36:13 -0000 1.32
+++ uvm_unix.c 25 Feb 2008 21:15:10 -0000
@@ -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;