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: <20071029093618.2c671643@think.oraclecorp.com>
Date:	Mon, 29 Oct 2007 09:36:18 -0400
From:	Chris Mason <chris.mason@...cle.com>
To:	Mike Waychison <mikew@...gle.com>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	Mike Waychison <mikew@...gle.com>
Subject: Re: [patch 4/6][RFC] Attempt to plug race with truncate

On Fri, 26 Oct 2007 16:37:36 -0700
Mike Waychison <mikew@...gle.com> wrote:

> Attempt to deal with races with truncate paths.
> 
> I'm not really sure on the locking here, but these seem to be taken
> by the truncate path.  BKL is left as some filesystem may(?) still
> require it.
> 
> Signed-off-by: Mike Waychison <mikew@...gle.com>
>  fs/ioctl.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> Index: linux-2.6.23/fs/ioctl.c
> ===================================================================
> --- linux-2.6.23.orig/fs/ioctl.c	2007-10-26 15:27:29.000000000
> -0700 +++ linux-2.6.23/fs/ioctl.c	2007-10-26
> 16:16:28.000000000 -0700 @@ -43,13 +43,21 @@ static long
> do_ioctl(struct file *filp, static int do_fibmap(struct address_space
> *mapping, sector_t block, sector_t *phys_block)
>  {
> +	struct inode *inode = mapping->host;
> +
>  	if (!capable(CAP_SYS_RAWIO))
>  		return -EPERM;
>  	if (!mapping->a_ops->bmap)
>  		return -EINVAL;
>  
>  	lock_kernel();
> +	/* Avoid races with truncate */
> +	mutex_lock(&inode->i_mutex);
> +	/* FIXME: Do we really need i_alloc_sem? */
> +	down_read(&inode->i_alloc_sem);


i_alloc_sem will avoid races with filesystems filling holes inside
writepage (where i_mutex isn't held).  I'd expect everyone to currently
give some consistent result (either the old value or the new but not
garbage), but I wouldn't expect taking the semaphore to hurt anything.

-chris
-
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