summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2007-08-24 23:11:04 +0000
committerSteve Huston <shuston@riverace.com>2007-08-24 23:11:04 +0000
commit07f874ed902ac56e4cbdfc60a2d48fda0054f39a (patch)
tree182f9ff2ebf2c76ce665f52e8003d8595e4b9104
parentdec14dbb41bb15e21e59f570a8b8d0cd159564f1 (diff)
downloadATCD-07f874ed902ac56e4cbdfc60a2d48fda0054f39a.tar.gz
ChangeLogTag:Fri Aug 24 21:52:37 UTC 2007 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ChangeLog14
-rw-r--r--ACE/ace/MMAP_Memory_Pool.cpp10
-rw-r--r--ACE/tests/Naming_Test.cpp14
3 files changed, 31 insertions, 7 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 0c28d0a59f3..59757a27eaf 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,6 +1,18 @@
Fri Aug 24 21:52:37 UTC 2007 Steve Huston <shuston@riverace.com>
- * tests/Naming_Test.cpp: Correct logging formats.
+ * ace/MMAP_Memoy_Pool.cpp (map_file): Reverted the "always do
+ MAP_FIXED" flag on remapping a file from:
+ Wed Aug 22 18:10:09 UTC 2007 Steve Huston <shuston@riverace.com>
+ That's an invalid thing to do, as it has the potential to remap
+ pages from things like the heap or the C library or ACE into the
+ mapped file - definitely not what we want. If the remap has to move
+ the area, it's best to fail it here.
+
+ * tests/Naming_Test.cpp: Correct logging formats and wedge in a base
+ address for the name space's mmaped region. This avoids having to
+ move the mapped area as it grows, which totally screws the name
+ space map. RHEL4 x64 seems to be the only platform this is tested
+ on regularly where this condition is hit.
Fri Aug 24 16:15:59 UTC 2007 Phil Mesnier <mesnier_p@ociweb.com>
diff --git a/ACE/ace/MMAP_Memory_Pool.cpp b/ACE/ace/MMAP_Memory_Pool.cpp
index 1a8c93079fd..1051b33d9ec 100644
--- a/ACE/ace/MMAP_Memory_Pool.cpp
+++ b/ACE/ace/MMAP_Memory_Pool.cpp
@@ -275,13 +275,13 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size)
this->base_addr_ = 0;
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
- // Remap the file; try to stay at the same location as a previous mapping.
- int flags = this->flags_;
- if (this->base_addr_ != 0)
- flags |= MAP_FIXED;
+ // Remap the file; try to stay at the same location as a previous mapping
+ // but do not force it with MAP_FIXED. Doing so will give the OS permission
+ // to map locations currently holding other things (such as the heap, or
+ // the C library) into the map file, producing very unexpected results.
if (this->mmap_.map (map_size,
PROT_RDWR,
- flags,
+ this->flags_,
this->base_addr_,
0,
this->sa_) == -1
diff --git a/ACE/tests/Naming_Test.cpp b/ACE/tests/Naming_Test.cpp
index 7ce62c3b424..f45bf86935d 100644
--- a/ACE/tests/Naming_Test.cpp
+++ b/ACE/tests/Naming_Test.cpp
@@ -198,7 +198,19 @@ run_main (int argc, ACE_TCHAR *argv[])
ACE_Name_Options *name_options = ns_context->name_options ();
name_options->parse_args (argc, argv);
-
+ /*
+ ** NOTE! This is an experimental value and is not magic in any way. It
+ ** works for me, on one system. It's needed because in the particular
+ ** case here where the underlying mmap will allocate a small area and
+ ** then try to grow it, it always moves it to a new location, which
+ ** totally screws things up. I once tried forcing the realloc to do
+ ** MAP_FIXED but that's not a good solution since it may overwrite other
+ ** mapped areas of memory, like the heap, or the C library, and get very
+ ** unexpected results. (Steve Huston, 24-August-2007)
+ */
+# if defined (linux) && defined (__x86_64__)
+ name_options->base_address ((char*)0x3c00000000);
+#endif
int unicode = 0;
#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
unicode = 1;