Fix two bugs introduced with the rstack functionality and specific to

the rstack functionality:
1. Fix a KASSERT that tests for the address to be above the upward
   growable stack. Typically for rstack, the faulting address can be
   identical to the record end of the upward growable entry, and
   very likely is on ia64. The KASSERT tested for greater than, not
   greater equal, so whenever the register stack had to be grown
   the assertion fired.
2. When we grow the upward growable stack entry and adjust the
   unlying object, don't forget to adjust the size of the VM map.
   Not doing so would trigger an assert in vm_mapzdtor().

Pointy hat: marcel (for not testing with INVARIANTS).
This commit is contained in:
marcel 2003-10-31 07:29:28 +00:00
parent a8e2bc1bfd
commit 85f7e242fb

View File

@ -2681,7 +2681,7 @@ vm_map_growstack(struct proc *p, vm_offset_t addr)
max_grow = stack_entry->start - end;
} else {
KASSERT(stack_entry->eflags & MAP_ENTRY_GROWS_UP, ("foo"));
KASSERT(addr > stack_entry->end, ("foo"));
KASSERT(addr >= stack_entry->end, ("foo"));
end = (next_entry != &map->header) ? next_entry->start :
stack_entry->end + stack_entry->avail_ssize;
grow_amount = roundup(addr + 1 - stack_entry->end, PAGE_SIZE);
@ -2800,6 +2800,7 @@ vm_map_growstack(struct proc *p, vm_offset_t addr)
OFF_TO_IDX(stack_entry->offset),
(vm_size_t)(stack_entry->end - stack_entry->start),
(vm_size_t)grow_amount)) {
map->size += (addr - stack_entry->end);
/* Update the current entry. */
stack_entry->end = addr;
rv = KERN_SUCCESS;