<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/erofs, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-10-04T14:32:32Z</updated>
<entry>
<title>erofs: handle overlapped pclusters out of crafted images properly</title>
<updated>2024-10-04T14:32:32Z</updated>
<author>
<name>Gao Xiang</name>
</author>
<published>2024-09-10T07:08:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b9b30af0e86ffb485301ecd83b9129c9dfb7ebf8'/>
<id>urn:sha1:b9b30af0e86ffb485301ecd83b9129c9dfb7ebf8</id>
<content type='text'>
[ Upstream commit 9e2f9d34dd12e6e5b244ec488bcebd0c2d566c50 ]

syzbot reported a task hang issue due to a deadlock case where it is
waiting for the folio lock of a cached folio that will be used for
cache I/Os.

After looking into the crafted fuzzed image, I found it's formed with
several overlapped big pclusters as below:

 Ext:   logical offset   |  length :     physical offset    |  length
   0:        0..   16384 |   16384 :     151552..    167936 |   16384
   1:    16384..   32768 |   16384 :     155648..    172032 |   16384
   2:    32768..   49152 |   16384 :  537223168.. 537239552 |   16384
...

Here, extent 0/1 are physically overlapped although it's entirely
_impossible_ for normal filesystem images generated by mkfs.

First, managed folios containing compressed data will be marked as
up-to-date and then unlocked immediately (unlike in-place folios) when
compressed I/Os are complete.  If physical blocks are not submitted in
the incremental order, there should be separate BIOs to avoid dependency
issues.  However, the current code mis-arranges z_erofs_fill_bio_vec()
and BIO submission which causes unexpected BIO waits.

Second, managed folios will be connected to their own pclusters for
efficient inter-queries.  However, this is somewhat hard to implement
easily if overlapped big pclusters exist.  Again, these only appear in
fuzzed images so let's simply fall back to temporary short-lived pages
for correctness.

Additionally, it justifies that referenced managed folios cannot be
truncated for now and reverts part of commit 2080ca1ed3e4 ("erofs: tidy
up `struct z_erofs_bvec`") for simplicity although it shouldn't be any
difference.

Reported-by: syzbot+4fc98ed414ae63d1ada2@syzkaller.appspotmail.com
Reported-by: syzbot+de04e06b28cfecf2281c@syzkaller.appspotmail.com
Reported-by: syzbot+c8c8238b394be4a1087d@syzkaller.appspotmail.com
Tested-by: syzbot+4fc98ed414ae63d1ada2@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/0000000000002fda01061e334873@google.com
Fixes: 8e6c8fa9f2e9 ("erofs: enable big pcluster feature")
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20240910070847.3356592-1-hsiangkao@linux.alibaba.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>erofs: tidy up `struct z_erofs_bvec`</title>
<updated>2024-10-04T14:32:32Z</updated>
<author>
<name>Gao Xiang</name>
</author>
<published>2024-07-03T12:00:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eeb8e49ece731ed2357cb639e198df5ce75fbc80'/>
<id>urn:sha1:eeb8e49ece731ed2357cb639e198df5ce75fbc80</id>
<content type='text'>
[ Upstream commit 2080ca1ed3e43233c4e8480c0b9d2840886de01e ]

After revisiting the design, I believe `struct z_erofs_bvec` should
be page-based instead of folio-based due to the reasons below:

 - The minimized memory mapping block is a page;

 - Under the certain circumstances, only temporary pages needs to be
   used instead of folios since refcount, mapcount for such pages are
   unnecessary;

 - Decompressors handle all types of pages including temporary pages,
   not only folios.

When handling `struct z_erofs_bvec`, all folio-related information
is now accessed using the page_folio() helper.

The final goal of this round adaptation is to eliminate direct
accesses to `struct page` in the EROFS codebase, except for some
exceptions like `z_erofs_is_shortlived_page()` and
`z_erofs_page_is_invalidated()`, which require a new helper to
determine the memdesc type of an arbitrary page.

Actually large folios of compressed files seem to work now, yet I tend
to conduct more tests before officially enabling this for all scenarios.

Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20240703120051.3653452-4-hsiangkao@linux.alibaba.com
Stable-dep-of: 9e2f9d34dd12 ("erofs: handle overlapped pclusters out of crafted images properly")
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>erofs: fix incorrect symlink detection in fast symlink</title>
<updated>2024-10-04T14:32:32Z</updated>
<author>
<name>Gao Xiang</name>
</author>
<published>2024-09-09T03:19:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=45a3d11ffd2be43e4f7e9e1129131ec6c368850e'/>
<id>urn:sha1:45a3d11ffd2be43e4f7e9e1129131ec6c368850e</id>
<content type='text'>
[ Upstream commit 9ed50b8231e37b1ae863f5dec8153b98d9f389b4 ]

Fast symlink can be used if the on-disk symlink data is stored
in the same block as the on-disk inode, so we don’t need to trigger
another I/O for symlink data.  However, currently fs correction could be
reported _incorrectly_ if inode xattrs are too large.

In fact, these should be valid images although they cannot be handled as
fast symlinks.

Many thanks to Colin for reporting this!

Reported-by: Colin Walters &lt;walters@verbum.org&gt;
Reported-by: https://honggfuzz.dev/
Link: https://lore.kernel.org/r/bb2dd430-7de0-47da-ae5b-82ab2dd4d945@app.fastmail.com
Fixes: 431339ba9042 ("staging: erofs: add inode operations")
[ Note that it's a runtime misbehavior instead of a security issue. ]
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20240909031911.1174718-1-hsiangkao@linux.alibaba.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>erofs: fix out-of-bound access when z_erofs_gbuf_growsize() partially fails</title>
<updated>2024-09-04T11:29:55Z</updated>
<author>
<name>Gao Xiang</name>
</author>
<published>2024-08-20T08:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=49c0e081998008cde0c872c0ff9affa1ece4b878'/>
<id>urn:sha1:49c0e081998008cde0c872c0ff9affa1ece4b878</id>
<content type='text'>
commit 0005e01e1e875c5e27130c5e2ed0189749d1e08a upstream.

If z_erofs_gbuf_growsize() partially fails on a global buffer due to
memory allocation failure or fault injection (as reported by syzbot [1]),
new pages need to be freed by comparing to the existing pages to avoid
memory leaks.

However, the old gbuf-&gt;pages[] array may not be large enough, which can
lead to null-ptr-deref or out-of-bound access.

Fix this by checking against gbuf-&gt;nrpages in advance.

[1] https://lore.kernel.org/r/000000000000f7b96e062018c6e3@google.com

Reported-by: syzbot+242ee56aaa9585553766@syzkaller.appspotmail.com
Fixes: d6db47e571dc ("erofs: do not use pagepool in z_erofs_gbuf_growsize()")
Cc: &lt;stable@vger.kernel.org&gt; # 6.10+
Reviewed-by: Chunhai Guo &lt;guochunhai@vivo.com&gt;
Reviewed-by: Sandeep Dhavale &lt;dhavale@google.com&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20240820085619.1375963-1-hsiangkao@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>erofs: fix race in z_erofs_get_gbuf()</title>
<updated>2024-08-03T07:00:45Z</updated>
<author>
<name>Gao Xiang</name>
</author>
<published>2024-07-22T03:51:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=49b22e06a947727a6d1c802d2d9ad92420b90fc5'/>
<id>urn:sha1:49b22e06a947727a6d1c802d2d9ad92420b90fc5</id>
<content type='text'>
commit 7dc5537c3f8be87e005f0844a7626c987914f8fd upstream.

In z_erofs_get_gbuf(), the current task may be migrated to another
CPU between `z_erofs_gbuf_id()` and `spin_lock(&amp;gbuf-&gt;lock)`.

Therefore, z_erofs_put_gbuf() will trigger the following issue
which was found by stress test:

&lt;2&gt;[772156.434168] kernel BUG at fs/erofs/zutil.c:58!
..
&lt;4&gt;[772156.435007]
&lt;4&gt;[772156.439237] CPU: 0 PID: 3078 Comm: stress Kdump: loaded Tainted: G            E      6.10.0-rc7+ #2
&lt;4&gt;[772156.439239] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 1.0.0 01/01/2017
&lt;4&gt;[772156.439241] pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
&lt;4&gt;[772156.439243] pc : z_erofs_put_gbuf+0x64/0x70 [erofs]
&lt;4&gt;[772156.439252] lr : z_erofs_lz4_decompress+0x600/0x6a0 [erofs]
..
&lt;6&gt;[772156.445958] stress (3127): drop_caches: 1
&lt;4&gt;[772156.446120] Call trace:
&lt;4&gt;[772156.446121]  z_erofs_put_gbuf+0x64/0x70 [erofs]
&lt;4&gt;[772156.446761]  z_erofs_lz4_decompress+0x600/0x6a0 [erofs]
&lt;4&gt;[772156.446897]  z_erofs_decompress_queue+0x740/0xa10 [erofs]
&lt;4&gt;[772156.447036]  z_erofs_runqueue+0x428/0x8c0 [erofs]
&lt;4&gt;[772156.447160]  z_erofs_readahead+0x224/0x390 [erofs]
..

Fixes: f36f3010f676 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable")
Cc: &lt;stable@vger.kernel.org&gt; # 6.10+
Reviewed-by: Chunhai Guo &lt;guochunhai@vivo.com&gt;
Reviewed-by: Sandeep Dhavale &lt;dhavale@google.com&gt;
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/20240722035110.3456740-1-hsiangkao@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>erofs: ensure m_llen is reset to 0 if metadata is invalid</title>
<updated>2024-06-30T02:54:28Z</updated>
<author>
<name>Gao Xiang</name>
</author>
<published>2024-06-29T18:57:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9b32b063be1001e322c5f6e01f2a649636947851'/>
<id>urn:sha1:9b32b063be1001e322c5f6e01f2a649636947851</id>
<content type='text'>
Sometimes, the on-disk metadata might be invalid due to user
interrupts, storage failures, or other unknown causes.

In that case, z_erofs_map_blocks_iter() may still return a valid
m_llen while other fields remain invalid (e.g., m_plen can be 0).

Due to the return value of z_erofs_scan_folio() in some path will
be ignored on purpose, the following z_erofs_scan_folio() could
then use the invalid value by accident.

Let's reset m_llen to 0 to prevent this.

Link: https://lore.kernel.org/r/20240629185743.2819229-1-hsiangkao@linux.alibaba.com
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
</content>
</entry>
<entry>
<title>erofs: convert to use super_set_uuid to support for FS_IOC_GETFSUUID</title>
<updated>2024-06-26T09:02:28Z</updated>
<author>
<name>Huang Xiaojia</name>
</author>
<published>2024-06-24T06:37:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cc69a681b2573e8865e29758f1a5b284328efb2d'/>
<id>urn:sha1:cc69a681b2573e8865e29758f1a5b284328efb2d</id>
<content type='text'>
FS_IOC_GETFSUUID ioctl exposes the uuid of a filesystem. To support
the ioctl, init sb-&gt;s_uuid with super_set_uuid().

Signed-off-by: Huang Xiaojia &lt;huangxiaojia2@huawei.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/20240624063704.2476070-1-huangxiaojia2@huawei.com
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
</content>
</entry>
<entry>
<title>erofs: fix possible memory leak in z_erofs_gbuf_exit()</title>
<updated>2024-06-26T09:02:15Z</updated>
<author>
<name>Sandeep Dhavale</name>
</author>
<published>2024-06-24T22:02:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9d01f6f6d8b57131c74810739b9d65141062e4c0'/>
<id>urn:sha1:9d01f6f6d8b57131c74810739b9d65141062e4c0</id>
<content type='text'>
Because we incorrectly reused of variable `i` in `z_erofs_gbuf_exit()`
for inner loop, we may exit early from outer loop resulting in memory
leak. Fix this by using separate variable for iterating through inner loop.

Fixes: f36f3010f676 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable")
Signed-off-by: Sandeep Dhavale &lt;dhavale@google.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/20240624220206.3373197-1-dhavale@google.com
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'erofs-for-6.10-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs</title>
<updated>2024-05-24T16:31:50Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2024-05-24T16:31:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dcb9f48667824399e496113f2374d08e6aa59770'/>
<id>urn:sha1:dcb9f48667824399e496113f2374d08e6aa59770</id>
<content type='text'>
Pull more erofs updates from Gao Xiang:
 "The main ones are metadata API conversion to byte offsets by Al Viro.

  Another patch gets rid of unnecessary memory allocation out of DEFLATE
  decompressor. The remaining one is a trivial cleanup.

   - Convert metadata APIs to byte offsets

   - Avoid allocating DEFLATE streams unnecessarily

   - Some erofs_show_options() cleanup"

* tag 'erofs-for-6.10-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
  erofs: avoid allocating DEFLATE streams before mounting
  z_erofs_pcluster_begin(): don't bother with rounding position down
  erofs: don't round offset down for erofs_read_metabuf()
  erofs: don't align offset for erofs_read_metabuf() (simple cases)
  erofs: mechanically convert erofs_read_metabuf() to offsets
  erofs: clean up erofs_show_options()
</content>
</entry>
<entry>
<title>Merge tag 'pull-bd_inode-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2024-05-21T16:51:42Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2024-05-21T16:51:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=38da32ee70b876f5b8bea7c4135eff46339c18f2'/>
<id>urn:sha1:38da32ee70b876f5b8bea7c4135eff46339c18f2</id>
<content type='text'>
Pull bdev bd_inode updates from Al Viro:
 "Replacement of bdev-&gt;bd_inode with sane(r) set of primitives by me and
  Yu Kuai"

* tag 'pull-bd_inode-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  RIP -&gt;bd_inode
  dasd_format(): killing the last remaining user of -&gt;bd_inode
  nilfs_attach_log_writer(): use -&gt;bd_mapping-&gt;host instead of -&gt;bd_inode
  block/bdev.c: use the knowledge of inode/bdev coallocation
  gfs2: more obvious initializations of mapping-&gt;host
  fs/buffer.c: massage the remaining users of -&gt;bd_inode to -&gt;bd_mapping
  blk_ioctl_{discard,zeroout}(): we only want -&gt;bd_inode-&gt;i_mapping here...
  grow_dev_folio(): we only want -&gt;bd_inode-&gt;i_mapping there
  use -&gt;bd_mapping instead of -&gt;bd_inode-&gt;i_mapping
  block_device: add a pointer to struct address_space (page cache of bdev)
  missing helpers: bdev_unhash(), bdev_drop()
  block: move two helpers into bdev.c
  block2mtd: prevent direct access of bd_inode
  dm-vdo: use bdev_nr_bytes(bdev) instead of i_size_read(bdev-&gt;bd_inode)
  blkdev_write_iter(): saner way to get inode and bdev
  bcachefs: remove dead function bdev_sectors()
  ext4: remove block_device_ejected()
  erofs_buf: store address_space instead of inode
  erofs: switch erofs_bread() to passing offset instead of block number
</content>
</entry>
</feed>
