[bug report] data corruption of init process

Gao Xiang hsiangkao at linux.alibaba.com
Mon Jan 20 12:55:41 AEDT 2025



On 2025/1/20 09:45, Gao Xiang wrote:

...

> 
> After I picked "erofs: ... i_ino ...., index ...." lines out, sort them,
> and use`sed -e 's/.*(\([0-9a-f]*\))$/\1/'` to parse the sorted items of
> BAD and GOOD cases,
> 
> I found each decompressed page cache page (which will be visible to
> the userspace) is the same, so I'm very confused why it could happen.
> 

     - First of all, could you also confirm the output if the following
       patch is applied:

diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 0cd6b5c4df98..3c2cff623016 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -264,6 +264,11 @@ void erofs_onlinefolio_end(struct folio *folio, int err)
         if (v & ~EROFS_ONLINEFOLIO_EIO)
                 return;
         folio->private = 0;
+       ptr = kmap_local_folio(folio, 0);
+       hash = fnv_32_buf(ptr, PAGE_SIZE, FNV1_32_INIT);
+       erofs_info(NULL, "%px i_ino %lu, index %lu dst %px (%x) err %d",
+                  folio, folio->mapping->host->i_ino, folio->index, ptr, hash,
+                  v & EROFS_ONLINEFOLIO_EIO);
         folio_end_read(folio, !(v & EROFS_ONLINEFOLIO_EIO));
  }

diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index aff09f94afb2..39d857acd3d0 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -1847,7 +1847,7 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio)

         /* if some pclusters are ready, need submit them anyway */
         err = z_erofs_runqueue(&f, 0) ?: err;
-       if (err && err != -EINTR)
+       if (err)
                 erofs_err(inode->i_sb, "read error %d @ %lu of nid %llu",
                           err, folio->index, EROFS_I(inode)->nid);

I'd like to know if some error is returned (especially EINTR) to
user space which could cause something...

Thanks,
Gao Xiang



More information about the Linux-erofs mailing list