Skip to content

ublk: validate physical_bs_shift, io_min_shift and io_opt_shift#799

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

ublk: validate physical_bs_shift, io_min_shift and io_opt_shift#799
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1089937=>linus-master

Conversation

@blktests-ci
Copy link
Copy Markdown

@blktests-ci blktests-ci Bot commented May 5, 2026

Pull request for series with
subject: ublk: validate physical_bs_shift, io_min_shift and io_opt_shift
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1089937

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 5, 2026

Upstream branch: 6d35786
series: https://patchwork.kernel.org/project/linux-block/list/?series=1089937
version: 1

ublk_validate_params() checks logical_bs_shift is within
[9, PAGE_SHIFT] but has no upper bound for physical_bs_shift,
io_min_shift, or io_opt_shift. A malicious userspace can set any
of these to a large value (e.g., 44), causing undefined behavior
from `1 << shift` in ublk_ctrl_start_dev() since the result is
stored in 32-bit unsigned int.

Cap all three at ilog2(SZ_256M) (28). 256M is big enough to cover
all practical block sizes, and originates from the maximum physical
block size possible in NVMe (lba_size * (1 + npwg), where npwg is
16-bit).

Fixes: 71f28f3 ("ublk_drv: add io_uring based userspace block driver")
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 5, 2026

Upstream branch: 6d35786
series: https://patchwork.kernel.org/project/linux-block/list/?series=1089937
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1089937=>linus-master branch from d262498 to f8c998c Compare May 5, 2026 15:44
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