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: <f80cefa2-e238-9939-5f48-9d84bcc248f3@suse.de>
Date:   Fri, 13 May 2022 23:20:57 +0800
From:   Coly Li <colyli@...e.de>
To:     Lin Feng <linf@...gsu.com>
Cc:     axboe@...nel.dk, linux-kernel@...r.kernel.org,
        linux-bcache@...r.kernel.org
Subject: Re: [PATCH] bcache: fix wrong BITMASK offset value for
 BDEV_CACHE_MODE

On 7/20/21 6:32 PM, Lin Feng wrote:
> Original codes:
> BITMASK(CACHE_SYNC,			struct cache_sb, flags, 0, 1);
> BITMASK(CACHE_DISCARD,			struct cache_sb, flags, 1, 1);
> BITMASK(CACHE_REPLACEMENT,		struct cache_sb, flags, 2, 3);
> ...
> BITMASK(BDEV_CACHE_MODE,		struct cache_sb, flags, 0, 4);
>
> Should BDEV_CACHE_MODE bits start from bit-nr 5(2+3) else it overlaps
> with previous defined bit chunks, since we have 4 types of cache modes,
> BDEV_CACHE_MODE will overwrite CACHE_SYNC and CACHE_DISCARD bits.

The overlap won't happen, previous lines are for cache device, and what 
you modified is for backing device.

And your patch changes the on-disk format, which is unacceptable anyway.


Coly Li

>
> This bug stays there since first upstream version of bcache, don't know
> why it lives so long, or am i missing something, please point me out
> if I'm wrong, thanks!
>
> Signed-off-by: Lin Feng <linf@...gsu.com>
> ---
>   include/uapi/linux/bcache.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
> index cf7399f03b71..dccd89756451 100644
> --- a/include/uapi/linux/bcache.h
> +++ b/include/uapi/linux/bcache.h
> @@ -288,7 +288,7 @@ BITMASK(CACHE_REPLACEMENT,		struct cache_sb, flags, 2, 3);
>   #define CACHE_REPLACEMENT_FIFO		1U
>   #define CACHE_REPLACEMENT_RANDOM	2U
>   
> -BITMASK(BDEV_CACHE_MODE,		struct cache_sb, flags, 0, 4);
> +BITMASK(BDEV_CACHE_MODE,		struct cache_sb, flags, 5, 4);
>   #define CACHE_MODE_WRITETHROUGH		0U
>   #define CACHE_MODE_WRITEBACK		1U
>   #define CACHE_MODE_WRITEAROUND		2U


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ