| Summary: | mmap region with non zero offset is corrupted after madvise call | ||
|---|---|---|---|
| Product: | Base System | Reporter: | pha <pha> |
| Component: | i386 | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | pha |
| Priority: | Normal | ||
| Version: | 4.0-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
pha
2000-04-19 14:50:01 UTC
Paul, try this patch to /usr/src/sys/vm/vm_map.c and tell me if
it works. It appears to work for me when I test using your
test program.
-Matt
Matthew Dillon
<dillon@backplane.com>
Index: vm_map.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_map.c,v
retrieving revision 1.187
diff -u -r1.187 vm_map.c
--- vm_map.c 2000/02/28 04:10:35 1.187
+++ vm_map.c 2000/05/14 18:31:06
@@ -1127,15 +1127,19 @@
(current != &map->header) && (current->start < end);
current = current->next
) {
+ vm_offset_t useStart;
+
if (current->eflags & MAP_ENTRY_IS_SUB_MAP)
continue;
pindex = OFF_TO_IDX(current->offset);
count = atop(current->end - current->start);
+ useStart = current->start;
if (current->start < start) {
pindex += atop(start - current->start);
count -= atop(start - current->start);
+ useStart = start;
}
if (current->end > end)
count -= atop(current->end - end);
@@ -1148,7 +1152,7 @@
if (behav == MADV_WILLNEED) {
pmap_object_init_pt(
map->pmap,
- current->start,
+ useStart,
current->object.vm_object,
pindex,
(count << PAGE_SHIFT),
State Changed From-To: open->closed A fix is under test and will be committed ASAP. Hi, I was able to verify that installation of this fix appears to correct the madvise problem at my site on my machines, with my application as well. I have not done extensive testing of the overall system to see if for some reason it introduces anything new, but I doubt it will. Thank you very much, Matt, and anyone else who worked on fixing the problem! Great job! Paul On Sun, 14 May 2000, Matthew Dillon wrote: > Paul, try this patch to /usr/src/sys/vm/vm_map.c and tell me if > it works. It appears to work for me when I test using your > test program. > > -Matt > Matthew Dillon > <dillon@backplane.com> > > Index: vm_map.c > =================================================================== > RCS file: /home/ncvs/src/sys/vm/vm_map.c,v > retrieving revision 1.187 > diff -u -r1.187 vm_map.c > --- vm_map.c 2000/02/28 04:10:35 1.187 > +++ vm_map.c 2000/05/14 18:31:06 > @@ -1127,15 +1127,19 @@ > (current != &map->header) && (current->start < end); > current = current->next > ) { > + vm_offset_t useStart; > + > if (current->eflags & MAP_ENTRY_IS_SUB_MAP) > continue; > > pindex = OFF_TO_IDX(current->offset); > count = atop(current->end - current->start); > + useStart = current->start; > > if (current->start < start) { > pindex += atop(start - current->start); > count -= atop(start - current->start); > + useStart = start; > } > if (current->end > end) > count -= atop(current->end - end); > @@ -1148,7 +1152,7 @@ > if (behav == MADV_WILLNEED) { > pmap_object_init_pt( > map->pmap, > - current->start, > + useStart, > current->object.vm_object, > pindex, > (count << PAGE_SHIFT), > +---------------------------------------------------+ | Paul Anderson Public Data Queries, Inc. | | pha@pdq.com 734-213-4964 x308 | +---------------------------------------------------+ |