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:	Tue, 2 Sep 2014 13:01:54 -0600
From:	Andreas Dilger <adilger@...ger.ca>
To:	Theodore Ts'o <tytso@....edu>
Cc:	Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH] ext4: fix accidental flag aliasing in ext4_map_blocks flags

On Aug 31, 2014, at 2:00 PM, Theodore Ts'o <tytso@....edu> wrote:
> Commit b8a8684502a0f introduced an accidental flag aliasing between
> EXT4_EX_NOCACHE and EXT4_GET_BLOCKS_CONVERT_UNWRITTEN.
> 
> Fortunately, this didn't introduce any untorward side effects --- we
> got lucky.  Nevertheless, fix this and leave a warning to hopefully
> avoid this from happening in the future.

Why not move EXT4_EX_*CACHE flags to the end of the range (e.g. 0x8000
and 0x4000) to minimize potential conflicts in the future?

> Signed-off-by: Theodore Ts'o <tytso@....edu>
> ---
> fs/ext4/ext4.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index cf3ad75..550b4f9 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -569,6 +569,7 @@ enum {
> #define EXT4_GET_BLOCKS_NO_PUT_HOLE		0x0200
> 	/* Convert written extents to unwritten */
> #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN	0x0400
> +/* DO NOT ASSIGN ADDITIONAL FLAG VALUES WITHOUT ADJUSTING THE FLAGS BELOW

It might be useful here to mention the EXT4_EX_* flags explicitly?
In my experience, time and incremental changes will make it less
clear what "FLAGS BELOW" means...

Cheers, Andreas

> /*
>  * The bit position of these flags must not overlap with any of the
> @@ -579,8 +580,8 @@ enum {
>  * caching the extents when reading from the extent tree while a
>  * truncate or punch hole operation is in progress.
>  */
> -#define EXT4_EX_NOCACHE				0x0400
> -#define EXT4_EX_FORCE_CACHE			0x0800
> +#define EXT4_EX_NOCACHE				0x0800
> +#define EXT4_EX_FORCE_CACHE			0x1000
> 
> /*
>  * Flags used by ext4_free_blocks
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas






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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ