From: Ard Biesheuvel <ardb@kernel.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: David Sterba <dsterba@suse.cz>,
Herbert Xu <herbert@gondor.apana.org.au>,
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>,
"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: Fri, 28 Feb 2025 13:43:50 +0100 [thread overview]
Message-ID: <CAMj1kXFKBynkfBFmQ1tbgZ0fTOP0pg5453NFGxVGvmePrKssug@mail.gmail.com> (raw)
In-Reply-To: <qahmi4ozfatd4q5h4qiykinucdry6jcbee6eg4rzelyge2zmlg@norwskwechx6>
On Fri, 28 Feb 2025 at 06:24, Sergey Senozhatsky
<senozhatsky@chromium.org> wrote:
>
> On (25/02/26 14:00), David Sterba wrote:
> > 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.
> >
> > Please drop the patch.
>
> David, just for educational purposes, there's only safe variant of lzo
> decompression, which seems to be doing a lot of NEED_OP (HAVE_OP) adding
> branches and so on, basically what Herbert is adding to the compression
> path. So my question is - why NEED_OP (if (!HAVE_OP(x)) goto output_overrun)
> is a no go for compression, but appears to be fine for decompression?
>
Because compression has a bounded worst case (compressing data with
LZO can actually increase the size but only by a limited amount),
whereas decompressing a small input could produce gigabytes of output.
next prev parent reply other threads:[~2025-02-28 12:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-23 6:55 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 ` [PATCH] lib/lzo: Avoid output overruns when compressing David Sterba
2025-02-28 5:24 ` Sergey Senozhatsky
2025-02-28 12:43 ` Ard Biesheuvel [this message]
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=CAMj1kXFKBynkfBFmQ1tbgZ0fTOP0pg5453NFGxVGvmePrKssug@mail.gmail.com \
--to=ardb@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dave.rodgman@arm.com \
--cc=dsterba@suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®