lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121031172101.GC20848@serge-ThinkPad-X130e>
Date:	Wed, 31 Oct 2012 18:21:01 +0100
From:	Serge Hallyn <serge.hallyn@...onical.com>
To:	Aristeu Rozanski <aris@...hat.com>
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Tejun Heo <tj@...nel.org>, Li Zefan <lizefan@...wei.com>,
	James Morris <jmorris@...ei.org>,
	Pavel Emelyanov <xemul@...nvz.org>,
	Jiri Slaby <jslaby@...e.cz>, cgroups@...r.kernel.org
Subject: Re: [PATCH] device_cgroup: fix unchecked cgroup parent usage

Quoting Aristeu Rozanski (aris@...hat.com):
> In 4cef7299b4786879a3e113e84084a72b24590c5b the cgroup parent usage is
> unchecked. root will not have a parent and trying to use
> device.{allow,deny} will cause problems. For some reason my stressing
> scripts didn't test the root directory so I didn't catch it on my
> regular tests.
> 
> Andrew, Tejun, this patch needs to make Linus tree ASAP or a revert for
> 4cef7299b4786879a3e113e84084a72b24590c5b.
> 
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Tejun Heo <tj@...nel.org>
> Cc: Li Zefan <lizefan@...wei.com>
> Cc: James Morris <jmorris@...ei.org>
> Cc: Pavel Emelyanov <xemul@...nvz.org>
> Cc: Serge Hallyn <serge.hallyn@...onical.com>

Acked-by: Serge E. Hallyn <serge.hallyn@...ntu.com>

> Cc: Jiri Slaby <jslaby@...e.cz>
> Signed-off-by: Aristeu Rozanski <aris@...hat.com>
> 
> --- github.orig/security/device_cgroup.c	2012-10-26 17:18:01.739366780 -0400
> +++ github/security/device_cgroup.c	2012-10-29 10:03:33.221918003 -0400
> @@ -352,6 +352,8 @@
>   */
>  static inline int may_allow_all(struct dev_cgroup *parent)
>  {
> +	if (!parent)
> +		return 1;
>  	return parent->behavior == DEVCG_DEFAULT_ALLOW;
>  }
>  
> @@ -376,11 +378,14 @@
>  	int count, rc;
>  	struct dev_exception_item ex;
>  	struct cgroup *p = devcgroup->css.cgroup;
> -	struct dev_cgroup *parent = cgroup_to_devcgroup(p->parent);
> +	struct dev_cgroup *parent = NULL;
>  
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
>  
> +	if (p->parent)
> +		parent = cgroup_to_devcgroup(p->parent);
> +
>  	memset(&ex, 0, sizeof(ex));
>  	b = buffer;
>  
> @@ -391,11 +396,14 @@
>  			if (!may_allow_all(parent))
>  				return -EPERM;
>  			dev_exception_clean(devcgroup);
> +			devcgroup->behavior = DEVCG_DEFAULT_ALLOW;
> +			if (!parent)
> +				break;
> +
>  			rc = dev_exceptions_copy(&devcgroup->exceptions,
>  						 &parent->exceptions);
>  			if (rc)
>  				return rc;
> -			devcgroup->behavior = DEVCG_DEFAULT_ALLOW;
>  			break;
>  		case DEVCG_DENY:
>  			dev_exception_clean(devcgroup);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ