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: <Zx_QOW79R5m6mg21@google.com>
Date: Mon, 28 Oct 2024 13:56:09 -0400
From: Brian Geffon <bgeffon@...gle.com>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	Minchan Kim <minchan@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 1/2] zram: clear IDLE flag after recompression

On Tue, Oct 29, 2024 at 12:36:14AM +0900, Sergey Senozhatsky wrote:
> Recompression should clear ZRAM_IDLE flag on the entries
> it has accessed, because otherwise some entries, specifically
> those for which recompression has failed, become immediate
> candidate entries for another post-processing (e.g. writeback).
> 
> Consider the following case:
> - recompression marks entries IDLE every 4 hours and attempts
>   to recompress them
> - some entries are incompressible, so we keep them intact and
>   hence preserve IDLE flag
> - writeback marks entries IDLE every 8 hours and writebacks
>   IDLE entries, however we have IDLE entries left from
>   recompression, so writeback prematurely writebacks those
>   entries.
> 
> The bug was reported by Shin Kawamura.
Reported-by: Shin Kawamura <kawasin@...gle.com>

> 
> Fixes: 84b33bf78889 ("zram: introduce recompress sysfs knob")
> Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
Acked-by: Brian Geffon <bgeffon@...gle.com>

> ---
>  drivers/block/zram/zram_drv.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index e6d12e81241d..a16dbffcdca3 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1864,6 +1864,13 @@ static int recompress_slot(struct zram *zram, u32 index, struct page *page,
>  	if (ret)
>  		return ret;
>  
> +	/*
> +	 * We touched this entry so mark it as non-IDLE. This makes sure that
> +	 * we don't preserve IDLE flag and don't incorrectly pick this entry
> +	 * for different post-processing type (e.g. writeback).
> +	 */
> +	zram_clear_flag(zram, index, ZRAM_IDLE);
> +
>  	class_index_old = zs_lookup_class_index(zram->mem_pool, comp_len_old);
>  	/*
>  	 * Iterate the secondary comp algorithms list (in order of priority)
> -- 
> 2.47.0.163.g1226f6d8fa-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ