linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
To: Ard Biesheuvel <ardb@kernel.org>, Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	kernel-dev@igalia.com, kernel@gpiccoli.net, anton@enomsg.org,
	ccross@android.com, tony.luck@intel.com
Subject: Re: [PATCH 5/8] pstore: Fix long-term implicit conversions in the compression routines
Date: Sat, 8 Oct 2022 13:03:38 -0300	[thread overview]
Message-ID: <dbe57a5e-7486-649f-7093-6da6312a71ee@igalia.com> (raw)
In-Reply-To: <CAMj1kXHSSSZ59tihHDNDamczxFCRH8NHzT-eKaZ7xNyqVXW1Hw@mail.gmail.com>

On 08/10/2022 12:53, Ard Biesheuvel wrote:
> [...]
> So one thing I don't understand about these changes is why we need
> them in the first place.
> 
> The zbufsize routines are all worst case routines, which means each
> one of those will return a value that exceeds the size parameter.
> 
> We only use compression for dmesg, which compresses quite well. If it
> doesn't compress well, there is probably something wrong with the
> input data, so preserving it may not be as critical. And if
> compressing the data makes it bigger, can't we just omit the
> compression for that particular record?
> 
> In summary, while adding zbufsize to the crypto API seems a reasonable
> thing to do, I don't see why we'd want to make use of it in pstore -
> can't we just use the decompressed size as the worst case compressed
> size for all algorithms, and skip the compression if it doesn't fit?
> 
> Or am I missing something here?

In a way (and if I understand you correctly - please let me know if not)
you are making lot of sense: why not just use the maximum size (which is
the full decompressed size + header) as the worst case in pstore and
skip these highly specialized routines that calculate the worst case for
each algorithm, right?

This is exactly what 842 (sw compress) is doing now. If that's
interesting and Kees agrees, and if nobody else plans on doing that, I
could work on it.

Extra question (maybe silly on my side?): is it possible that
_compressed_ data is bigger than the original one? Isn't there any
"protection" on the compress APIs for that? In that case, it'd purely
waste of time / CPU cycles heheh

Cheers,


Guilherme

  reply	other threads:[~2022-10-08 16:04 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 22:42 [PATCH 0/8] Some pstore improvements Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 1/8] pstore: Improve error reporting in case of backend overlap Guilherme G. Piccoli
2022-10-06 23:27   ` Kees Cook
2022-10-06 23:35     ` Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 2/8] pstore: Expose kmsg_bytes as a module parameter Guilherme G. Piccoli
2022-10-06 23:32   ` Kees Cook
2022-10-12 15:33     ` Guilherme G. Piccoli
2022-10-12 17:58       ` Kees Cook
2022-11-01 19:08         ` Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 3/8] pstore: Inform unregistered backend names as well Guilherme G. Piccoli
2022-10-06 22:42 ` [PATCH 4/8] pstore: Alert on backend write error Guilherme G. Piccoli
2022-10-06 23:27   ` Kees Cook
2022-10-06 23:34     ` Guilherme G. Piccoli
2022-10-06 23:44       ` Kees Cook
2022-10-06 22:42 ` [PATCH 5/8] pstore: Fix long-term implicit conversions in the compression routines Guilherme G. Piccoli
2022-10-06 23:36   ` Kees Cook
2022-10-07  8:47     ` Ard Biesheuvel
2022-10-07 19:37       ` Kees Cook
2022-10-08 14:14         ` Guilherme G. Piccoli
2022-10-08 15:53           ` Ard Biesheuvel
2022-10-08 16:03             ` Guilherme G. Piccoli [this message]
2022-10-08 17:52               ` Ard Biesheuvel
2022-10-08 18:12                 ` Guilherme G. Piccoli
2022-10-08 19:44                 ` Kees Cook
2022-10-10  7:24                   ` Ard Biesheuvel
2022-10-06 22:42 ` [PATCH 6/8] MAINTAINERS: Add a mailing-list for the pstore infrastructure Guilherme G. Piccoli
2022-10-06 23:22   ` Kees Cook
2022-10-06 23:29     ` Luck, Tony
2022-10-06 23:37       ` Kees Cook
2022-10-07 16:19         ` Luck, Tony
2022-10-07 16:21     ` Colin Cross
2022-10-07 16:32     ` Guilherme G. Piccoli
2022-10-07 19:25       ` Kees Cook
2022-10-06 22:42 ` [PATCH 7/8] efi: pstore: Follow convention for the efi-pstore backend name Guilherme G. Piccoli
2022-10-06 23:16   ` Kees Cook
2022-10-07  8:47     ` Ard Biesheuvel
2022-10-14 17:41   ` (subset) " Kees Cook
2022-10-06 22:42 ` [PATCH 8/8] efi: pstore: Add module parameter for setting the record size Guilherme G. Piccoli
2022-10-06 23:16   ` Kees Cook
2022-10-07  9:11     ` Ard Biesheuvel
2022-10-07 13:00       ` Guilherme G. Piccoli
2022-10-07 13:19         ` Ard Biesheuvel
2022-10-07 13:45           ` Guilherme G. Piccoli
2022-10-07 15:06             ` Ard Biesheuvel
2022-10-07 17:01               ` Guilherme G. Piccoli
2022-10-07 19:32             ` Kees Cook
2022-10-07 23:29               ` Guilherme G. Piccoli
2022-10-08  2:36                 ` Kees Cook
2022-10-06 23:24 ` [PATCH 0/8] Some pstore improvements Kees Cook
2022-10-12 15:50   ` Guilherme G. Piccoli
2022-10-12 17:59     ` 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=dbe57a5e-7486-649f-7093-6da6312a71ee@igalia.com \
    --to=gpiccoli@igalia.com \
    --cc=anton@enomsg.org \
    --cc=ardb@kernel.org \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=kernel-dev@igalia.com \
    --cc=kernel@gpiccoli.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).