Repository navigation
Conversation
|
Upstream branch: 3857c2f |
17720b8 to
ec9266e
Compare
|
Upstream branch: d5b6dc3 |
eb93362 to
f172d00
Compare
ec9266e to
2e69118
Compare
|
Upstream branch: 24a19b9 |
f172d00 to
bf9c351
Compare
2e69118 to
3cdd51f
Compare
|
Upstream branch: 4056b3c |
bf9c351 to
08e8321
Compare
3cdd51f to
e6ca2c1
Compare
|
Upstream branch: 0fcb05b |
08e8321 to
42eedf9
Compare
e6ca2c1 to
3d027d5
Compare
|
Upstream branch: 58161ea |
42eedf9 to
a30ee61
Compare
3d027d5 to
90ea7e4
Compare
|
Upstream branch: c03c1a1 |
a30ee61 to
bee8bc9
Compare
90ea7e4 to
435b194
Compare
|
Upstream branch: 7be4bc5 |
bee8bc9 to
46d28b0
Compare
435b194 to
fd67522
Compare
|
Upstream branch: 17bb0e2 |
|
Upstream branch: 6b4b543 |
fd899c4 to
6040989
Compare
5d84576 to
6582ed2
Compare
|
Upstream branch: fb2c3f4 |
6040989 to
49315d5
Compare
6582ed2 to
b3a1abc
Compare
|
Upstream branch: d135ab4 |
49315d5 to
dd4c856
Compare
b3a1abc to
712496f
Compare
|
Upstream branch: c339f40 |
dd4c856 to
f000817
Compare
712496f to
a186880
Compare
|
Upstream branch: d89e1d1 |
f000817 to
1b00e56
Compare
a186880 to
46206a3
Compare
|
Upstream branch: 6628e7d |
1b00e56 to
7972ba8
Compare
46206a3 to
220bd96
Compare
|
Upstream branch: 05441d6 |
7972ba8 to
38a305c
Compare
220bd96 to
6c4625e
Compare
|
Upstream branch: f66469d |
38a305c to
7ed0719
Compare
6c4625e to
c7f678d
Compare
|
Upstream branch: d487237 |
7ed0719 to
eea1286
Compare
c7f678d to
6aa6cd1
Compare
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.
|
Upstream branch: b3dfbde |
eea1286 to
08042c5
Compare
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/