Skip to content

loop: block changing lo_offset/lo_sizelimit on mounted device#705

Open
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1074954=>linus-master
Open

loop: block changing lo_offset/lo_sizelimit on mounted device#705
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1074954=>linus-master

Conversation

@blktests-ci
Copy link
Copy Markdown

@blktests-ci blktests-ci bot commented Mar 31, 2026

Pull request for series with
subject: loop: block changing lo_offset/lo_sizelimit on mounted device
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=1074954

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Mar 31, 2026

Upstream branch: 7aaa804
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Mar 31, 2026

Upstream branch: d0c3bcd
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from 659b9e0 to 44f5989 Compare March 31, 2026 12:55
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 255b4bf to 3236861 Compare April 1, 2026 02:20
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 1, 2026

Upstream branch: 9147566
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from 44f5989 to da55e39 Compare April 1, 2026 02:21
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch 2 times, most recently from ecbdbb4 to 480b162 Compare April 2, 2026 07:52
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 2, 2026

Upstream branch: 9147566
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from da55e39 to 177b1e1 Compare April 2, 2026 08:15
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch 2 times, most recently from a96fba7 to 0cd6ac2 Compare April 3, 2026 07:51
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 3, 2026

Upstream branch: 9147566
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from 177b1e1 to c10dbad Compare April 3, 2026 07:51
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 0cd6ac2 to 910d344 Compare April 3, 2026 11:53
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 3, 2026

Upstream branch: d8a9a4b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from c10dbad to 0e12787 Compare April 3, 2026 11:54
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 910d344 to ed862bc Compare April 4, 2026 05:34
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 4, 2026

Upstream branch: 7ca6d1c
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from 0e12787 to bb30882 Compare April 4, 2026 05:35
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from ed862bc to 2d0c3d5 Compare April 4, 2026 16:55
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 4, 2026

Upstream branch: 3aae938
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from bb30882 to 4e11d76 Compare April 4, 2026 16:56
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 2d0c3d5 to 931d9b0 Compare April 8, 2026 10:29
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 8, 2026

Upstream branch: 3036cd0
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from 4e11d76 to da5de4c Compare April 8, 2026 10:41
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 931d9b0 to 78a4682 Compare April 10, 2026 00:51
LOOP_SET_STATUS{64} allows changing lo_offset and shrinking
lo_sizelimit while a filesystem is mounted on the loop device.
This effectively mutates the data visible to the mounted filesystem,
which is equivalent to writing directly to the block device.

When CONFIG_BLK_DEV_WRITE_MOUNTED is disabled, direct writes to a
mounted block device are blocked. However, LOOP_SET_STATUS{64}
bypasses this protection because it modifies the loop configuration
through an ioctl rather than opening the block device for writing.

Fix this by checking bdev_writes_blocked() before allowing changes
to lo_offset or shrinking lo_sizelimit. If the loop device has
writes blocked, return -EBUSY. Increasing lo_sizelimit is still
allowed since growing the device is harmless and has legitimate
use cases such as online resize.

Move bdev_writes_blocked() from block/bdev.c to
include/linux/blk_types.h as a static inline function so it can
be used from the loop driver without exporting a symbol.

Suggested-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: syzbot+fb32afec111a7d61b939@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=fb32afec111a7d61b939
Tested-by: syzbot+fb32afec111a7d61b939@syzkaller.appspotmail.com
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 10, 2026

Upstream branch: 9a9c8ce
series: https://patchwork.kernel.org/project/linux-block/list/?series=1074954
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1074954=>linus-master branch from da5de4c to 901c6b6 Compare April 10, 2026 00:59
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