mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Alexey Dobriyan <adobriyan@sw.ru>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, devel@openvz.org
Subject: Re: [PATCH] Fix UTS corruption during clone(CLONE_NEWUTS)
Date: Fri, 14 Sep 2007 15:02:15 -0500	[thread overview]
Message-ID: <20070914200215.GA25105@vino.hallyn.com> (raw)
In-Reply-To: <20070914145730.GB27986@localhost.sw.ru>

Quoting Alexey Dobriyan (adobriyan@sw.ru):
> struct utsname is copied from master one without any exclusion.
> 
> Here is sample output from one proggie doing
> 
> 	sethostname("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
> 	sethostname("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
> 
> and another
> 
> 	clone(,, CLONE_NEWUTS, ...)
> 	uname()
> 
> 
> 	hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaabbbbb'
> 	hostname = 'bbbaaaaaaaaaaaaaaaaaaaaaaaaaaa'
> 	hostname = 'aaaaaaaabbbbbbbbbbbbbbbbbbbbbb'
> 	hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaaabbbb'
> 	hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaabb'
> 	hostname = 'aaabbbbbbbbbbbbbbbbbbbbbbbbbbb'
> 	hostname = 'bbbbbbbbbbbbbbbbaaaaaaaaaaaaaa'
> 
> Hostname is sometimes corrupted.
> 
> Yes, even _the_ simplest namespace activity had bug in it. :-(
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>

picking my jaw up off the floor just long enough to type

Signed-off-by: Serge Hallyn <serue@us.ibm.com>

and limp away in shame

thanks Alexey,
-serge

> ---
> 
>  kernel/utsname.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/kernel/utsname.c
> +++ b/kernel/utsname.c
> @@ -28,7 +28,9 @@ static struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns)
>  	if (!ns)
>  		return ERR_PTR(-ENOMEM);
>  
> +	down_read(&uts_sem);
>  	memcpy(&ns->name, &old_ns->name, sizeof(ns->name));
> +	up_read(&uts_sem);
>  	kref_init(&ns->kref);
>  	return ns;
>  }
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

      reply	other threads:[~2007-09-14 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 14:57 Alexey Dobriyan
2007-09-14 20:02 ` Serge E. Hallyn [this message]

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=20070914200215.GA25105@vino.hallyn.com \
    --to=serge@hallyn.com \
    --cc=adobriyan@sw.ru \
    --cc=akpm@osdl.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®