Re: [ndctl PATCH v2] test/fwctl: Add Feature OOB rejection regression tests

From: Alison Schofield

Date: Tue Jul 21 2026 - 22:29:35 EST


On Tue, Jul 21, 2026 at 02:21:22PM +0800, Richard Cheng wrote:
> Add negative cases for the CXL fwctl Get Feature and Set Feature output
> buffer bounds checks.
>
> For Get Feature, request a non-zero payload while providing room only
> for the fwctl_rpc_cxl_out header. Verify that the kernel rejects the
> request with -EINVAL instead of writing past the rpc_out buffer.
>
> For Set Feature, build a valid request and set out_len to zero. Verify
> that the kernel rejects it with -EINVAL. Without the bounds check,
> kvzalloc(0) returns ZERO_SIZE_PTR and the output header write can oops
> the kernel.
>
> Both cases depend on fixes [1]. Gate the tests on the running kernel
> version so older kernels skip the unsafe requests rather than failing
> the fwctl test.
>
> [1]: https://lore.kernel.org/all/20260624134737.49166-1-icheng@xxxxxxxxxx/
> Signed-off-by: Richard Cheng <icheng@xxxxxxxxxx>
> ---

Thanks!

Reviewed-by: Alison Schofield <alison.schofield@xxxxxxxxx>

Applied to pending for NDCTL v86
https://github.com/pmem/ndctl/commits/pending/