Linux Container Development
 help / color / mirror / Atom feed
From: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
To: Nathan Lynch <nathanl-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: user-cr thread safety
Date: Thu, 29 Jul 2010 18:14:57 -0400	[thread overview]
Message-ID: <4C51FD61.8070201@cs.columbia.edu> (raw)
In-Reply-To: <1280425072.3143.206.camel@localhost>



On 07/29/2010 01:37 PM, Nathan Lynch wrote:
> On Thu, 2010-07-29 at 10:56 -0400, Oren Laadan wrote:
>> 1) The separate fd-table between the coordinator and the feeder
>> is just a convenience and can be relatively easily relaxed so
>> that pthreads may be used. However, ...
>>
>> 2) More importantly, malloc() and printf() also occur in the
>> processes and threads generated during the creation of the new
>> (restored) task tree. So the same problems may occur there as
>> well. Unfortunately, here we can't use glibc, in part because
>> it is not even supported by glibc.
>>
>> Maybe a more robust way to address this is to: (1) use mmap()
>> and munmap() instead of malloc() and free(), and also (2) use
>> sprintf() + write() instead of printf().
>> That should make everything thread-safe. Did you notice other
>> libc calls which may be problematic ?
> 
> No, I think you covered it.  The only remaining concern I have is
> whether accesses to global state (like the context) are adequately
> serialized, and if not, what mechanism could provide mutual exclusion
> (semaphores?).

That global variables (*) like the context are set once prior
to the fork/clone starts, and are immutable thereafter.

So I'll go ahead and clean it up.

(*) except for signal handling, which I'd like to remove anyway.

Oren.

  reply	other threads:[~2010-07-29 22:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 18:37 user-cr thread safety Nathan Lynch
2010-07-29 14:56 ` Oren Laadan
     [not found]   ` <4C51968D.3000301-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-07-29 17:37     ` Nathan Lynch
2010-07-29 22:14       ` Oren Laadan [this message]
2010-07-30 17:08 ` [PATCH 1/4] restart: check for overflow when counting (nested) vpids Oren Laadan
2010-07-30 17:08 ` [PATCH 2/4] restart thread safety: remove malloc from ckpt_fork_child Oren Laadan
2010-07-30 17:08 ` [PATCH 3/4] restart thread safety: remove malloc from genstack Oren Laadan
     [not found]   ` <1280509713-6745-3-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-07-30 18:46     ` Matt Helsley
     [not found]       ` <20100730184641.GB3426-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-07-30 18:57         ` Oren Laadan
2010-08-04 23:08     ` Nathan Lynch
2010-07-30 17:08 ` [PATCH 4/4] restart thread-safety: avoid malloc in ckpt_msg() Oren Laadan
     [not found]   ` <1280509713-6745-4-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-08-04 23:30     ` Nathan Lynch
2010-08-04 23:56       ` Oren Laadan

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=4C51FD61.8070201@cs.columbia.edu \
    --to=orenl-eqauephvms7envbuuze7ea@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=nathanl-V7BBcbaFuwjMbYB6QlFGEg@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox