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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 22 Oct 2012 11:16:10 -0500
From:	Serge Hallyn <serge.hallyn@...onical.com>
To:	Aristeu Rozanski <aris@...hat.com>
Cc:	linux-kernel@...r.kernel.org, Dave Jones <davej@...hat.com>,
	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 4/4] device_cgroup: add proper checking when changing
 default behavior

Quoting Aristeu Rozanski (aris@...hat.com):
> Before changing a group's default behavior to ALLOW, we must check if its
> parent's behavior is also ALLOW.
> 
> 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>

Thanks, Aristeu.

> Cc: Jiri Slaby <jslaby@...e.cz>
> Signed-off-by: Aristeu Rozanski <aris@...hat.com>
> 
> ---
>  security/device_cgroup.c |   19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> --- github.orig/security/device_cgroup.c	2012-10-19 16:36:50.135790476 -0400
> +++ github/security/device_cgroup.c	2012-10-19 16:48:50.710978125 -0400
> @@ -344,6 +344,17 @@ static int parent_has_perm(struct dev_cg
>  	return may_access(parent, ex);
>  }
>  
> +/**
> + * may_allow_all - checks if it's possible to change the behavior to
> + *		   allow based on parent's rules.
> + * @parent: device cgroup's parent
> + * returns: != 0 in case it's allowed, 0 otherwise
> + */
> +static inline int may_allow_all(struct dev_cgroup *parent)
> +{
> +	return parent->behavior == DEVCG_DEFAULT_ALLOW;
> +}
> +
>  /*
>   * Modify the exception list using allow/deny rules.
>   * CAP_SYS_ADMIN is needed for this.  It's at least separate from CAP_MKNOD
> @@ -364,6 +375,8 @@ static int devcgroup_update_access(struc
>  	char temp[12];		/* 11 + 1 characters needed for a u32 */
>  	int count, rc;
>  	struct dev_exception_item ex;
> +	struct cgroup *p = devcgroup->css.cgroup;
> +	struct dev_cgroup *parent = cgroup_to_devcgroup(p->parent);
>  
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
> @@ -375,9 +388,13 @@ 	memset(&ex, 0, sizeof(ex));
>  	case 'a':
>  		switch (filetype) {
>  		case DEVCG_ALLOW:
> -			if (!parent_has_perm(devcgroup, &ex))
> +			if (!may_allow_all(parent))
>  				return -EPERM;
>  			dev_exception_clean(devcgroup);
> +			rc = dev_exceptions_copy(&devcgroup->exceptions,
> +						 &parent->exceptions);
> +			if (rc)
> +				return rc;
>  			devcgroup->behavior = DEVCG_DEFAULT_ALLOW;
>  			break;
>  		case DEVCG_DENY:
> 
--
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