Skip to content

loop: Detect write requests that failed to wait for completion. - #1421

Closed
ghost wants to merge 1 commit into
linus-master_basefrom
series/1183273=>linus-master
Closed

ghost wants to merge 1 commit into
linus-master_basefrom
series/1183273=>linus-master

Conversation

@ghost

@ghost ghost commented Oct 11, 2026

Copy link
Copy Markdown

Pull request for series with
subject: loop: Detect write requests that failed to wait for completion.
version: 1
url: https://patchwork.kernel.org/series/1183273/

@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3857c2f
series: https://patchwork.kernel.org/series/1183273/
version: 1

@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3857c2f
series: https://patchwork.kernel.org/series/1183286/
version: 2

@ghost ghost added V2 and removed V1 labels Oct 11, 2026
@ghost
ghost force-pushed the series/1183273=>linus-master branch from 0a00ab7 to c8bf380 Compare October 11, 2026 11:37
@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3857c2f
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost ghost added V3 and removed V2 labels Oct 11, 2026
@ghost
ghost force-pushed the series/1183273=>linus-master branch from c8bf380 to 5c744d9 Compare October 11, 2026 13:48
@ghost ghost added the V3-ci-pass label Oct 11, 2026
@ghost
ghost force-pushed the linus-master_base branch from 17720b8 to ec9266e Compare October 11, 2026 18:17
@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: d5b6dc3
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 5c744d9 to 998d57f Compare October 11, 2026 18:24
@ghost
ghost force-pushed the linus-master_base branch from ec9266e to 2e69118 Compare October 12, 2026 12:20
@ghost

ghost commented Oct 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 24a19b9
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 998d57f to 6521ad2 Compare October 12, 2026 12:27
@ghost
ghost force-pushed the linus-master_base branch from 2e69118 to 3cdd51f Compare October 14, 2026 11:11
@ghost

ghost commented Oct 14, 2026

Copy link
Copy Markdown
Author

Upstream branch: 4056b3c
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 6521ad2 to 2f6a961 Compare October 14, 2026 11:17
@ghost
ghost force-pushed the linus-master_base branch from 3cdd51f to e6ca2c1 Compare October 14, 2026 15:40
@ghost

ghost commented Oct 14, 2026

Copy link
Copy Markdown
Author

Upstream branch: 0fcb05b
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 2f6a961 to 674de93 Compare October 14, 2026 15:46
@ghost
ghost force-pushed the linus-master_base branch from e6ca2c1 to 3d027d5 Compare October 17, 2026 03:32
@ghost

ghost commented Oct 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 58161ea
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 674de93 to 72f21fe Compare October 17, 2026 03:40
@ghost
ghost force-pushed the linus-master_base branch from 3d027d5 to 90ea7e4 Compare October 19, 2026 00:00
@ghost

ghost commented Oct 19, 2026

Copy link
Copy Markdown
Author

Upstream branch: c03c1a1
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost

ghost commented Oct 27, 2026

Copy link
Copy Markdown
Author

Upstream branch: d135ab4
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from e19b77d to 3f3e177 Compare October 27, 2026 00:21
@ghost
ghost force-pushed the linus-master_base branch from b3a1abc to 712496f Compare October 28, 2026 23:34
@ghost

ghost commented Oct 29, 2026

Copy link
Copy Markdown
Author

Upstream branch: c339f40
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 3f3e177 to 16a462a Compare October 29, 2026 00:01
@ghost
ghost force-pushed the linus-master_base branch from 712496f to a186880 Compare October 30, 2026 13:52
@ghost

ghost commented Oct 30, 2026

Copy link
Copy Markdown
Author

Upstream branch: d89e1d1
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 16a462a to a4b33ee Compare October 30, 2026 14:53
@ghost
ghost force-pushed the linus-master_base branch from a186880 to 46206a3 Compare November 2, 2026 17:14
@ghost

ghost commented Nov 2, 2026

Copy link
Copy Markdown
Author

Upstream branch: 6628e7d
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from a4b33ee to 1a20ef5 Compare November 2, 2026 18:03
@ghost
ghost force-pushed the linus-master_base branch from 46206a3 to 220bd96 Compare November 3, 2026 23:41
@ghost

ghost commented Nov 4, 2026

Copy link
Copy Markdown
Author

Upstream branch: 05441d6
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from 1a20ef5 to ab92030 Compare November 4, 2026 00:15
@ghost
ghost force-pushed the linus-master_base branch from 220bd96 to 6c4625e Compare November 6, 2026 08:02
@ghost

ghost commented Nov 6, 2026

Copy link
Copy Markdown
Author

Upstream branch: f66469d
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from ab92030 to c867c0f Compare November 6, 2026 08:55
@ghost
ghost force-pushed the linus-master_base branch from 6c4625e to c7f678d Compare November 7, 2026 03:08
@ghost

ghost commented Nov 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: d487237
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from c867c0f to ffc151b Compare November 7, 2026 03:51
@ghost
ghost force-pushed the linus-master_base branch from c7f678d to 6aa6cd1 Compare November 10, 2026 07:53
This is a debug patch which will be reverted after we observed what is
happening. This patch does not attempt to fix the problem itself.

syzbot is reporting NULL pointer dereference in lo_rw_aio() [1][2].
An analysis by the Gemini AI collaborator [3] considers that this problem
is caused by a timing shift primarily exposed by commit 65565ca
("block: unify the synchronous bi_end_io callbacks"), along with helper
refactorings like commit 92c3737 ("block: add a bio_submit_or_kill
helper").

But due to difficulty of reproducing this race, discussion about what is
happening and how to fix this problem is stalling. Also, we haven't
identified how many filesystems are subjected to this problem. Therefore,
we need to proceed to debug printk() approach, for syzbot cannot find a
reproducer for this problem.

Another analysis by the Gemini AI collaborator found possibility of
sync_blockdev() not waiting for write requests due to skipping
__filemap_fdatawait_range() when filemap_fdatawrite_range() returned -EIO.

  Step 1: A test process is created and calls unshare().
  Step 2: That process extracts a crafted JFS image to a memfd storage.
  Step 3: That process binds that image to a loop device.
  Step 4: That process mounts that loop device as read-write.
  Step 5: That process issues some buffered write requests.
  Step 6: That process is killed before writeback for Step 5 starts.
  Step 7: Automatic unmount operation starts due to teardown of a mount
          namespace.
  Step 8: jfs_umount() calls filemap_write_and_wait() (directly or via
          sync_blockdev()).
  Step 9: filemap_fdatawrite_range() returns -EIO due to filesystem errors
          after several submit_bio() have been already issued.
  Step 10: jfs_umount() completes without calling
           __filemap_fdatawait_range() which should wait for completion of
           I/O requests issued by Step 5 due to Step 9.
  Step 11: fput() is called from __loop_clr_fd() from lo_release(), and
           destruction of "struct file" starts after returning from
           lo_release().
  Step 12: The in-flight I/O request issued by Step 9 is finally processed
           by the loop backend kworker. However, since the backing "struct
           file" (and its associated structures) is already under
           destruction, the kworker attempts to dereference now-invalid
           fields, leading to WARN_ON_ONCE().

In order to check whether the steps described above is actually happening,
add debug code to the loop module for reporting I/O requests that are
processed after __loop_clr_fd() started. Note that this debug code is
enabled only if CONFIG_KCOV=y, for this check is a waste of computation
resources for almost all users.

Link: https://syzkaller.appspot.com/bug?extid=cd8a9a308e879a4e2c28 [1]
Link: https://syzkaller.appspot.com/bug?extid=bc273027d5643e48e5b3 [2]
Link: https://lkml.kernel.org/r/fbb3edda-f108-4e5b-acf2-266f043f8125@I-love.SAKURA.ne.jp [3]
Assisted-by: Gemini-Pro
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: b3dfbde
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost
ghost force-pushed the series/1183273=>linus-master branch from ffc151b to 3421db9 Compare November 10, 2026 08:23
@ghost ghost added V3-ci-fail and removed V3-ci-pass labels Nov 10, 2026
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: b3dfbde
series: https://patchwork.kernel.org/series/1183341/
version: 3

1 similar comment
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: b3dfbde
series: https://patchwork.kernel.org/series/1183341/
version: 3

@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Github failed to update this PR after force push. Close it.

@ghost ghost closed this Nov 10, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants