<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/fs/erofs/zdata.c, branch linux-6.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-12-31T12:25:46+00:00</updated>
<entry>
<title>erofs: Fix pcluster memleak when its block address is zero</title>
<updated>2022-12-31T12:25:46+00:00</updated>
<author>
<name>Chen Zhongjin</name>
<email>chenzhongjin@huawei.com</email>
</author>
<published>2022-12-05T03:49:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ac54c1f7b288d83b6ba1e320efff24ecc21309cd'/>
<id>urn:sha1:ac54c1f7b288d83b6ba1e320efff24ecc21309cd</id>
<content type='text'>
[ Upstream commit c42c0ffe81176940bd5dead474216b7198d77675 ]

syzkaller reported a memleak:
https://syzkaller.appspot.com/bug?id=62f37ff612f0021641eda5b17f056f1668aa9aed

unreferenced object 0xffff88811009c7f8 (size 136):
  ...
  backtrace:
    [&lt;ffffffff821db19b&gt;] z_erofs_do_read_page+0x99b/0x1740
    [&lt;ffffffff821dee9e&gt;] z_erofs_readahead+0x24e/0x580
    [&lt;ffffffff814bc0d6&gt;] read_pages+0x86/0x3d0
    ...

syzkaller constructed a case: in z_erofs_register_pcluster(),
ztailpacking = false and map-&gt;m_pa = zero. This makes pcl-&gt;obj.index be
zero although pcl is not a inline pcluster.

Then following path adds refcount for grp, but the refcount won't be put
because pcl is inline.

z_erofs_readahead()
  z_erofs_do_read_page() # for another page
    z_erofs_collector_begin()
      erofs_find_workgroup()
        erofs_workgroup_get()

Since it's illegal for the block address of a non-inlined pcluster to
be zero, add check here to avoid registering the pcluster which would
be leaked.

Fixes: cecf864d3d76 ("erofs: support inline data decompression")
Reported-by: syzbot+6f8cd9a0155b366d227f@syzkaller.appspotmail.com
Signed-off-by: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Reviewed-by: Yue Hu &lt;huyue2@coolpad.com&gt;
Reviewed-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Link: https://lore.kernel.org/r/Y42Kz6sVkf+XqJRB@debian
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>erofs: fix up inplace decompression success rate</title>
<updated>2022-11-03T15:00:27+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-10-14T06:49:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=913fd33114e79561bc8626405ebbd831f7068d87'/>
<id>urn:sha1:913fd33114e79561bc8626405ebbd831f7068d87</id>
<content type='text'>
[ Upstream commit e7933278b442f97809b1ea84264586302bd08a03 ]

Partial decompression should be checked after updating length.
It's a new regression when introducing multi-reference pclusters.

Fixes: 2bfab9c0edac ("erofs: record the longest decompressed size in this round")
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20221014064915.8103-1-hsiangkao@linux.alibaba.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>erofs: shouldn't churn the mapping page for duplicated copies</title>
<updated>2022-10-29T08:08:33+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-10-12T04:50:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=82fa018dc82858a39b6aa77943aaaef38ac652e2'/>
<id>urn:sha1:82fa018dc82858a39b6aa77943aaaef38ac652e2</id>
<content type='text'>
[ Upstream commit 63bbb85658ea43dd35dbfde6d4150b47c407fc87 ]

If other duplicated copies exist in one decompression shot, should
leave the old page as is rather than replace it with the new duplicated
one.  Otherwise, the following cold path to deal with duplicated copies
will use the invalid bvec.  It impacts compressed data deduplication.

Also, shift the onlinepage EIO bit to avoid touching the signed bit.

Fixes: 267f2492c8f7 ("erofs: introduce multi-reference pclusters (fully-referenced)")
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20221012045056.13421-1-hsiangkao@linux.alibaba.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>erofs: introduce multi-reference pclusters (fully-referenced)</title>
<updated>2022-07-22T13:44:27+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-07-15T15:42:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=267f2492c8f71dac44399988b510f9bf6b074a51'/>
<id>urn:sha1:267f2492c8f71dac44399988b510f9bf6b074a51</id>
<content type='text'>
Let's introduce multi-reference pclusters at runtime. In details,
if one pcluster is requested by multiple extents at almost the same
time (even belong to different files), the longest extent will be
decompressed as representative and the other extents are actually
copied from the longest one in one round.

After this patch, fully-referenced extents can be correctly handled
and the full decoding check needs to be bypassed for
partial-referenced extents.

Acked-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220715154203.48093-17-hsiangkao@linux.alibaba.com
</content>
</entry>
<entry>
<title>erofs: record the longest decompressed size in this round</title>
<updated>2022-07-21T14:55:44+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-07-15T15:42:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2bfab9c0edac5f6031e8956477cd39f7162b208d'/>
<id>urn:sha1:2bfab9c0edac5f6031e8956477cd39f7162b208d</id>
<content type='text'>
Currently, `pcl-&gt;length' records the longest decompressed length
as long as the pcluster itself isn't reclaimed.  However, such
number is unneeded for the general cases since it doesn't indicate
the exact decompressed size in this round.

Instead, let's record the decompressed size for this round instead,
thus `pcl-&gt;nr_pages' can be completely dropped and pageofs_out is
also designed to be kept in sync with `pcl-&gt;length'.

Acked-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220715154203.48093-16-hsiangkao@linux.alibaba.com
</content>
</entry>
<entry>
<title>erofs: introduce z_erofs_do_decompressed_bvec()</title>
<updated>2022-07-21T14:55:37+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-07-15T15:42:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3fe96ee0f96d0b2117b0ef438e28c26655b370f8'/>
<id>urn:sha1:3fe96ee0f96d0b2117b0ef438e28c26655b370f8</id>
<content type='text'>
Both out_bvecs and in_bvecs share the common logic for decompressed
buffers. So let's make a helper for this.

Acked-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220715154203.48093-15-hsiangkao@linux.alibaba.com
</content>
</entry>
<entry>
<title>erofs: try to leave (de)compressed_pages on stack if possible</title>
<updated>2022-07-21T14:55:30+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-07-15T15:42:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fe3e5914e6dc8db743fa587748ce1d9ecd4a5dba'/>
<id>urn:sha1:fe3e5914e6dc8db743fa587748ce1d9ecd4a5dba</id>
<content type='text'>
For the most cases, small pclusters can be decompressed with page
arrays on stack.

Try to leave both (de)compressed_pages on stack if possible as before.

Acked-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220715154203.48093-14-hsiangkao@linux.alibaba.com
</content>
</entry>
<entry>
<title>erofs: introduce struct z_erofs_decompress_backend</title>
<updated>2022-07-21T14:55:22+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-07-15T15:41:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4f05687fd7036473605a161ca47a2cf9fd3cbfc5'/>
<id>urn:sha1:4f05687fd7036473605a161ca47a2cf9fd3cbfc5</id>
<content type='text'>
Let's introduce struct z_erofs_decompress_backend in order to pass
on the decompression backend context between helper functions more
easier and avoid too many arguments.

Acked-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220715154203.48093-13-hsiangkao@linux.alibaba.com
</content>
</entry>
<entry>
<title>erofs: get rid of `z_pagemap_global'</title>
<updated>2022-07-21T14:55:15+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-07-15T15:41:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e73681877d4c3a8e28c8416300c36b10d4d6e9c1'/>
<id>urn:sha1:e73681877d4c3a8e28c8416300c36b10d4d6e9c1</id>
<content type='text'>
In order to introduce multi-reference pclusters for compressed data
deduplication, let's get rid of the global page array for now since
it needs to be re-designed then at least.

Acked-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220715154203.48093-12-hsiangkao@linux.alibaba.com
</content>
</entry>
<entry>
<title>erofs: clean up `enum z_erofs_collectmode'</title>
<updated>2022-07-21T14:55:07+00:00</updated>
<author>
<name>Gao Xiang</name>
<email>hsiangkao@linux.alibaba.com</email>
</author>
<published>2022-07-15T15:41:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=db166fc2020d300006a3aca15e539c09c948b62e'/>
<id>urn:sha1:db166fc2020d300006a3aca15e539c09c948b62e</id>
<content type='text'>
`enum z_erofs_collectmode' is really ambiguous, but I'm not quite
sure if there are better naming, basically it's used to judge whether
inplace I/O can be used due to the current status of pclusters in
the chain.

Rename it as `enum z_erofs_pclustermode' instead.

Acked-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220715154203.48093-11-hsiangkao@linux.alibaba.com
</content>
</entry>
</feed>
