Skip to content

block: release the freeze lockdep maps under mq_freeze_lock - #1423

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

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

Conversation

@ghost

@ghost ghost commented Oct 11, 2026

Copy link
Copy Markdown

Pull request for series with
subject: block: release the freeze lockdep maps under mq_freeze_lock
version: 1
url: https://patchwork.kernel.org/series/1183383/

@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

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

@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from eb93362 to f172d00 Compare October 11, 2026 18:22
@ghost ghost added the V1-ci-fail label Oct 12, 2026
@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from f172d00 to bf9c351 Compare October 12, 2026 12:25
@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from bf9c351 to 08e8321 Compare October 14, 2026 11:16
@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 08e8321 to 42eedf9 Compare October 14, 2026 15:45
@ghost ghost added V1-ci-pass and removed V1-ci-fail labels Oct 15, 2026
@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 42eedf9 to a30ee61 Compare October 17, 2026 03:37
@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from a30ee61 to bee8bc9 Compare October 19, 2026 00:05
@ghost
ghost force-pushed the linus-master_base branch from 90ea7e4 to 435b194 Compare October 22, 2026 07:21
@ghost

ghost commented Oct 22, 2026

Copy link
Copy Markdown
Author

Upstream branch: 7be4bc5
series: https://patchwork.kernel.org/series/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from bee8bc9 to 46d28b0 Compare October 22, 2026 07:57
@ghost
ghost force-pushed the linus-master_base branch from 435b194 to fd67522 Compare October 24, 2026 03:36
@ghost

ghost commented Oct 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: 17bb0e2
series: https://patchwork.kernel.org/series/1183383/
version: 1

@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: 6b4b543
series: https://patchwork.kernel.org/series/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from fd899c4 to 6040989 Compare October 26, 2026 07:31
@ghost
ghost force-pushed the linus-master_base branch from 5d84576 to 6582ed2 Compare October 26, 2026 18:11
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: fb2c3f4
series: https://patchwork.kernel.org/series/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 6040989 to 49315d5 Compare October 26, 2026 18:57
@ghost
ghost force-pushed the linus-master_base branch from 6582ed2 to b3a1abc Compare October 26, 2026 23:55
@ghost

ghost commented Oct 27, 2026

Copy link
Copy Markdown
Author

Upstream branch: d135ab4
series: https://patchwork.kernel.org/series/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 49315d5 to dd4c856 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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from dd4c856 to f000817 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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from f000817 to 1b00e56 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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 1b00e56 to 7972ba8 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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 7972ba8 to 38a305c Compare November 4, 2026 00:14
@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 38a305c to 7ed0719 Compare November 6, 2026 08:54
@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/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from 7ed0719 to eea1286 Compare November 7, 2026 03:50
@ghost
ghost force-pushed the linus-master_base branch from c7f678d to 6aa6cd1 Compare November 10, 2026 07:53
The lockdep maps taken for a queue freeze are released based on
q->mq_freeze_disk_dead and q->mq_freeze_queue_dying, which are sampled
when the outermost freeze starts. __blk_mq_unfreeze_queue() drops
mq_freeze_lock, and only afterwards the callers release the maps. In
that window the depth is already zero, so a new freezer can rewrite the
flags, e.g. del_gendisk() on a disk that owns its queue, which sets
DYING and GD_DEAD first. The old owner then skips the release and
returns to userspace with the maps still held:

  WARNING: lock held when returning to user space!
  syz.0.452/6787 is leaving the kernel with locks still held!
  2 locks held by syz.0.452/6787:
   #0: (&q->io_lockdep_map){++++}-{0:0}, at: blk_mq_freeze_queue include/linux/blk-mq.h:956 [inline]
   #0: (&q->io_lockdep_map){++++}-{0:0}, at: blk_throtl_init+0x1f0/0x420 block/blk-throttle.c:1332
   #1: (&q->q_lockdep_map){+.+.}-{0:0}, at: blk_mq_freeze_queue include/linux/blk-mq.h:956 [inline]
   #1: (&q->q_lockdep_map){+.+.}-{0:0}, at: blk_throtl_init+0x1f0/0x420 block/blk-throttle.c:1332

It is triggered by writing a blk-throttle limit while a null_blk device
is being removed through configfs.

Release the maps from __blk_mq_unfreeze_queue() while still holding
mq_freeze_lock, where the flags can't change. del_gendisk() then only
needs the explicit release when the queue is not unfrozen there.

Reported-by: syzbot+1eb53c83ab8b0a0302a6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1eb53c83ab8b0a0302a6
Fixes: 6f491a8 ("block: track disk DEAD state automatically for modeling queue freeze lockdep")
Fixes: f6661b1 ("block: track queue dying state automatically for modeling queue freeze lockdep")
Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
Reproduced in QEMU (KASAN + lockdep). The window is tiny, so I widened it
with a 300ms msleep() after mq_freeze_lock is dropped in
blk_mq_unfreeze_queue_nomemrestore() for nullb1, while threads write
"<maj:min> 1" to blkio.throttle.write_iops_device and the main thread
toggles null_blk power via configfs. Unpatched: the warning above (2 locks
held) within ~10s. Patched, with the same delay after the unfreeze: no
warning. Only the null_blk path was tested.
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: b3dfbde
series: https://patchwork.kernel.org/series/1183383/
version: 1

@ghost
ghost force-pushed the series/1183383=>linus-master branch from eea1286 to 08042c5 Compare November 10, 2026 08:22
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.

1 participant