[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcrypt-devel
Subject:    Re: 1.8.0 testsuite error on PowerPC*
From:       Andreas Metzler <ametzler () bebt ! de>
Date:       2017-08-19 13:48:34
Message-ID: 20170819134834.b4u2uflj5qsaoaz6 () argenau ! bebt ! de
[Download RAW message or body]

On 2017-07-21 Andreas Metzler <ametzler@bebt.de> wrote:
> On 2017-07-21 NIIBE Yutaka <gniibe@fsij.org> wrote:
>> Andreas Metzler <ametzler@bebt.de> wrote:
>>> on many (all?) PowerPC variants gcrypt 1.8.0 FTBFS with
>>> t-secmem: allocation did not fail as expected

>> I think that this is due to the page size of PowerPC.
>> Is it larger than 16K?
> [...]

> Indeed it is:
> ametzler@partch:~$ getconf PAGESIZE
> 65536

Hello,

Fedora is using the attached patch which works for me on linux/powerpc.
Adding a check for POSIX avoids breaking compilation on mingw.

cu Andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'

["fedora.patch" (text/x-diff)]

diff -up libgcrypt-1.8.0/tests/t-secmem.c.build libgcrypt-1.8.0/tests/t-secmem.c
--- libgcrypt-1.8.0/tests/t-secmem.c.build	2017-01-18 15:24:25.000000000 +0100
+++ libgcrypt-1.8.0/tests/t-secmem.c	2017-08-16 15:12:48.948224849 +0200
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <unistd.h>
 
 #define PGM "t-secmem"
 
@@ -37,17 +38,21 @@ test_secmem (void)
 {
   void *a[28];
   void *b;
+  long oversize;
   int i;
 
   memset (a, 0, sizeof a);
 
+  oversize = sysconf (_SC_PAGESIZE);
+  oversize = oversize <= 16384 ? 2048 : oversize - (16384 - 2048);
+
   /* Allocating 28*512=14k should work in the default 16k pool even
    * with extrem alignment requirements.  */
   for (i=0; i < DIM(a); i++)
     a[i] = gcry_xmalloc_secure (512);
 
   /* Allocating another 2k should fail for the default 16k pool.  */
-  b = gcry_malloc_secure (2048);
+  b = gcry_malloc_secure (oversize);
   if (b)
     fail ("allocation did not fail as expected\n");
 

["fedora+checkforPOSIX.diff" (text/x-diff)]

--- a/tests/t-secmem.c
+++ b/tests/t-secmem.c
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <unistd.h>
 
 #define PGM "t-secmem"
 
@@ -37,17 +38,25 @@ test_secmem (void)
 {
   void *a[28];
   void *b;
+  long oversize;
   int i;
 
   memset (a, 0, sizeof a);
 
+#ifdef _POSIX_VERSION
+  oversize = sysconf (_SC_PAGESIZE);
+  oversize = oversize <= 16384 ? 2048 : oversize - (16384 - 2048);
+#else
+  oversize = 2048;
+#endif /* _POSIX_VERSION */
+
   /* Allocating 28*512=14k should work in the default 16k pool even
    * with extrem alignment requirements.  */
   for (i=0; i < DIM(a); i++)
     a[i] = gcry_xmalloc_secure (512);
 
   /* Allocating another 2k should fail for the default 16k pool.  */
-  b = gcry_malloc_secure (2048);
+  b = gcry_malloc_secure (oversize);
   if (b)
     fail ("allocation did not fail as expected\n");
 


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic