[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r13001 - in /trunk/libc: ChangeLog.eglibc elf/dl-load.c



Author: maxim
Date: Mon Feb 28 04:27:54 2011
New Revision: 13001

Log:
	[BZ #12492]
	* elf/dl-load.c (_dl_map_object_from_fd): Add gracious error path for
	the case when mprotect() fails.

Modified:
    trunk/libc/ChangeLog.eglibc
    trunk/libc/elf/dl-load.c

Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Mon Feb 28 04:27:54 2011
@@ -1,3 +1,9 @@
+2011-02-28  Pierre Ynard  <linkfanel@xxxxxxxx>
+
+	[BZ #12492]
+	* elf/dl-load.c (_dl_map_object_from_fd): Add gracious error path for
+	the case when mprotect() fails.
+
 2011-02-28  Denis Zaitceff  <zaitceff@xxxxxxxxx>
 
 	* elf/dl-lookup.c (GLRO_dl_debug_mask): Apply the forgotten one.

Modified: trunk/libc/elf/dl-load.c
==============================================================================
--- trunk/libc/elf/dl-load.c (original)
+++ trunk/libc/elf/dl-load.c Mon Feb 28 04:27:54 2011
@@ -1388,7 +1388,11 @@
 	  if (__builtin_expect (p + s <= relro_end, 1))
 	    {
 	      /* The variable lies in the region protected by RELRO.  */
-	      __mprotect ((void *) p, s, PROT_READ|PROT_WRITE);
+	      if (__mprotect ((void *) p, s, PROT_READ|PROT_WRITE) < 0)
+		{
+		  errstring = N_("cannot change memory protection");
+		  goto call_lose_errno;
+		}
 	      __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
 	      __mprotect ((void *) p, s, PROT_READ);
 	    }