lz4 v lz4hc compression discrepancy

From: Srinath Krishna Ananthakrishnan
Date: Thu Oct 13 2016 - 01:12:16 EST


Hi,

I'm trying to use the lz4 library in the kernel for compression and I
have a case where for a candidate payload worth 16k bytes (attached),
the data that is retrieved after compression + decompression is
different from the original data when using lz4hc. On the other hand,
using the lz4 variant, the data matches perfectly. In both the cases,
I'm using the decompression routine with the known size (16k).

I'm using the kernel version 4.1.26 with just the following commit
backported in the lz4 library from the head kernel.

commit 99b7e93c95c78952724a9783de6c78def8fbfc3f
Author: Krzysztof Kolasa <kkolasa@xxxxxxxxxx>
Date: Sun May 3 22:58:59 2015 -0500

lz4: fix system halt at boot kernel on x86_64

Sometimes, on x86_64, decompression fails with the following
error:

Decompressing Linux...

Decoding failed

-- System halted

This condition is not needed for a 64bit kernel(from commit d5e7caf):

if( ... ||
(op + COPYLENGTH) > oend)
goto _output_error

macro LZ4_SECURE_COPY() tests op and does not copy any data
when op exceeds the value.

added by analogy to lz4_uncompress_unknownoutputsize(...)

Signed-off-by: Krzysztof Kolasa <kkolasa@xxxxxxxxxx>
Tested-by: Alexander Kuleshov <kuleshovmail@xxxxxxxxx>
Tested-by: Caleb Jorden <cjorden@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

Thanks,
Srinath

Attachment: extent.0
Description: Binary data