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: <8fe873d4-b9c4-47ad-b779-e1012677011e@t-8ch.de>
Date: Sat, 6 Jul 2024 09:50:57 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
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: [PATCHv5 04/23] zram: introduce custom comp backends API

On 2024-07-06 13:56:06+0000, Sergey Senozhatsky wrote:
> Moving to custom backends implementation gives us ability to
> have our own minimalistic and extendable API, and algorithms
> tunings becomes possible.
> 
> The list of compression backends is empty at this point,
> we will add backends in the followup patches.
> 
> Signed-off-by: Sergey Senozhatsky <senozhatsky@...omium.org>
> ---
>  drivers/block/zram/Kconfig    |  39 +--------
>  drivers/block/zram/zcomp.c    | 151 +++++++++++-----------------------
>  drivers/block/zram/zcomp.h    |  29 ++++---
>  drivers/block/zram/zram_drv.c |   9 +-
>  4 files changed, 76 insertions(+), 152 deletions(-)

<snip>

> --- a/drivers/block/zram/zcomp.h
> +++ b/drivers/block/zram/zcomp.h
> @@ -1,7 +1,4 @@
>  /* SPDX-License-Identifier: GPL-2.0-or-later */
> -/*
> - * Copyright (C) 2014 Sergey Senozhatsky.
> - */
>  
>  #ifndef _ZCOMP_H_
>  #define _ZCOMP_H_
> @@ -12,13 +9,26 @@ struct zcomp_strm {
>  	local_lock_t lock;
>  	/* compression/decompression buffer */
>  	void *buffer;
> -	struct crypto_comp *tfm;
> +	void *ctx;
> +};
> +
> +struct zcomp_ops {
> +	int (*compress)(void *ctx, const unsigned char *src, size_t src_len,
> +			unsigned char *dst, size_t *dst_len);
> +
> +	int (*decompress)(void *ctx, const unsigned char *src, size_t src_len,
> +			  unsigned char *dst, size_t dst_len);
> +
> +	void *(*create_ctx)(void);
> +	void (*destroy_ctx)(void *ctx);
> +
> +	const char *name;
>  };
>  
>  /* dynamic per-device compression frontend */
>  struct zcomp {
>  	struct zcomp_strm __percpu *stream;
> -	const char *name;
> +	struct zcomp_ops *ops;

If this is "const struct zcomp_ops *ops" then all the backend struct
zcomp_ops definitions could be constified, improving security.

"zcomp_ops" could also be added to scripts/const_structs.checkpatch,
but there probably won't be many of them anyways.

>  	struct hlist_node node;
>  };

<snip>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ