public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nadia Derbey <Nadia.Derbey@bull.net>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: containers@lists.linux-foundation.org, nick@nick-andrew.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/4] - v2 -  Object creation with a specified id
Date: Mon, 21 Apr 2008 13:32:41 +0200	[thread overview]
Message-ID: <480C7B59.9060801@bull.net> (raw)
In-Reply-To: <1208538427.25363.40.camel@nimitz.home.sr71.net>

Dave Hansen wrote:
> On Fri, 2008-04-18 at 07:44 +0200, Nadia.Derbey@bull.net wrote:
> 
>>The syntax is one of:
>>   . echo "LONG XX" > /proc/self/task/<my_tid>/next_id
>>     next object to be created will have an id set to XX
>>   . echo "LONG<n> X0 ... X<n-1>" > /proc/self/task/<my_tid>/next_id
>>     next object to be created will have its ids set to XX0, ... X<n-1>
>>     This is particularly useful for processes that may have several ids if
>>     they belong to nested namespaces.
> 
> 
> I still think, in its current form, this is pretty dangerous.  
> 
> It might be nice to have a central place to set ids, but there's no real
> safety here for when we get a mishmash of 50 of these things.  We have a
> queue and we fix the order in which things are inserted, but how do we
> control the order in which the kernel extracts them?

I thought that we were the ones who are going to be controlling the 
restart phase?

I think sysV IPCs are particular, since they could be recreated early 
during the restart phase:
we could define a callback routine that would be called by each process 
being restarted and that would do:
for each ipc type:
   1. extract next ipc id for my uid and current ipc type
   2. write(fd_next_id, id, id_sz)
   3. call the XXXget() routine for current ipc_type
   4. remove that id from the checkpoint file

I think this could only be applied to msg queues and sems, since the 
creator pid is stored in the perm structure in the shm case. But in the 
shm case, we can replace in 1. "my uid" by "my tgid_vnr"

Then the processes hierarchy restore would take place, so no confusion 
between the ids.


> Can we 100%
> conform to that order in the future and be consistent?  Won't that also
> be dictated by the way userspace behaves?
> 
> If we're going to go this route, I think we need to do a few things.
> First, these need to be more "type safe".  That means that sticking an
> ids in here that you mean to go to an IPC should never, ever, ever be
> able to get interpreted as a PID or as an inode number or anything else.
> 
> 	echo "IPC_SEM_ID NN" > /proc/self/task/<my_tid>/next_id
> 	echo "PID MM" > /proc/self/task/<my_tid>/next_id
> 
> Maybe we should include the types in there as well, but those are kinda
> implied by the kind of id you're setting.  Have you thought about 32-bit
> userspace with 64-bit kernels? 

No, but the ids are int in the ipc case and in the pid_t case too.

> Does that cause any issues?
> 
> I also feel like we should have the kernel able to enumerate which
> things in a process *are* settable.  What are the valid values for that
> first word being echoed in the file?
> 
> Does anyone have a list of these ids that we're going to want to set
> like this?  Oren?  I'm a bit worried that we might want to set things
> other than ids with an interface like this and that it won't transition
> well.
> 

Regards,
Nadia



  reply	other threads:[~2008-04-21 11:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18  5:44 [PATCH 0/4] - v2 - Object creation with a specified id Nadia.Derbey
2008-04-18  5:45 ` [PATCH 1/4] - v2 - Provide a new procfs interface to set next id Nadia.Derbey
2008-04-18  5:45 ` [PATCH 2/4] - v2 - Provide a new procfs interface to set next upid nr(s) Nadia.Derbey
2008-04-18  5:45 ` [PATCH 3/4] - v2 - IPC: use the target ID specified in procfs Nadia.Derbey
2008-04-18  5:45 ` [PATCH 4/4] - v2 - PID: " Nadia.Derbey
2008-04-18 17:07 ` [PATCH 0/4] - v2 - Object creation with a specified id Dave Hansen
2008-04-21 11:32   ` Nadia Derbey [this message]
2008-04-22 19:36 ` Checkpoint/restart (was Re: [PATCH 0/4] - v2 - Object creation with a specified id) Alexey Dobriyan
2008-04-22 18:56   ` Dave Hansen
2008-04-22 19:51     ` Serge E. Hallyn
2008-04-22 21:01     ` Alexey Dobriyan
2008-04-22 22:56       ` Dave Hansen
2008-04-23  6:40         ` Kirill Korotaev
2008-04-23 15:33           ` Dave Hansen
2008-04-24  7:00             ` Kirill Korotaev
2008-04-24 18:30               ` Dave Hansen
2008-04-24 23:13                 ` Oren Laadan
2008-04-24  1:19           ` Oren Laadan
2008-07-10  1:58             ` Eric W. Biederman
2008-07-10 17:12               ` Dave Hansen
2008-07-10 17:32                 ` Serge E. Hallyn
2008-07-10 18:55                   ` Eric W. Biederman
2008-07-10 19:06                     ` Dave Hansen
2008-07-10 19:21                       ` Eric W. Biederman
2008-07-10 19:47                         ` Dave Hansen
2008-07-11  0:32                           ` Alexey Dobriyan
2008-07-17 23:19                           ` Oren Laadan
2008-07-17 23:16                   ` Oren Laadan
2008-07-18 16:18                     ` Serge E. Hallyn
2008-07-17 23:14                 ` Oren Laadan
2008-07-17 23:09               ` Oren Laadan
2008-04-23 14:23 ` [PATCH 0/4] - v2 - Object creation with a specified id Pavel Machek

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=480C7B59.9060801@bull.net \
    --to=nadia.derbey@bull.net \
    --cc=containers@lists.linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick@nick-andrew.net \
    /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