diff options
| author | Ming Lei <tom.leiming@gmail.com> | 2026-04-09 16:30:13 +0300 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-04-10 04:08:35 +0300 |
| commit | 23b3b6f0b584b70a427d5bb826d320151890d7da (patch) | |
| tree | f6050b704c280daa5d978cb29cf5bf161cb4816c /include | |
| parent | d0cc5f585f8b140cbab326f0e44f966aab52f2c8 (diff) | |
| download | linux-23b3b6f0b584b70a427d5bb826d320151890d7da.tar.xz | |
ublk: widen ublk_shmem_buf_reg.len to __u64 for 4GB buffer support
The __u32 len field cannot represent a 4GB buffer (0x100000000
overflows to 0). Change it to __u64 so buffers up to 4GB can be
registered. Add a reserved field for alignment and validate it
is zero.
The kernel enforces a default max of 4GB (UBLK_SHMEM_BUF_SIZE_MAX)
which may be increased in future.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260409133020.3780098-2-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
| -rw-r--r-- | include/uapi/linux/ublk_cmd.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h index a7078b798791..6991370a72ce 100644 --- a/include/uapi/linux/ublk_cmd.h +++ b/include/uapi/linux/ublk_cmd.h @@ -89,8 +89,9 @@ /* Parameter buffer for UBLK_U_CMD_REG_BUF, pointed to by ctrl_cmd.addr */ struct ublk_shmem_buf_reg { __u64 addr; /* userspace virtual address of shared memory */ - __u32 len; /* buffer size in bytes (page-aligned, max 4GB) */ + __u64 len; /* buffer size in bytes, page-aligned, default max 4GB */ __u32 flags; + __u32 reserved; }; /* Pin pages without FOLL_WRITE; usable with write-sealed memfd */ |
