Linux Hardening
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-hardening@vger.kernel.org,
	Kees Cook <keescook@chromium.org>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>
Subject: Re: [PATCH v3 1/2] pstore: Remove worst-case compression size logic
Date: Wed, 12 Jul 2023 23:59:37 -0700	[thread overview]
Message-ID: <20230713065937.GA2199@sol.localdomain> (raw)
In-Reply-To: <20230712162332.2670437-2-ardb@kernel.org>

On Wed, Jul 12, 2023 at 06:23:31PM +0200, Ard Biesheuvel wrote:
> The worst case compression size used by pstore gives an upper bound for
> how much the data might inadvertently *grow* due to encapsulation
> overhead if the input is not compressible at all.
> 
> Given that pstore records have individual 'compressed' flags, we can
> simply store the uncompressed data if compressing it would end up using
> more space, making the worst case identical to the uncompressed case.
> 
> This means we can just drop all the elaborate logic that reasons about
> upper bounds for each individual compression algorithm, and just store
> the uncompressed data directly if compression fails for any reason.
> 
> Co-developed-by: Kees Cook <keescook@chromium.org>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com> # Steam Deck
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  fs/pstore/platform.c | 206 ++------------------
>  1 file changed, 19 insertions(+), 187 deletions(-)

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

  reply	other threads:[~2023-07-13  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 16:23 [PATCH v3 0/2] pstore: Replace crypto API compression with zlib calls Ard Biesheuvel
2023-07-12 16:23 ` [PATCH v3 1/2] pstore: Remove worst-case compression size logic Ard Biesheuvel
2023-07-13  6:59   ` Eric Biggers [this message]
2023-07-12 16:23 ` [PATCH v3 2/2] pstore: Replace crypto API compression with zlib_deflate library calls Ard Biesheuvel
2023-07-13  7:00   ` Eric Biggers
2023-07-13 17:37 ` [PATCH v3 0/2] pstore: Replace crypto API compression with zlib calls Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230713065937.GA2199@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=gpiccoli@igalia.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox