This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.21-580-ged4060f


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 "GNU C Library master sources".

The branch, master has been updated
       via  ed4060f50ea84c7e238110955253647fc091aee9 (commit)
      from  b8528e771c0f31ebb8ac2470e2cf7ee9a50693e2 (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 -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ed4060f50ea84c7e238110955253647fc091aee9

commit ed4060f50ea84c7e238110955253647fc091aee9
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Thu Jul 9 13:56:30 2015 +0200

    hurd: permit to use mlock from non-root process
    
    * sysdeps/mach/hurd/mlock.c (mlock): When __get_privileged_ports
    returns an error, also try to use host port from __mach_host_self for
    the __vm_wire call.
    * sysdeps/mach/hurd/munlock.c (munlock): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 95f3ddf..ed509cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-07-09  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/mlock.c (mlock): When __get_privileged_ports
+	returns an error, also try to use host port from __mach_host_self for
+	the __vm_wire call.
+	* sysdeps/mach/hurd/munlock.c (munlock): Likewise.
+
 2015-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	[BZ #18400]
diff --git a/sysdeps/mach/hurd/mlock.c b/sysdeps/mach/hurd/mlock.c
index 10078e7..8ef568e 100644
--- a/sysdeps/mach/hurd/mlock.c
+++ b/sysdeps/mach/hurd/mlock.c
@@ -28,19 +28,20 @@
 int
 mlock (const void *addr, size_t len)
 {
-  mach_port_t hostpriv;
+  mach_port_t host;
   vm_address_t page;
   error_t err;
 
-  err = __get_privileged_ports (&hostpriv, NULL);
+  err = __get_privileged_ports (&host, NULL);
   if (err)
-    return __hurd_fail (EPERM);
+    host = __mach_host_self();
 
   page = trunc_page ((vm_address_t) addr);
   len = round_page ((vm_address_t) addr + len) - page;
-  err = __vm_wire (hostpriv, __mach_task_self (), page, len,
-		   VM_PROT_READ);
-  __mach_port_deallocate (__mach_task_self (), hostpriv);
+
+  err = __vm_wire (host, __mach_task_self (), page, len, VM_PROT_READ);
+  if (host != __mach_host_self())
+    __mach_port_deallocate (__mach_task_self (), host);
 
   return err ? __hurd_fail (err) : 0;
 }
diff --git a/sysdeps/mach/hurd/munlock.c b/sysdeps/mach/hurd/munlock.c
index 411115d..d063afc 100644
--- a/sysdeps/mach/hurd/munlock.c
+++ b/sysdeps/mach/hurd/munlock.c
@@ -27,18 +27,20 @@
 int
 munlock (const void *addr, size_t len)
 {
-  mach_port_t hostpriv;
+  mach_port_t host;
   vm_address_t page;
   error_t err;
 
-  err = __get_privileged_ports (&hostpriv, NULL);
+  err = __get_privileged_ports (&host, NULL);
   if (err)
-    return __hurd_fail (EPERM);
+    host = __mach_host_self();
 
   page = trunc_page ((vm_address_t) addr);
   len = round_page ((vm_address_t) addr + len) - page;
-  err = __vm_wire (hostpriv, __mach_task_self (), page, len, VM_PROT_NONE);
-  __mach_port_deallocate (__mach_task_self (), hostpriv);
+
+  err = __vm_wire (host, __mach_task_self (), page, len, VM_PROT_NONE);
+  if (host != __mach_host_self())
+    __mach_port_deallocate (__mach_task_self (), host);
 
   return err ? __hurd_fail (err) : 0;
 }

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

Summary of changes:
 ChangeLog                   |    7 +++++++
 sysdeps/mach/hurd/mlock.c   |   13 +++++++------
 sysdeps/mach/hurd/munlock.c |   12 +++++++-----
 3 files changed, 21 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]