OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] reject ' ' in a cgroup name
[PATCH] reject ' ' in a cgroup name [message #26451] Thu, 24 January 2008 05:20 Go to next message
yamamoto is currently offline  yamamoto
Messages: 97
Registered: July 2007
Member
hi,

the following patch rejects '\n' in a cgroup name.
otherwise /proc/$$/cgroup is not parsable.

example:
	imawoto% cat /proc/$$/cgroup
	memory:/
	imawoto% mkdir -p "
	memory:/foo"
	imawoto% echo $$ >| "
	memory:/foo/tasks"
	imawoto% cat /proc/$$/cgroup
	memory:/
	memory:/foo
	imawoto% 

YAMAMOTO Takashi


Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
---

--- linux-2.6.24-rc8-mm1/kernel/cgroup.c.BACKUP	2008-01-23 14:43:29.000000000 +0900
+++ linux-2.6.24-rc8-mm1/kernel/cgroup.c	2008-01-24 13:56:28.000000000 +0900
@@ -2216,6 +2216,10 @@ static long cgroup_create(struct cgroup 
 	struct cgroup_subsys *ss;
 	struct super_block *sb = root->sb;
 
+	/* reject a newline.  otherwise /proc/$$/cgroup is not parsable. */
+	if (strchr(dentry->d_name.name, '\n'))
+		return -EINVAL;
+
 	cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
 	if (!cgrp)
 		return -ENOMEM;
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH] reject ' ' in a cgroup name [message #26545 is a reply to message #26451] Mon, 28 January 2008 07:49 Go to previous messageGo to next message
Paul Menage is currently offline  Paul Menage
Messages: 642
Registered: September 2006
Senior Member
Looks sensible - maybe we should ban all characters not in [a-zA-Z0-9._-] ?

Paul

On Jan 23, 2008 9:20 PM, YAMAMOTO Takashi <yamamoto@valinux.co.jp> wrote:
> hi,
>
> the following patch rejects '\n' in a cgroup name.
> otherwise /proc/$$/cgroup is not parsable.
>
> example:
>         imawoto% cat /proc/$$/cgroup
>         memory:/
>         imawoto% mkdir -p "
>         memory:/foo"
>         imawoto% echo $$ >| "
>         memory:/foo/tasks"
>         imawoto% cat /proc/$$/cgroup
>         memory:/
>         memory:/foo
>         imawoto%
>
> YAMAMOTO Takashi
>
>
> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
> ---
>
> --- linux-2.6.24-rc8-mm1/kernel/cgroup.c.BACKUP 2008-01-23 14:43:29.000000000 +0900
> +++ linux-2.6.24-rc8-mm1/kernel/cgroup.c        2008-01-24 13:56:28.000000000 +0900
> @@ -2216,6 +2216,10 @@ static long cgroup_create(struct cgroup
>         struct cgroup_subsys *ss;
>         struct super_block *sb = root->sb;
>
> +       /* reject a newline.  otherwise /proc/$$/cgroup is not parsable. */
> +       if (strchr(dentry->d_name.name, '\n'))
> +               return -EINVAL;
> +
>         cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
>         if (!cgrp)
>                 return -ENOMEM;
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH] reject ' ' in a cgroup name [message #26648 is a reply to message #26545] Wed, 30 January 2008 01:32 Go to previous message
KAMEZAWA Hiroyuki is currently offline  KAMEZAWA Hiroyuki
Messages: 463
Registered: September 2006
Senior Member
On Sun, 27 Jan 2008 23:49:04 -0800
"Paul Menage" <menage@google.com> wrote:

> Looks sensible - maybe we should ban all characters not in [a-zA-Z0-9._-] ?
> 
Hmm, ' ' (white space) please.

but it seems that the cgroup rejects multibyte charactor names. 
(I myself don't like it but..)

So, please add a section for 'acceptable names for cgroup' to cgroup
documentation.

Thanks,
-Kame


> Paul
> 
> On Jan 23, 2008 9:20 PM, YAMAMOTO Takashi <yamamoto@valinux.co.jp> wrote:
> > hi,
> >
> > the following patch rejects '\n' in a cgroup name.
> > otherwise /proc/$$/cgroup is not parsable.
> >
> > example:
> >         imawoto% cat /proc/$$/cgroup
> >         memory:/
> >         imawoto% mkdir -p "
> >         memory:/foo"
> >         imawoto% echo $$ >| "
> >         memory:/foo/tasks"
> >         imawoto% cat /proc/$$/cgroup
> >         memory:/
> >         memory:/foo
> >         imawoto%
> >
> > YAMAMOTO Takashi
> >
> >
> > Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
> > ---
> >
> > --- linux-2.6.24-rc8-mm1/kernel/cgroup.c.BACKUP 2008-01-23 14:43:29.000000000 +0900
> > +++ linux-2.6.24-rc8-mm1/kernel/cgroup.c        2008-01-24 13:56:28.000000000 +0900
> > @@ -2216,6 +2216,10 @@ static long cgroup_create(struct cgroup
> >         struct cgroup_subsys *ss;
> >         struct super_block *sb = root->sb;
> >
> > +       /* reject a newline.  otherwise /proc/$$/cgroup is not parsable. */
> > +       if (strchr(dentry->d_name.name, '\n'))
> > +               return -EINVAL;
> > +
> >         cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
> >         if (!cgrp)
> >                 return -ENOMEM;
> >
> > --
> > To unsubscribe, send a message with 'unsubscribe linux-mm' in
> > the body to majordomo@kvack.org.  For more info on Linux MM,
> > see: http://www.linux-mm.org/ .
> > Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> >
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: Re: LTP result output for container-init
Next Topic: Re: [Xen-devel] dm-band: The I/O bandwidth controller: Performance Report
Goto Forum:
  


Current Time: Sat Jun 22 04:15:44 GMT 2024

Total time taken to generate the page: 0.02689 seconds