Re: [PATCH v2 0/2] Fix XDR encoding near page boundaries

Rick Macklem
2024-12-23T23:22:48Z

On Mon, Dec 23, 2024 at 10:07 AM <cel@kernel.org> wrote:
>
> From: Chuck Lever <chuck.lever@oracle.com>
>
> Build out the patch series to address the longstanding bug pointed
> out by J David and Rick Macklem.
>
> At least during NFSv4 COMPOUND encoding, using
> write_bytes_to_xdr_buf() seems less brittle than saving a pointer
> into the XDR encoding buffer.
>
> I have one more patch to add (not yet included) that addresses the
> issue in the NFSv4 READ and READ_PLUS encoders.
It also looks like there is a similar situation in nfsd4_encode_fattr4().
It uses attrlen_p (only a 4byte xdr_reserve_space(), so safe for now.

You might just regret choosing to not wire down the "safe to use
xdr_reserve_space() for 4 bytes" semantic, but it is obviously up to you.

rick

>
> Changes since RFC:
> - Document the guarantees around pointer returned by xdr_reserve_space()
> - Use write_bytes_to_xdr_buf() instead
>
> Chuck Lever (2):
> NFSD: Encode COMPOUND operation status on page boundaries
> SUNRPC: Document validity guarantees of the pointer returned by
> reserve_space
>
> fs/nfsd/nfs4xdr.c | 20 ++++++++++----------
> net/sunrpc/xdr.c | 3 +++
> 2 files changed, 13 insertions(+), 10 deletions(-)
>
> --
> 2.47.0
>