mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Purdie <richard@openedhand.com>
To: Nitin Gupta <nitingupta910@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] LZO1X de/compression support
Date: Fri, 18 May 2007 12:46:56 +0100	[thread overview]
Message-ID: <1179488817.5876.14.camel@localhost.localdomain> (raw)
In-Reply-To: <4cefeab80705180258g516a6f92w15a49e666dd62b66@mail.gmail.com>

Hi,

On Fri, 2007-05-18 at 15:28 +0530, Nitin Gupta wrote:
> This is kernel port of LZO1X de/compression algo stripped down to just ~500 LOC!
> It is derived from original LZO 2.02 code found at:
> http://www.oberhumer.com/opensource/lzo/download/
> The code has also been reformatted to match general kernel style.
> 
> Facts for LZO (at least for original code. Should hold true for this
> port also - hence the RFC!):
> - The compressor can never overrun buffer.
> - The "non-safe" version of decompressor can never overrun buffer if
> compressed data is unmodified. I am not sure about this if compressed
> data is malicious (to be confirmed from the author).

If the data is malicious, it *can* overrun the buffer.

> - The "safe" version can never crash (buffer overrun etc.) - confirmed
> from the author.
> This patch, as of yet, only gives 'non-safe' version of decompressor.
> The 'safe' version  will be included soon.

How are you planning to add that back?

> Since 'non-safe' version has no problems if compressed data is
> unmodified, it is useful in cases we have such guarantees on
> compressed data and hence don't want additional overhead of 'safe'
> version. For e.g. Compressed Caching project
> (http://linuxcompressed.sourceforge.net) has been using the 'non-safe'
> version of LZO1X since long time without any problems w.r.t.
> de/compression itself.
> 
> For now, I have tested this on x86 only.

The LZO author had some concerns about this code. The major issue he
highlighted was that it was 64-bit unsafe. Have you addressed that
problem? Has it been tested on 64bit?

I'm worried that in converting this code the way you have, you've
possibly introduced potential security holes. You've removed all bounds
checking and are going to have to add that back to create the "safe"
version of the decompression function. Until I mentioned it, you seemed
unaware of the potential problem and the comments above suggest you
don't understand this code as fully as I'd like with regard to
overflows.

The version I submitted has at least been subject to userspace scrutiny
over a period of time and is basically unchanged with regard to
security. It is much uglier though.

Richard



  parent reply	other threads:[~2007-05-18 11:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-18  9:58 Nitin Gupta
2007-05-18 10:14 ` Heikki Orsila
2007-05-18 11:27   ` Nitin Gupta
2007-05-18 11:53     ` Richard Purdie
2007-05-18 10:42 ` Pekka Enberg
2007-05-18 10:53   ` Pekka Enberg
2007-05-22  8:54   ` Nitin Gupta
2007-05-22  8:59     ` Pekka Enberg
2007-05-22  9:10       ` Nitin Gupta
2007-05-22  9:34         ` Pekka Enberg
2007-05-18 11:11 ` Andrey Panin
2007-05-22  9:08   ` Nitin Gupta
2007-05-22 19:44     ` Jan Engelhardt
2007-05-22 21:24     ` Bernd Petrovitsch
2007-05-23 16:35       ` Jeremy Fitzhardinge
2007-05-18 11:46 ` Richard Purdie [this message]
2007-05-22  9:19   ` Nitin Gupta
2007-05-18 20:04 ` Matt Mackall
2007-05-18 21:14 ` Krzysztof Halasa
2007-05-19 18:55   ` Bill Rugolsky Jr.
2007-05-19 21:52     ` Richard Purdie
2007-05-22 19:40 ` Jan Engelhardt
2007-05-19 18:12 devzero
2007-05-20 11:42 Tomasz Chmielewski

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=1179488817.5876.14.camel@localhost.localdomain \
    --to=richard@openedhand.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nitingupta910@gmail.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

Powered by JetHome