pipe: reject oversized pipe-max-size sysctl writes
PATCH 1/1 pipe: reject oversized pipe-max-size sysctl writes
On 64-bit kernels, the unsigned long sysctl input is truncated before round_pipe_size() checks it as an unsigned int. Writing 4294967296 to pipe-max-size therefore succeeds and stores PAGE_SIZE.
Reject values above UINT_MAX before narrowing them, so the sysctl handler returns EINVAL without changing the stored limit.
--- fs/pipe.c | 3 +++ 1 file changed, 3 insertions(+)
fs/pipe.c +3 -0
@@ -1566,6 +1566,9 @@ static struct file_system_type pipe_fs_type = {static ulong round_pipe_size_ul (ulong size) { +if (size >UINT_MAX ) +return 0 ; +return round_pipe_size (size); }
base-commit: f47d223627f80cb7a1eb14c585fe6cb35de5e984
Signature · 1 line
2.43.0
Quoted 1 line · Hungyu Lin
pipe: reject oversized pipe-max-size sysctl writes
Applied to the vfs-7.5.misc branch of the vfs/vfs.git tree. Patches in the vfs-7.5.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-7.5.misc
[1/1] pipe: reject oversized pipe-max-size sysctl writes
https://git.kernel.org/vfs/vfs/c/823a9699a475