bug-hurd
[Top][All Lists]
Advanced

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

Re: settrans: (os/kern) invalid right


From: Sergey Bugaev
Subject: Re: settrans: (os/kern) invalid right
Date: Sat, 8 May 2021 14:51:22 +0300

On Sat, May 8, 2021 at 2:39 PM Samuel Thibault <samuel.thibault@gnu.org> wrote:
> I pushed the revert, thanks!

Thank you!

I'm attaching another patch that tries to make settrans handle this
case a tiny bit better: if we failed to set the translator (either
because of this issue, or for any other reason), let's shut the
translator back down instead of leaving it in limbo.

Sergey

P.S. There must be something wrong with your mailserver. I only
received a bunch of replies form you just a few minutes ago, and
seemingly so did the archive [0], but your citation indicates that you
have sent the reply promptly after my message.

[0] https://lists.gnu.org/archive/html/bug-hurd/2021-05/

-- >8 --
Subject: [PATCH] utils/settrans: Ask translator to go away on errors

If the translator starts up fine, but we fail to set it as the active
translator on the underlying node for whatever reason, ask it to shut
down again, instead of leaving it orphaned. This is what mount(1)
does already.

To test:

$ settrans -a /dev/null /hurd/hello
settrans: /dev/null: Operation not permitted
$ pgrep hello
1141

That means PID 1141, the translator we started, is still alive. With
this patch it shuts down, and pgrep returns nothing.
---
 utils/settrans.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/utils/settrans.c b/utils/settrans.c
index 9c9f087e..f07d294b 100644
--- a/utils/settrans.c
+++ b/utils/settrans.c
@@ -396,7 +396,11 @@ main(int argc, char *argv[])
  argz, argz_len,
  active_control, MACH_MSG_TYPE_COPY_SEND);
       if (err)
- error (5, err, "%s", node_name);
+        {
+          if (active_control != MACH_PORT_NULL)
+            fsys_goaway (active_control, FSYS_GOAWAY_FORCE);
+          error (5, err, "%s", node_name);
+        }
     }

   if (chroot_command)
-- 
2.31.1



reply via email to

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