linux/drivers/staging/erofs
Gao Xiang af89bcef55 staging: erofs: fix LZ4 limited bounced page mis-reuse
Like all lz77-based algrithms, lz4 has a dynamically populated
("sliding window") dictionary and the maximum lookback distance
is 65535. Therefore the number of bounced pages could be limited
by erofs based on this property.

However, just now we observed some lz4 sequences in the extreme
case cannot be decompressed correctly after this feature is enabled,
the root causes after analysis are clear as follows:
1) max bounced pages should be 17 rather than 16 pages;
2) considering the following case, the broken implementation
   could reuse unsafely in advance (in other words, reuse it
   less than a safe distance),
   0 1 2 ... 16 17 18 ... 33 34
   b             p  b         b
   note that the bounce page that we are concerned was allocated
   at 0, and it reused at 18 since page 17 exists, but it mis-reused
   at 34 in advance again, which causes decompress failure.

This patch resolves the issue by introducing a bitmap to mark
whether the page in the same position of last round is a bounced
page or not, and a micro stack data structure to store all
available bounced pages.

Fixes: 7fc45dbc93 ("staging: erofs: introduce generic decompression backend")
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-03 18:20:21 +02:00
..
Documentation/filesystems staging: erofs: support IO read error injection 2019-03-26 05:51:17 +09:00
include staging: erofs: add trace points for reading zipped data 2018-09-18 16:35:03 +02:00
Kconfig staging: erofs: fix undefined LZ4_decompress_safe_partial() 2018-11-09 08:34:39 -08:00
Makefile staging: erofs: switch to new decompression backend 2019-06-26 09:44:40 +08:00
TODO staging: erofs: update erofs-utils information in TODO 2018-12-06 16:08:56 +01:00
compress.h staging: erofs: introduce LZ4 decompression inplace 2019-06-26 09:44:40 +08:00
data.c staging: erofs: add compacted ondisk compression indexes 2019-06-26 09:44:39 +08:00
decompressor.c staging: erofs: fix LZ4 limited bounced page mis-reuse 2019-07-03 18:20:21 +02:00
dir.c staging: erofs: clean up initialization of pointer de 2019-06-18 08:59:40 +02:00
erofs_fs.h staging: erofs: introduce LZ4 decompression inplace 2019-06-26 09:44:40 +08:00
inode.c staging: erofs: don't check special inode layout 2019-07-01 08:45:00 +02:00
internal.h staging: erofs: integrate decompression inplace 2019-06-26 09:44:40 +08:00
namei.c staging: erofs: support statx 2019-05-30 13:59:10 -07:00
super.c staging: erofs: Replace kzalloc(struct ..) with kzalloc(*ptr) 2019-07-01 08:45:04 +02:00
unzip_pagevec.h staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG 2019-05-20 09:31:46 +02:00
unzip_vle.c staging: erofs: Replace kzalloc(struct ..) with kzalloc(*ptr) 2019-07-01 08:45:04 +02:00
unzip_vle.h staging: erofs: integrate decompression inplace 2019-06-26 09:44:40 +08:00
utils.c staging: erofs: move per-CPU buffers implementation to utils.c 2019-06-26 09:44:39 +08:00
xattr.c staging: erofs: Use !x or x in place of NULL comparision 2019-03-22 15:20:25 +01:00
xattr.h staging: erofs: complete POSIX ACL support 2019-01-30 15:38:50 +01:00
zmap.c staging: erofs: integrate decompression inplace 2019-06-26 09:44:40 +08:00