[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] Fix /proc/?/exe values for bootstrap processes
From: |
Samuel Thibault |
Subject: |
Re: [PATCH v2] Fix /proc/?/exe values for bootstrap processes |
Date: |
Sun, 11 Jul 2021 19:44:34 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Damien Zammit, le dim. 11 juil. 2021 11:20:42 +1000, a ecrit:
> TESTED: normal boot and pci+rump
>
> TODO: fix rumpdisk's /proc/6/stat
> ---
> libmachdev/trivfs_server.c | 15 +--------------
> startup/startup.c | 16 ++++++++++++++--
> 2 files changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
> index bbd73555..9c604595 100644
> --- a/libmachdev/trivfs_server.c
> +++ b/libmachdev/trivfs_server.c
> @@ -289,13 +289,12 @@ 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, parent_proc;
> + process_t parent_proc;
>
> /* Traverse to the bootstrapping server first */
> task_get_bootstrap_port (mach_task_self (), &bootstrap);
> if (bootstrap)
> {
> -
> err = proc_task2proc (procserver, parent_task, &parent_proc);
> assert_perror_backtrace (err);
> err = fsys_init (bootstrap, parent_proc, MACH_MSG_TYPE_COPY_SEND,
> authhandle);
> @@ -322,18 +321,6 @@ trivfs_S_fsys_init (struct trivfs_control *fsys,
> _hurd_libc_proc_init(machdev_argv);
> #endif
>
> - /* Mark us as important. */
> - proc = getproc ();
> - assert_backtrace (proc);
> - err = proc_mark_important (proc);
> - if (err && err != EPERM)
> - assert_perror_backtrace (err);
> - err = proc_mark_exec (proc);
> - assert_perror_backtrace (err);
> - err = proc_set_exe (proc, program_invocation_short_name);
> - assert_perror_backtrace (err);
> - mach_port_deallocate (mach_task_self (), proc);
> -
> if (bootstrapping)
> {
> if (devnode)
> diff --git a/startup/startup.c b/startup/startup.c
> index 9faeb462..90cdaa85 100644
> --- a/startup/startup.c
> +++ b/startup/startup.c
> @@ -1462,7 +1462,7 @@ S_startup_essential_task (mach_port_t server,
> char *name,
> mach_port_t credential)
> {
> - static int authinit, procinit, execinit;
> + static int authinit, procinit, execinit, fsinit;
> int fail;
>
> /* Always deallocate the extra reference this message carries. */
> @@ -1494,11 +1494,21 @@ S_startup_essential_task (mach_port_t server,
> }
> else if (!strcmp (name, "proc"))
> procinit = 1;
> + else if (!strcmp (name, "ext2fs"))
> + fsinit = 1;
> + else
> + {
> + mach_port_t otherproc;
> + proc_child (procserver, task);
> + proc_task2proc (procserver, task, &otherproc);
> + proc_mark_important (otherproc);
> + proc_set_exe (otherproc, name);
> + }
>
> if (verbose)
> fprintf (stderr, " still waiting for:");
>
> - if (authinit && execinit && procinit)
> + if (authinit && execinit && procinit && fsinit)
> {
> if (verbose)
> fprintf (stderr, " none!\n");
> @@ -1524,6 +1534,8 @@ S_startup_essential_task (mach_port_t server,
> fprintf (stderr, " exec");
> if (! procinit)
> fprintf (stderr, " proc");
> + if (! fsinit)
> + fprintf (stderr, " fs");
> fprintf (stderr, "\n");
> }
> }
> --
> 2.31.0
>
>
--
Samuel
<L> pour moi le seul qui est autorisé à fasciser, c moi :-)