[git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-33-g618b897

by Werner Koch cvs at cvs.gnupg.org
Fri Dec 9 15:26:01 CET 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".

The branch, master has been updated
       via  618b8978f46f4011c11512fd5f30c15e01652e2e (commit)
      from  656395ba4cf34f42dda3a120bda3ed1220755a3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 618b8978f46f4011c11512fd5f30c15e01652e2e
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Dec 9 12:10:54 2016 +0100

    Improve handling of mlock error codes.
    
    * acinclude.m4 (GNUPG_CHECK_MLOCK): Check also for EAGAIN which is a
    legitimate return code and does not indicate a broken mlock().
    * src/secmem.c (lock_pool_pages): Test ERR instead of ERRNO which
    could have been overwritten by cap_from+text et al.
    --
    
      On FreeBSD, if there are not enough free pages, mlock() can return
      EAGAIN, as documented in mlock(2). That doesn't mean that mlock is
      broken. I suspect this same issue also exists on the other BSD's.
    
    Suggested-by: Ruben Kerkhof <ruben at rubenkerkhof.com>
    
    This is (now) also true for Linux.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/acinclude.m4 b/acinclude.m4
index 96be833..90b3cb9 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -242,7 +242,7 @@ int main()
     pool += (pgsize - ((long int)pool % pgsize));
 
     err = mlock( pool, 4096 );
-    if( !err || errno == EPERM )
+    if( !err || errno == EPERM || errno == EGAIN)
         return 0; /* okay */
 
     return 1;  /* hmmm */
diff --git a/src/secmem.c b/src/secmem.c
index 4fa267b..55424f2 100644
--- a/src/secmem.c
+++ b/src/secmem.c
@@ -282,15 +282,15 @@ lock_pool_pages (void *p, size_t n)
 
   if (err)
     {
-      if (errno != EPERM
-#ifdef EAGAIN	/* OpenBSD returns this */
-	  && errno != EAGAIN
+      if (err != EPERM
+#ifdef EAGAIN	/* BSD and also Linux may return EAGAIN */
+	  && err != EAGAIN
 #endif
 #ifdef ENOSYS	/* Some SCOs return this (function not implemented) */
-	  && errno != ENOSYS
+	  && err != ENOSYS
 #endif
 #ifdef ENOMEM  /* Linux might return this. */
-            && errno != ENOMEM
+            && err != ENOMEM
 #endif
 	  )
 	log_error ("can't lock memory: %s\n", strerror (err));
@@ -341,15 +341,15 @@ lock_pool_pages (void *p, size_t n)
 
   if (err)
     {
-      if (errno != EPERM
-#ifdef EAGAIN	/* OpenBSD returns this. */
-	  && errno != EAGAIN
+      if (err != EPERM
+#ifdef EAGAIN	/* BSD and also Linux may return this. */
+	  && err != EAGAIN
 #endif
 #ifdef ENOSYS	/* Some SCOs return this (function not implemented). */
-	  && errno != ENOSYS
+	  && err != ENOSYS
 #endif
 #ifdef ENOMEM  /* Linux might return this. */
-            && errno != ENOMEM
+            && err != ENOMEM
 #endif
 	  )
 	log_error ("can't lock memory: %s\n", strerror (err));

-----------------------------------------------------------------------

Summary of changes:
 acinclude.m4 |  2 +-
 src/secmem.c | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
The GNU crypto library
http://git.gnupg.org


_______________________________________________
Gnupg-commits mailing list
Gnupg-commits at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-commits




More information about the Gcrypt-devel mailing list