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: <20120921093252.GA15626@arwen.pp.htv.fi>
Date:	Fri, 21 Sep 2012 12:32:54 +0300
From:	Felipe Balbi <balbi@...com>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	Serge Hallyn <serge@...lyn.com>,
	Linux Containers <containers@...ts.linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Felipe Balbi <balbi@...com>
Subject: Re: [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid
 where appropriate

On Thu, Sep 20, 2012 at 04:41:44AM -0700, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@...ssion.com>
> 
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Felipe Balbi <balbi@...com>
> Acked-by: Serge Hallyn <serge.hallyn@...onical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>

Acked-by: Felipe Balbi <balbi@...com>

> ---
>  drivers/usb/gadget/f_fs.c |   23 ++++++++++++++++-------
>  init/Kconfig              |    1 -
>  2 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> index 8adc79d..f9ee4e0 100644
> --- a/drivers/usb/gadget/f_fs.c
> +++ b/drivers/usb/gadget/f_fs.c
> @@ -220,8 +220,8 @@ struct ffs_data {
>  	/* File permissions, written once when fs is mounted */
>  	struct ffs_file_perms {
>  		umode_t				mode;
> -		uid_t				uid;
> -		gid_t				gid;
> +		kuid_t				uid;
> +		kgid_t				gid;
>  	}				file_perms;
>  
>  	/*
> @@ -1143,10 +1143,19 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
>  			break;
>  
>  		case 3:
> -			if (!memcmp(opts, "uid", 3))
> -				data->perms.uid = value;
> +			if (!memcmp(opts, "uid", 3)) {
> +				data->perms.uid = make_kuid(current_user_ns(), value);
> +				if (!uid_valid(data->perms.uid)) {
> +					pr_err("%s: unmapped value: %lu\n", opts, value);
> +					return -EINVAL;
> +				}
> +			}
>  			else if (!memcmp(opts, "gid", 3))
> -				data->perms.gid = value;
> +				data->perms.gid = make_kgid(current_user_ns(), value);
> +				if (!gid_valid(data->perms.gid)) {
> +					pr_err("%s: unmapped value: %lu\n", opts, value);
> +					return -EINVAL;
> +				}
>  			else
>  				goto invalid;
>  			break;
> @@ -1175,8 +1184,8 @@ ffs_fs_mount(struct file_system_type *t, int flags,
>  	struct ffs_sb_fill_data data = {
>  		.perms = {
>  			.mode = S_IFREG | 0600,
> -			.uid = 0,
> -			.gid = 0
> +			.uid = GLOBAL_ROOT_UID,
> +			.gid = GLOBAL_ROOT_GID,
>  		},
>  		.root_mode = S_IFDIR | 0500,
>  	};
> diff --git a/init/Kconfig b/init/Kconfig
> index 633bde2..e7e0cc1 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -932,7 +932,6 @@ config UIDGID_CONVERTED
>  	depends on NET_9P = n
>  
>  	# Filesystems
> -	depends on USB_FUNCTIONFS = n
>  	depends on DEVTMPFS = n
>  	depends on XENFS = n
>  
> -- 
> 1.7.5.4
> 

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ