This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.7.0 CVS mmap failure


(warning a bunch of strace, scroll wide).

So I haven't been able to totally nail anything down on this issue due
to the incredible complexity of Cygwin's mmap interface.

This is 2 simple mmap()s in succession, 1st is 46121 bytes, 2nd is 111 bytes.
Both opened read/write. The second mmap always fails. This is the current
snapshot code.

In the 2nd strace, I changed the mmap logic to stop trying to align the 1st
map on a 4k granularity boundary and just allocate a single map w/ 64k of
left over dead space (what I would typically expect in posix land). I also
added more debug info at various stages to try and figure things out. When
changing it to use 64k period, the mmaps are both successful - which is good,
but VirtualProtect always fails, no matter what, on unmap.

1st strace
----
  130 5635179 [unknown (0x22C0)] iswcs 14132 mmap64: fh == 1628914712, addr == 0x0, len == 46121, off == 0, prot == 0, flags == 3, fd == 1
   29 5635208 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: fhdl == 3442792, name == 0x611744B0, len == 46121, off == 0, prot == 0, flags == 3
   43 5635251 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: h == 3443708, name == 0x611744B0, len == 46121, off == 0, prot == 0, flags == 3
   54 5635305 [unknown (0x22C0)] iswcs 14132 MapViewNT: 7FB40000 = NtMapViewOfSection (h:348BFC, addr:0, len:46121, off:0, protect:40, type:0)
  128 5635787 [unknown (0x22C0)] iswcs 14132 mmap64: fh == 1628914712, addr == 0x0, len == 49152, off == 0, prot == 0, flags == 3, fd == 1, orig_len == 12
   29 5635816 [unknown (0x22C0)] iswcs 14132 mmap64: orig_len == 16384, len == 49152, pagesize == 65536, valid_page_len == 16384, sigbus_page_len == 0, at_base == 0x7FB4C000
   30 5635846 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: fhdl == 4294967295, name == 0x61174660, len == 16384, off == 0, prot == 0, flags == 67108867
   33 5635879 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: h == 3443812, name == 0x61174660, len == 16384, off == 0, prot == 0, flags == 67108867
   49 5635928 [unknown (0x22C0)] iswcs 14132 MapViewNT: 7FB4C000 = NtMapViewOfSection (h:348C64, addr:7FB4C000, len:16384, off:0, protect:40, type:0)
   55 5635983 [unknown (0x22C0)] iswcs 14132 mmap64: orig_len == 16384, len == 49152, pagesize == 65536, valid_page_len == 16384, sigbus_page_len == 0, at_base == 0x7FB50000
 2361 5638344 [unknown (0x22C0)] iswcs 14132 mmap_record::unmap_pages: addr == 0x7FB4C000, len == 65536, off == 0
   43 5638387 [unknown (0x22C0)] iswcs 14132 mmap_record::unmap_pages: VirtualProtect in unmap_pages () failed, Attempt to access invalid address.
   81 5638468 [unknown (0x22C0)] iswcs 14132 mmap_record::unmap_pages: addr == 0x7FB40000, len == 65536, off == 0
   30 5638498 [unknown (0x22C0)] iswcs 14132 mmap_record::unmap_pages: VirtualProtect in unmap_pages () failed, Attempt to access invalid address.

 1198 5913621 [unknown (0x22C0)] iswcs 14132 mmap64: fh == 1628914712, addr == 0x0, len == 111, off == 0, prot == 0, flags == 3, fd == 1
  111 5913732 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: fhdl == 3443684, name == 0x611744B0, len == 111, off == 0, prot == 0, flags == 3
-1732 5913854 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: h == 3442152, name == 0x611744B0, len == 111, off == 0, prot == 0, flags == 3
  135 5917163 [unknown (0x22C0)] iswcs 14132 MapViewNT: 7FB50000 = NtMapViewOfSection (h:3485E8, addr:0, len:111, off:0, protect:40, type:0)
 1964 5954789 [unknown (0x22C0)] iswcs 14132 mmap64: fh == 1628914712, addr == 0x0, len == 4096, off == 0, prot == 0, flags == 3, fd == 1, orig_len == 38
  581 5955463 [unknown (0x22C0)] iswcs 14132 mmap64: orig_len == 61440, len == 4096, pagesize == 65536, valid_page_len == 61440, sigbus_page_len == 0, at_base == 0x7FB51000
-2520 5965447 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: fhdl == 4294967295, name == 0x61174660, len == 61440, off == 0, prot == 0, flags == 67108867
-1010 5968842 [unknown (0x22C0)] iswcs 14132 CreateMappingNT: h == 3443752, name == 0x61174660, len == 61440, off == 0, prot == 0, flags == 67108867
  771 5973717 [unknown (0x22C0)] iswcs 14132 MapViewNT: 0 = NtMapViewOfSection (h:348C28, addr:7FB51000, len:61440, off:0, protect:40, type:0)
  315 5976384 [unknown (0x22C0)] iswcs 14132 __set_errno: void* mmap64(void*, size_t, int, int, int, _off64_t):1283 val 12
----

2nd strace
----
  429 6379631 [unknown (0x2164)] iswcs 24296 CreateMappingNT: fhdl == 3442760, name == 0x611744B0, len == 46121, off == 0, prot == 0, flags == 3
  116 6379747 [unknown (0x2164)] iswcs 24296 CreateMappingNT: h == 3443780, name == 0x611744B0, len == 46121, off == 0, prot == 0, flags == 3
  376 6380462 [unknown (0x2164)] iswcs 24296 MapViewNT: 7FB40000 = NtMapViewOfSection (h:348C44, addr:0, len:46121, off:0, protect:40, type:0)
 -986 6405625 [unknown (0x2164)] iswcs 24296 mmap64: fh == 1628914712, base == 0x7FB40000, addr == 0x0, len == 46121, orig_len == 46121, off == 0, prot == 0, flags == 3, fd == 1
-2321 6407688 [unknown (0x2164)] iswcs 24296 mmap64: fh == 1628914712, base == 0x7FB40000, addr == 0x0, len == 65536, orig_len == 65536, off == 0, prot == 0, flags == 3, fd == 1
 2176 6754422 [unknown (0x2164)] iswcs 24296 mmap_record::unmap_pages: addr == 0x7FB40000, len == 65536, off == 0, psz == 65536, get_address() + off * psz == 2142502912, len * psz == 0
   87 6754509 [unknown (0x2164)] iswcs 24296 mmap_record::unmap_pages: addr == 0x7FB40000, len (page cnt now) == 1, off == 0, psz == 65536, get_address() + off * psz == 2142502912, len * psz == 65536
 -858 6754608 [unknown (0x2164)] iswcs 24296 mmap_record::unmap_pages: VirtualProtect in unmap_pages () failed, Attempt to access invalid address.

-1021 7244483 [unknown (0x2164)] iswcs 24296 CreateMappingNT: fhdl == 3442444, name == 0x611744B0, len == 111, off == 0, prot == 0, flags == 3
  262 7246675 [unknown (0x2164)] iswcs 24296 CreateMappingNT: h == 3442312, name == 0x611744B0, len == 111, off == 0, prot == 0, flags == 3
   75 7248028 [unknown (0x2164)] iswcs 24296 MapViewNT: 7FB50000 = NtMapViewOfSection (h:348688, addr:0, len:111, off:0, protect:40, type:0)
 2190 7337551 [unknown (0x2164)] iswcs 24296 mmap64: fh == 1628914712, base == 0x7FB50000, addr == 0x0, len == 111, orig_len == 111, off == 0, prot == 0, flags == 3, fd == 1
 -326 7337637 [unknown (0x2164)] iswcs 24296 mmap64: fh == 1628914712, base == 0x7FB50000, addr == 0x0, len == 65536, orig_len == 65536, off == 0, prot == 0, flags == 3, fd == 1
 1572 7342043 [unknown (0x2164)] iswcs 24296 mmap_record::unmap_pages: addr == 0x7FB50000, len == 65536, off == 0, psz == 65536, get_address() + off * psz == 2142568448, len * psz == 0
  610 7344286 [unknown (0x2164)] iswcs 24296 mmap_record::unmap_pages: addr == 0x7FB50000, len (page cnt now) == 1, off == 0, psz == 65536, get_address() + off * psz == 2142568448, len * psz == 65536
 -156 7344394 [unknown (0x2164)] iswcs 24296 mmap_record::unmap_pages: VirtualProtect in unmap_pages () failed, Attempt to access invalid address.
----

On Fri, Jan 05, 2007 at 03:15:29PM -0600, Brian Ford wrote:
> On Fri, 5 Jan 2007, Corinna Vinschen wrote:
> 
> > "overmap"?  -v please?
> 
> Posix symantics: mmap fixed region x, mmap fixed region y which is a
> subregion of x where y replaces x's mapping.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]