]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix 203877 and 301229 increase to 16Mb maximum allowed alignment for memalign() and...
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 15 Jun 2012 22:19:59 +0000 (22:19 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 15 Jun 2012 22:19:59 +0000 (22:19 +0000)
Note that VG_(arena_memalign) is not used by core or tools for the moment.
We have one single maxima for both the V core/tools and the client.
Enhanced memcheck/tests/memalign2.c to test 4 Mb and 16 Mb alignments.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12642

NEWS
coregrind/m_mallocfree.c
memcheck/tests/memalign2.c

diff --git a/NEWS b/NEWS
index 7ed0f0b0369b8bde778e51171272171e4690680f..6681bf5967b22becfbe1b06677bea54b3fa4b8c3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -70,6 +70,7 @@ https://bugs.kde.org/show_bug.cgi?id=XXXXXX
 where XXXXXX is the bug number as listed below.
 
 197914  Building valgrind from svn now requires automake-1.10
+203877  increase to 16Mb maximum allowed alignment for memalign() and posix_memalign
 219156  Valgrind does not handle statically linked malloc or other malloc lib (e.g. tcmalloc) 
 247386  make perf does not run all performance tests
 270006  Valgrind scheduler unfair 
@@ -109,6 +110,7 @@ n-i-bz  Bypass gcc4.4/4.5 wrong code generation causing out of memory or asserts
 n-i-bz  Add missing gdbserver xml files for shadow registers for ppc32
 n-i-bz  Fix false positive in sys_clone on amd64 when optional args are not given (e.g. child_tidptr)
 n-i-bz  Fix assert in gdbserver for watchpoints watching the same address
+301229  dup of 203877, see above.
 
 Release 3.7.0 (5 November 2011)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 40c12f67d65f90be33b872ee5635ebc17e2190b6..2eb7e9c18f2ed1642d4d3df21f8351c4cf0e90cc 100644 (file)
@@ -1920,10 +1920,11 @@ void* VG_(arena_memalign) ( ArenaId aid, HChar* cc,
    // this allocation; it isn't optional.
    vg_assert(cc);
 
+   // Check that the requested alignment has a plausible size.
    // Check that the requested alignment seems reasonable; that is, is
    // a power of 2.
    if (req_alignB < VG_MIN_MALLOC_SZB
-       || req_alignB > 1048576
+       || req_alignB > 16 * 1024 * 1024
        || VG_(log2)( req_alignB ) == -1 /* not a power of 2 */) {
       VG_(printf)("VG_(arena_memalign)(%p, %lu, %lu)\n"
                   "bad alignment value %lu\n"
index 12aa047db1859e895dc7ac62bfa7f147f58b0a64..bd478026f08bf2dfadb4d5dbfb1caebbe9adb677 100644 (file)
@@ -76,6 +76,8 @@ int main ( void )
    p = memalign(4096, 100);   assert(0 == (long)p % 4096);
    p = memalign(4097, 100);   assert(0 == (long)p % 8192);
 
+   p = memalign(4 * 1024 * 1024, 100);   assert(0 == (long)p % 4 * 1024 * 1024);
+   p = memalign(16 * 1024 * 1024, 100);   assert(0 == (long)p % 16 * 1024 * 1024);
 
 #  define PM(a,b,c) posix_memalign((void**)a, b, c)
 
@@ -88,15 +90,17 @@ int main ( void )
                               assert(0 == res && 0 == (long)p % sizeof(void*));
 
    res = PM(&p, 31, 100);     assert(EINVAL == res);
-   res = PM(&p, 32, 100);     assert(0 == res &&
-                                                 0 == (long)p % 32);
+   res = PM(&p, 32, 100);     assert(0 == res && 0 == (long)p % 32);
    res = PM(&p, 33, 100);     assert(EINVAL == res);
 
    res = PM(&p, 4095, 100);   assert(EINVAL == res);
-   res = PM(&p, 4096, 100);   assert(0 == res &&
-                                                 0 == (long)p % 4096); 
+   res = PM(&p, 4096, 100);   assert(0 == res && 0 == (long)p % 4096); 
    res = PM(&p, 4097, 100);   assert(EINVAL == res);
 
+   res = PM(&p, 4 * 1024 * 1024, 100);   assert(0 == res 
+                                                && 0 == (long)p % 4 * 1024 * 1024);
+   res = PM(&p, 16 * 1024 * 1024, 100);   assert(0 == res 
+                                                && 0 == (long)p % 16 * 1024 * 1024);
 #  endif
    
    return 0;