From: David Sterba <dsterba@suse.cz>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Nitin Gupta <nitingupta910@gmail.com>,
Richard Purdie <rpurdie@openedhand.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
"Markus F.X.J. Oberhumer" <markus@oberhumer.com>,
Dave Rodgman <dave.rodgman@arm.com>
Subject: Re: [PATCH] lib/lzo: Avoid output overruns when compressing
Date: Thu, 27 Feb 2025 04:16:07 +0100 [thread overview]
Message-ID: <20250227031607.GY5777@suse.cz> (raw)
In-Reply-To: <Z7_D4i5yifwdXjwZ@gondor.apana.org.au>
On Thu, Feb 27, 2025 at 09:46:10AM +0800, Herbert Xu wrote:
> On Wed, Feb 26, 2025 at 02:00:37PM +0100, David Sterba wrote:
> >
> > Does it have to check for the overruns? The worst case compression
> > result size is known and can be calculated by the formula. Using big
>
> If the caller is using different algorithms, then yes the checks
> are essential. Otherwise the caller would have to allocate enough
> memory not just for LZO, but for the worst-case compression length
> for *any* algorithm. Adding a single algorithm would have the
> potential of breaking all users.
>
> > What strikes me as alarming that you insert about 20 branches into a
> > realtime compression algorithm, where everything is basically a hot
> > path. Branches that almost never happen, and never if the output buffer
> > is big enough.
>
> OK, if that is a real concern then I will add a _safe version of
> LZO compression alongside the existing code.
Makes sense, thanks. The in-kernel users are OK, but the crypto API also
exports the compression so there's no guarantee it's used correctly. As
it needs changes to the LZO code itself I don't see a better way than to
have 2 versions, conveniently done by the macros as yo did.
next prev parent reply other threads:[~2025-02-27 3:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-23 6:55 [PATCH] lib/lzo: Avoid output overruns when compressing Herbert Xu
2025-02-23 8:40 ` Sergey Senozhatsky
2025-02-27 1:47 ` Herbert Xu
2025-02-24 16:20 ` Markus F.X.J. Oberhumer
2025-02-26 13:00 ` David Sterba
2025-02-27 1:46 ` Herbert Xu
2025-02-27 2:08 ` [v2 PATCH] crypto: lzo - Fix compression buffer overrun Herbert Xu
2025-02-27 9:04 ` [v3 " Herbert Xu
2025-02-28 13:21 ` David Sterba
2025-02-27 3:16 ` David Sterba [this message]
2025-02-28 5:24 ` [PATCH] lib/lzo: Avoid output overruns when compressing Sergey Senozhatsky
2025-02-28 12:43 ` Ard Biesheuvel
2025-02-28 13:55 ` Sergey Senozhatsky
2025-02-28 14:02 ` David Sterba
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=20250227031607.GY5777@suse.cz \
--to=dsterba@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=dave.rodgman@arm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markus@oberhumer.com \
--cc=nitingupta910@gmail.com \
--cc=rpurdie@openedhand.com \
--cc=senozhatsky@chromium.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.