9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: giacomo@tesio.it (Giacomo Tesio)
Subject: [9fans] Backgrounding a task
Date: Wed, 25 Oct 2017 00:07:22 +0200	[thread overview]
Message-ID: <CAHL7psE75Kfphng4qwatXnOhtfu8Tm8-n1BhVSJsZhMJO--Nng@mail.gmail.com> (raw)
In-Reply-To: <CAHL7psGm=_6nkJcyHq3tB2_j9JEt0soQQGqBPs8KaqDGfEAD=A@mail.gmail.com>

Here it is: https://github.com/JehanneOS/jehanne/commit/320e6e6f35bfbc2e37dbd079c8d6a9124bd9ac6c

The simple test attached confirms that it works as expected:
https://github.com/JehanneOS/jehanne/blob/master/qa/kern/nsclone.c

Now it's just matter of modifying the plumber to use this facility and
add a ns/clone command that take a pid and a command to run so that

ns/clone 256 rc

would start a new rc in a copy of the name space of the process with pid 256.


Giacomo


2017-10-24 21:18 GMT+02:00 Giacomo Tesio <giacomo at tesio.it>:
> 2017-10-24 16:21 GMT+02:00 Alex Musolino <alex at musolino.id.au>:
>> Creating a child process is something that a process explicitly
>> controls and the RFNOTEG flag of rfork(2) allows a process to control
>> whether or not it shares its namespace with its children.  Allowing
>> other, unrelated processes to fiddle with your namespace is quite
>> different.
>>
>> Think about multiple processes owned by multiple users running on a
>> cpu server.  Which processes should be allowed to join which
>> namespaces?
>>
>> Perhaps allowing only the hostowner to join namespaces for debugging
>> and administration purposes would be acceptable.
>
> I like this idea a lot. I will give it a try in Jehanne.
>
> However I'm going to use a slightly different design: writing "clone"
> to /proc/$pid/ns will cause the current process to replace its own
> name space with a *copy* of that of $pid.
> If the owner of $pid is different from that of the current process or
> if $pid is not running on the same machine as the current process, the
> write will fail with an error.
>
> However any change to the name space after the clone does not impact
> the original process.
>
> As for the plumber, I will add a message that make the plumber clone
> the name space of a target process.
>
> This should address both use-cases without issues for the processes
> running in the original name space.
>
>
> Giacomo



  reply	other threads:[~2017-10-24 22:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 14:21 Alex Musolino
2017-10-24 19:18 ` Giacomo Tesio
2017-10-24 22:07   ` Giacomo Tesio [this message]
2017-10-24 23:00 ` Chris McGee
2017-10-24 23:13   ` Giacomo Tesio
  -- strict thread matches above, loose matches on Subject: below --
2017-10-24  3:54 Alex Musolino
2017-10-24 11:19 ` Chris McGee
2017-10-06 23:33 Chris McGee
2017-10-07  1:42 ` Erik Quanstrom
2017-10-07  4:04 ` Skip Tavakkolian
2017-10-07 12:21   ` Chris McGee
2017-10-23 17:20     ` Yaroslav Kolomiiets
2017-10-24  1:48       ` Chris McGee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHL7psE75Kfphng4qwatXnOhtfu8Tm8-n1BhVSJsZhMJO--Nng@mail.gmail.com \
    --to=giacomo@tesio.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).