diff options
author | Damien Zammit <damien@zamaudio.com> | 2021-03-19 13:15:11 +1100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-03-19 23:56:12 +0100 |
commit | 65a80c709b4a8c909fa1d7de49e0097611bdc057 (patch) | |
tree | 01f1830d740220ea6e07a253ef701f14761219a7 /libmachdev | |
parent | c3b928d7c626e5692f7c544f23b5ae39cdc1a8db (diff) | |
download | hurd-65a80c709b4a8c909fa1d7de49e0097611bdc057.tar.gz hurd-65a80c709b4a8c909fa1d7de49e0097611bdc057.tar.bz2 hurd-65a80c709b4a8c909fa1d7de49e0097611bdc057.zip |
machdev: Fix parent proc passthrough in fsys_init
* libmachdev/trivfs_server.c (parent_task): New global variable.
(machdev_trivfs_init): Remove parent_task local variable.
(trivfs_S_fsys_init): Pass parent's proc port to fsys_init call.
Accept EPERM error from proc_mark_important for bootstrap case. Check
errors from proc_set_exe call.
Message-Id: <20210319021512.823541-1-damien@zamaudio.com>
Diffstat (limited to 'libmachdev')
-rw-r--r-- | libmachdev/trivfs_server.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c index 607166f9..60711348 100644 --- a/libmachdev/trivfs_server.c +++ b/libmachdev/trivfs_server.c @@ -79,6 +79,9 @@ struct port_class *machdev_shutdown_notify_class; static void arrange_shutdown_notification (void); +/* Our parent's task, if applicable */ +static task_t parent_task; + static void install_as_translator (mach_port_t bootport) { @@ -284,13 +287,16 @@ trivfs_S_fsys_init (struct trivfs_control *fsys, retry_type retry; string_t retry_name; mach_port_t right = MACH_PORT_NULL; - process_t proc; + process_t proc, parent_proc; /* Traverse to the bootstrapping server first */ task_get_bootstrap_port (mach_task_self (), &bootstrap); if (bootstrap) { - err = fsys_init (bootstrap, procserver, MACH_MSG_TYPE_COPY_SEND, authhandle); + + err = proc_task2proc (procserver, parent_task, &parent_proc); + assert_perror_backtrace (err); + err = fsys_init (bootstrap, parent_proc, MACH_MSG_TYPE_COPY_SEND, authhandle); assert_perror_backtrace (err); } err = fsys_getroot (control_port, MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND, @@ -315,10 +321,12 @@ trivfs_S_fsys_init (struct trivfs_control *fsys, proc = getproc (); assert_backtrace (proc); err = proc_mark_important (proc); - assert_perror_backtrace (err); + if (err && err != EPERM) + assert_perror_backtrace (err); err = proc_mark_exec (proc); assert_perror_backtrace (err); - proc_set_exe (proc, program_invocation_short_name); + err = proc_set_exe (proc, program_invocation_short_name); + assert_perror_backtrace (err); mach_port_deallocate (mach_task_self (), proc); if (bootstrapping) @@ -430,7 +438,6 @@ machdev_trivfs_init(mach_port_t bootstrap_resume_task, const char *name, const c mach_port_t *bootstrap) { mach_port_t mybootstrap = MACH_PORT_NULL; - task_t parent_task; port_bucket = ports_create_bucket (); trivfs_cntl_class = ports_create_class (trivfs_clean_cntl, 0); trivfs_protid_class = ports_create_class (trivfs_clean_protid, 0); |