commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 01/06: hurd: Use polymorphic port types to return some rights.


From: Samuel Thibault
Subject: [hurd] 01/06: hurd: Use polymorphic port types to return some rights.
Date: Sat, 10 Jun 2017 00:38:17 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit baf7e5c8ce176aead15c2559952d8bdf0da41ffd
Author: Justus Winter <address@hidden>
Date:   Fri Mar 10 12:36:39 2017 +0100

    hurd: Use polymorphic port types to return some rights.
    
    Currently, the RPC definitions of two procedures of the process
    subsystem assume that the rights are created from a receive right.
    Similarly, 'proc_getmsgport' assumes that the right is to be copied.
    This needlessly limits the ability to relay the RPC in server code.
    
    This fixes this.  The protocol is unchanged, only the generated server
    stubs assume an additional parameter for the type.
    
    * hurd/process.defs (proc_getmsgport): Make 'msgport' parameter
    polymorphic.
    (proc_task2proc): Make 'proc' parameter polymorphic.
    (proc_pid2proc): Likewise.
    * hurd/process_reply.defs (proc_getmsgport): Likewise.
    (proc_task2proc_reply): Likewise.
    (proc_pid2proc_reply): Likewise.
    * proc/info.c (S_proc_task2proc): Adapt server function.
    (S_proc_pid2proc): Likewise.
    * proc/msg.c (S_proc_getmsgport): Likewise.
---
 hurd/process.defs       | 6 +++---
 hurd/process_reply.defs | 6 +++---
 proc/info.c             | 8 ++++++--
 proc/msg.c              | 6 ++++--
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/hurd/process.defs b/hurd/process.defs
index 4ceb69e..df70eb9 100644
--- a/hurd/process.defs
+++ b/hurd/process.defs
@@ -156,7 +156,7 @@ routine proc_getmsgport (
        process: process_t;
        sreplyport reply_port: sreply_port_t;
        pid: pid_t;
-       out msgport: mach_port_t);
+       out msgport: mach_port_poly_t);
 
 /* Wait for a child process to exit.  If pid is zero, it waits for any
    child in the same pgrp as the parent.  If pid is -1, it waits for
@@ -246,7 +246,7 @@ routine proc_task2pid (
 routine proc_task2proc (
        process: process_t;
        task: task_t;
-       out proc: mach_port_make_send_t);
+       out proc: mach_port_poly_t);
 
 routine proc_proc2task (
        process: process_t;
@@ -255,7 +255,7 @@ routine proc_proc2task (
 routine proc_pid2proc (
        process: process_t;
        pid: pid_t;
-       out proc: mach_port_make_send_t);
+       out proc: mach_port_poly_t);
 
 routine proc_getprocinfo (
        process: process_t;
diff --git a/hurd/process_reply.defs b/hurd/process_reply.defs
index 15282fe..2fc21c9 100644
--- a/hurd/process_reply.defs
+++ b/hurd/process_reply.defs
@@ -51,7 +51,7 @@ skip; /* get_arg_locations */
 simpleroutine proc_getmsgport_reply (
        reply_port: reply_port_t;
        RETURN_CODE_ARG;
-       in msgports: mach_port_t);
+       in msgports: mach_port_poly_t);
 
 simpleroutine proc_wait_reply (
        reply_port: reply_port_t;
@@ -83,7 +83,7 @@ simpleroutine proc_task2pid_reply (
 simpleroutine proc_task2proc_reply (
        reply_port: reply_port_t;
        RETURN_CODE_ARG;
-       proc: mach_port_make_send_t);
+       proc: mach_port_poly_t);
 
 simpleroutine proc_proc2task_reply (
        reply_port: reply_port_t;
@@ -93,7 +93,7 @@ simpleroutine proc_proc2task_reply (
 simpleroutine proc_pid2proc_reply (
        reply_port: reply_port_t;
        RETURN_CODE_ARG;
-       proc: mach_port_make_send_t);
+       proc: mach_port_poly_t);
 
 simpleroutine proc_getprocinfo_reply (
        reply_port: reply_port_t;
diff --git a/proc/info.c b/proc/info.c
index 0f5ca0f..9732140 100644
--- a/proc/info.c
+++ b/proc/info.c
@@ -99,7 +99,8 @@ S_proc_task2pid (struct proc *callerp,
 kern_return_t
 S_proc_task2proc (struct proc *callerp,
                  task_t t,
-                 mach_port_t *outproc)
+                 mach_port_t *outproc,
+                 mach_msg_type_name_t *outproc_type)
 {
   struct proc *p = task_find (t);
 
@@ -109,6 +110,7 @@ S_proc_task2proc (struct proc *callerp,
     return ESRCH;
 
   *outproc = ports_get_right (p);
+  *outproc_type = MACH_MSG_TYPE_MAKE_SEND;
   mach_port_deallocate (mach_task_self (), t);
   return 0;
 }
@@ -128,7 +130,8 @@ S_proc_proc2task (struct proc *p,
 kern_return_t
 S_proc_pid2proc (struct proc *callerp,
                 pid_t pid,
-                mach_port_t *outproc)
+                mach_port_t *outproc,
+                mach_msg_type_name_t *outproc_type)
 {
   struct proc *p;
 
@@ -149,6 +152,7 @@ S_proc_pid2proc (struct proc *callerp,
     return EPERM;
 
   *outproc = ports_get_right (p);
+  *outproc_type = MACH_MSG_TYPE_MAKE_SEND;
   return 0;
 }
 
diff --git a/proc/msg.c b/proc/msg.c
index 1f132cd..e145f6e 100644
--- a/proc/msg.c
+++ b/proc/msg.c
@@ -126,7 +126,8 @@ S_proc_getmsgport (struct proc *callerp,
                   mach_port_t reply_port,
                   mach_msg_type_name_t reply_port_type,
                   pid_t pid,
-                  mach_port_t *msgport)
+                  mach_port_t *msgport,
+                   mach_msg_type_name_t *msgport_type)
 {
   int cancel;
   struct proc *p;
@@ -156,7 +157,8 @@ restart:
 
   if (check_msgport_death (p))
     goto restart;
-  
+
+  *msgport_type = MACH_MSG_TYPE_COPY_SEND;
   *msgport = p->p_msgport;
 
   return 0;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]