* mmap.cc (msync): Check area given by addr and len for being a
contigeous mmap'd region.
This commit is contained in:
parent
af53a09c70
commit
2817e0dc89
|
@ -1,3 +1,8 @@
|
|||
2002-03-11 Corinna Vinschen <corina@vinschen.de>
|
||||
|
||||
* mmap.cc (msync): Check area given by addr and len for being a
|
||||
contigeous mmap'd region.
|
||||
|
||||
2002-03-11 Corinna Vinschen <corina@vinschen.de>
|
||||
|
||||
* fork.cc (fork_child): Call fixup_mmaps_after_fork() before
|
||||
|
|
|
@ -674,8 +674,12 @@ msync (caddr_t addr, size_t len, int flags)
|
|||
for (int li = 0; li < l->nrecs; ++li)
|
||||
{
|
||||
mmap_record *rec = l->recs + li;
|
||||
if (rec->get_address () == addr)
|
||||
if (rec->access (addr))
|
||||
{
|
||||
/* Check whole area given by len. */
|
||||
for (DWORD i = getpagesize (); i < len; ++i)
|
||||
if (!rec->access (addr + i))
|
||||
goto invalid_address_range;
|
||||
fhandler_base *fh = rec->alloc_fh ();
|
||||
int ret = fh->msync (rec->get_handle (), addr, len, flags);
|
||||
rec->free_fh (fh);
|
||||
|
@ -692,6 +696,7 @@ msync (caddr_t addr, size_t len, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
invalid_address_range:
|
||||
/* SUSv2: Return code if indicated memory was not mapped is ENOMEM. */
|
||||
set_errno (ENOMEM);
|
||||
syscall_printf ("-1 = msync(): ENOMEM");
|
||||
|
|
Loading…
Reference in New Issue