diff options
author | Justus Winter <justus@gnupg.org> | 2016-10-13 23:39:33 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2016-11-01 11:04:04 +0100 |
commit | 87c1eba3e7c9402ca59340db8a43a4c9ef5b3bd5 (patch) | |
tree | 15d3ea78522947b68595b8726d90c56f72474dc0 | |
parent | 9ddc4f2a1717455e50eb6fd010cda4e5f4080c42 (diff) |
proc: Fix new task notifications.
* proc/mgt.c (S_mach_notify_new_task): Fix receiver handling, fix port
leak.
* proc/mig-mutate.h: Mutate the task notification protocol.
-rw-r--r-- | proc/mgt.c | 12 | ||||
-rw-r--r-- | proc/mig-mutate.h | 9 |
2 files changed, 16 insertions, 5 deletions
@@ -41,6 +41,7 @@ #include "mutated_ourmsg_U.h" #include "proc_exc_S.h" #include "proc_exc_U.h" +#include "task_notify_S.h" #include <hurd/signal.h> /* Create a new id structure with the given genuine uids and gids. */ @@ -1048,13 +1049,13 @@ S_proc_get_code (struct proc *callerp, /* Handle new task notifications from the kernel. */ error_t -S_mach_notify_new_task (mach_port_t notify, +S_mach_notify_new_task (struct port_info *notify, mach_port_t task, mach_port_t parent) { struct proc *parentp, *childp; - if (notify != generic_port) + if (! notify || notify->class != generic_port_class) return EOPNOTSUPP; parentp = task_find_nocreate (parent); @@ -1079,9 +1080,10 @@ S_mach_notify_new_task (mach_port_t notify, proc_child, so we do it on their behalf. */ mach_port_mod_refs (mach_task_self (), task, MACH_PORT_RIGHT_SEND, +1); err = S_proc_child (parentp, task); - if (! err) - /* Relay the notification. This consumes TASK and PARENT. */ - return mach_notify_new_task (childp->p_task_namespace, task, parent); + assert_perror (err); + + /* Relay the notification. */ + mach_notify_new_task (childp->p_task_namespace, task, parent); } mach_port_deallocate (mach_task_self (), task); diff --git a/proc/mig-mutate.h b/proc/mig-mutate.h index 62dc2a59..35b02418 100644 --- a/proc/mig-mutate.h +++ b/proc/mig-mutate.h @@ -35,3 +35,12 @@ end_using_port_info (port_info_t) #define NOTIFY_IMPORTS \ import "libports/mig-decls.h"; + +#define TASK_NOTIFY_INTRAN \ + port_info_t begin_using_port_info_port (mach_port_t) +#define TASK_NOTIFY_INTRAN_PAYLOAD \ + port_info_t begin_using_port_info_payload +#define TASK_NOTIFY_DESTRUCTOR \ + end_using_port_info (port_info_t) +#define TASK_NOTIFY_IMPORTS \ + import "libports/mig-decls.h"; |