Re: [PATCH] mkfs.cramfs: fix potential uid, gid or mode drop.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 17, 2014 at 10:16:54PM +0200, arnaud.mouiche@xxxxxxxxx wrote:
> From: Arnaud Mouiche <arnaud.mouiche@xxxxxxxxxxx>
> 
> find_identical_file() may squash files with identical contents, but
> different uid/gid or mode.
> 
> here is a test script to show the problem (to run as root):
> without this patch, the output is
> 
>   -rw-r--r-- 1 root root 4 janv.  1  1970 a
>   -rw-r--r-- 1 root root 4 janv.  1  1970 b
>   -rw-r--r-- 1 root root 4 janv.  1  1970 c
> 
> whereas the expected result should be
> 
>   -rw-r--r-- 1 root   root 4 janv.  1  1970 a
>   -rw------- 1 root   root 4 janv.  1  1970 b
>   -rw-r--r-- 1 daemon root 4 janv.  1  1970 c

 Strange. 

> -	if (orig->size == new->size && orig->path) {
> +	if (orig->size == new->size &&
> +		orig->uid == new->uid &&
> +		orig->gid == new->gid &&
> +		orig->mode == new->mode &&
> +		orig->path) {
>  		if (!orig->flags)
>  			mdfile(orig);
>  		if (!new->flags)

 I don't think this is right solution. The content de-duplication code
 has to be independent on file name, uid/gid and mode. The
 de-duplication does not mean that info about the file has been
 removed from the cramfs image.
 
 The filesystem still contains file specific inode. So if you see a
 different filename then you have to see a different uid/gid too.
 (I guess.)


    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux