[PATCH 1/2] startup: Mark essential tasks as our children
--- startup/startup.c | 4 1 file changed, 4 insertions(+) diff --git a/startup/startup.c b/startup/startup.c index 9faeb462..78d69103 100644 --- a/startup/startup.c +++ b/startup/startup.c @@ -368,6 +368,10 @@ record_essential_task (const char *name, task_t task) /* Dead-name notification on the task port will tell us when it dies. */ request_dead_name (task); + /* Make task a child of startup */ + if (task != mach_task_self () && task != proctask) +proc_child (procserver, task); + #if 0 /* Taking over the exception port will give us a better chance if the task tries to get wedged on a fault. */ -- 2.31.0
[PATCH 2/2] proc/info: Fix EIO with /proc/6/stat
--- proc/info.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proc/info.c b/proc/info.c index 6c2567d2..9c5d3543 100644 --- a/proc/info.c +++ b/proc/info.c @@ -316,7 +316,10 @@ get_string_array (task_t t, err = get_vector (t, loc, &vector); if (err) -return err; +{ + *buflen = 0; + return 0; +} bp = (char *) *buf; for (vp = vector; *vp; ++vp) -- 2.31.0
Re: [PATCH 1/2] startup: Mark essential tasks as our children
As I already requested, please additionally try to remove err = proc_child (procserver, fstask); err = proc_child (procserver, authtask); from launch_core_servers. Otherwise they will be duplicates and bring confusion to the next reader of the code. Samuel Damien Zammit, le sam. 05 juin 2021 20:10:47 +1000, a ecrit: > --- > startup/startup.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/startup/startup.c b/startup/startup.c > index 9faeb462..78d69103 100644 > --- a/startup/startup.c > +++ b/startup/startup.c > @@ -368,6 +368,10 @@ record_essential_task (const char *name, task_t task) >/* Dead-name notification on the task port will tell us when it dies. */ >request_dead_name (task); > > + /* Make task a child of startup */ > + if (task != mach_task_self () && task != proctask) > +proc_child (procserver, task); > + > #if 0 >/* Taking over the exception port will give us a better chance > if the task tries to get wedged on a fault. */ > -- > 2.31.0 > >
Re: [PATCH 2/2] proc/info: Fix EIO with /proc/6/stat
I don't think we want to "fix" it like this, this is very probably only papering over an actual issue that could bite another way. We need to find out the root issue, rather than circumvent it. I see on IRC that you mention that you have a NULL string pointer, which results in an ESRCH error here. But then the root issue is why it's a NULL string, i.e. why p_argv is not set, i.e. why S_proc_set_arg_locations is not called, or called with a NULL pointer. Continue looking back in the calls and you'll find the root cause. Samuel Damien Zammit, le sam. 05 juin 2021 20:10:48 +1000, a ecrit: > --- > proc/info.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/proc/info.c b/proc/info.c > index 6c2567d2..9c5d3543 100644 > --- a/proc/info.c > +++ b/proc/info.c > @@ -316,7 +316,10 @@ get_string_array (task_t t, > >err = get_vector (t, loc, &vector); >if (err) > -return err; > +{ > + *buflen = 0; > + return 0; > +} > >bp = (char *) *buf; >for (vp = vector; *vp; ++vp) > -- > 2.31.0 > >
[PATCH v2] startup: Mark essential tasks as our children
This boots, but proc_child(fs) is needed in launch_core_servers otherwise it hangs at " auth" --- startup/startup.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/startup/startup.c b/startup/startup.c index 9faeb462..2499f81d 100644 --- a/startup/startup.c +++ b/startup/startup.c @@ -368,6 +368,10 @@ record_essential_task (const char *name, task_t task) /* Dead-name notification on the task port will tell us when it dies. */ request_dead_name (task); + /* Make task a child of startup */ + if (task != mach_task_self () && task != proctask) +proc_child (procserver, task); + #if 0 /* Taking over the exception port will give us a better chance if the task tries to get wedged on a fault. */ @@ -863,12 +867,12 @@ launch_core_servers (void) assert_perror_backtrace (err); proc_set_exe (procserver, "/hurd/startup"); - /* Declare that the filesystem and auth are our children. */ - err = proc_child (procserver, fstask); - assert_perror_backtrace (err); - err = proc_child (procserver, authtask); + /* XXX this seems required? */ + err = record_essential_task ("fs", fstask); assert_perror_backtrace (err); + err = record_essential_task ("auth", authtask); + assert_perror_backtrace (err); err = proc_task2proc (procserver, authtask, &authproc); assert_perror_backtrace (err); err = proc_mark_important (authproc); @@ -1053,8 +1057,7 @@ frob_kernel_process (void) } } - /* Make the kernel our child. */ - err = proc_child (procserver, task); + err = record_essential_task ("kernel", task); if (err) { error (0, err, "cannot make the kernel our child"); @@ -1075,9 +1078,6 @@ frob_kernel_process (void) if (err) error (0, err, "cannot mark the kernel as important"); - err = record_essential_task ("kernel", task); - assert_perror_backtrace (err); - proc_set_exe (proc, "kernel"); err = task_get_bootstrap_port (task, &kbs); -- 2.31.0