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]
Message-ID: <20100112054141.GA10756@us.ibm.com>
Date:	Mon, 11 Jan 2010 23:41:41 -0600
From:	"Serge E. Hallyn" <serue@...ibm.com>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>,
	Kay Sievers <kay.sievers@...y.org>,
	linux-kernel@...r.kernel.org, Tejun Heo <tj@...nel.org>,
	Cornelia Huck <cornelia.huck@...ibm.com>,
	linux-fsdevel@...r.kernel.org,
	Eric Dumazet <eric.dumazet@...il.com>,
	Benjamin LaHaise <bcrl@...et.ca>,
	"Eric W. Biederman" <ebiederm@...stanetworks.com>
Subject: Re: [PATCH 1/7] sysfs: Serialize updates to the vfs inode

Quoting Eric W. Biederman (ebiederm@...ssion.com):
> From: Eric W. Biederman <ebiederm@...stanetworks.com>
> 
> The way the vfs is structured only calls to the filesystem
> methods actually update the vfs inode.  We add to the
> normal number of places where the vfs inode is updated by
> also updating the vfs inode in sysfs_refresh_inode.
> 
> Grabbing the inode mutex in sysfs_permission and sysfs_getattr
> causes deadlocks, because somtimes those operations are called
> with the inode mutex held, but not always.  Therefore we can
> not depend upon the inode mutex to serialize all updates
> to the vfs inode.
> 
> We take the sysfs_mutex in all of those places so we can
> also use it to protect the vfs inode.  To accomplish that
> we simply requires extending the vfs inode in sysfs_setattr
> over inode_change_ok (so we have an unchanging inode
> when we perform the check), and inode_setattr.
> 
> Signed-off-by: Eric W. Biederman <ebiederm@...stanetworks.com>

I'm a little confused about the patch intro:  it makes it sound
like this is preparatory for a followup, but in fact it is a bugfix,
right?  Hard to exploit i think, but should it go to -stable?

Acked-by: Serge Hallyn <serue@...ibm.com>

> ---
>  fs/sysfs/inode.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
> index 220b758..104cbc1 100644
> --- a/fs/sysfs/inode.c
> +++ b/fs/sysfs/inode.c
> @@ -112,20 +112,20 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr)
>  	if (!sd)
>  		return -EINVAL;
> 
> +	mutex_lock(&sysfs_mutex);
>  	error = inode_change_ok(inode, iattr);
>  	if (error)
> -		return error;
> +		goto out;
> 
>  	iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */
> 
>  	error = inode_setattr(inode, iattr);
>  	if (error)
> -		return error;
> +		goto out;
> 
> -	mutex_lock(&sysfs_mutex);
>  	error = sysfs_sd_setattr(sd, iattr);
> +out:
>  	mutex_unlock(&sysfs_mutex);
> -
>  	return error;
>  }
> 
> -- 
> 1.6.5.2.143.g8cc62
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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