From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [RFC][PATCH 2/3] c/r: [pty 1/2] allow allocation of desired pty slave
Date: Tue, 25 Aug 2009 09:58:17 -0500 [thread overview]
Message-ID: <20090825145817.GA22351@us.ibm.com> (raw)
In-Reply-To: <1250642549-23656-3-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
Quoting Oren Laadan (orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org):
> During restart, we need to allocate pty slaves with the same
> identifiers as recorded during checkpoint. Modify the allocation code
> to allow an in-kernel caller to request a specific slave identifier.
>
> For this, add a new field to task_struct - 'required_id'. It will
> hold the desired identifier when restoring a (master) pty.
This is really unfortunate.
I assume you left the rather generic name 'required_id' because
you intend to use it for other calls as well? Which is even
more unfortunate...
I know I'm generally the one who pushes for re-using existing
helpers as much as possible, both to avoid missing existing
security checks, and to prevent future code changes which forget
to update the c/r code.
But in this case I don't think re-using fopen to ask the kernel
to create a new device with more info than fopen usually gets is
right. Unfortunately, actually coming up with 'the right way' is
escaping me at the moment :)
Though... then again... your code is hardcoded for devpts and
opening /dev/ptmx anyway, so surely we can create a new helper
which takes a devpts_ns and index and returns the new devpts
tty_struct without using the current->required_id?
Then, if we ever want to support a tty type other than unix98,
maybe we can more generally split up more like:
1. add 'struct tty_struct *make_tty(struct tty_driver *driver,
void *data) to tty_operations. It is
undefined for all but devpts.
2. for devpts, the void *data includes an int devpts_ns_id
and index
3. the container-level checkpoint stores a relation between
pathnames and devpts_ns_id. devpts_ns_id is valid
only for one checkpoint image. The pathname is
where that devpts_ns is mounted. If we ever start
checkpointing and restoring fs mounts from kernel,
then we can tweak this treatment. For now it is
assumed (and verified) that at restart, pathname is
in fact where a devpts instance is mounted.
4. the tty_struct itself is checkpointed and restored. It
is restored using make_tty() in tty_operations,
and for devpts the void *data is a struct storing
the devpts_ns_id and index.
5. when a struct file for a devpts is restored, the tty_struct
will already have been re-created. The tty_struct's objref
is stored in the file struct checkpoint data.
It requires more finagling of the file/inode/tty_struct relationship
though... But I don't see required_id being acceptable upstream.
Of course I've been wrong about such things before.
-serge
next prev parent reply other threads:[~2009-08-25 14:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-19 0:42 [RFC] checkpoint/restart of PTYs Oren Laadan
[not found] ` <1250642549-23656-1-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-08-19 0:42 ` [RFC][PATCH 1/3] c/r: [objhash] add ckpt_obj_reserve() Oren Laadan
2009-08-19 0:42 ` [RFC][PATCH 2/3] c/r: [pty 1/2] allow allocation of desired pty slave Oren Laadan
[not found] ` <1250642549-23656-3-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-08-25 14:58 ` Serge E. Hallyn [this message]
[not found] ` <20090825145817.GA22351-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-08-25 18:28 ` Oren Laadan
2009-08-19 0:42 ` [RFC][PATCH 3/3] c/r: [pty 2/2] support for pseudo terminals Oren Laadan
[not found] ` <1250642549-23656-4-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-02 14:48 ` Serge E. Hallyn
[not found] ` <20090902144837.GA15116-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-02 22:54 ` Oren Laadan
[not found] ` <4A9EF7A9.4060507-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-02 23:05 ` Serge E. Hallyn
[not found] ` <20090902230549.GB26324-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-02 23:43 ` Oren Laadan
[not found] ` <4A9F0323.2090000-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-03 4:41 ` Serge E. Hallyn
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=20090825145817.GA22351@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.