diff options
author | 2024-12-30 19:29:00 -0500 | |
---|---|---|
committer | 2025-01-10 23:43:44 -0500 | |
commit | 1196bdce3d107194dd15f508602871ffb7ff2d0b (patch) | |
tree | f8d48778aa3cfe3269def1dc6682f0e1c59d265f /scripts/generate_rust_analyzer.py | |
parent | NFSD: Insulate nfsd4_encode_fattr4() from page boundaries in the encode buffer (diff) | |
download | wireguard-linux-1196bdce3d107194dd15f508602871ffb7ff2d0b.tar.xz wireguard-linux-1196bdce3d107194dd15f508602871ffb7ff2d0b.zip |
SUNRPC: Document validity guarantees of the pointer returned by reserve_space
A subtlety of this API is that if the @nbytes region traverses a
page boundary, the next __xdr_commit_encode will shift the data item
in the XDR encode buffer. This makes the returned pointer point to
something else, leading to unexpected behavior.
There are a few cases where the caller saves the returned pointer
and then later uses it to insert a computed value into an earlier
part of the stream. This can be safe only if either:
- the data item is guaranteed to be in the XDR buffer's head, and
thus is not ever going to be near a page boundary, or
- the data item is no larger than 4 octets, since XDR alignment
rules require all data items to start on 4-octet boundaries
But that safety is only an artifact of the current implementation.
It would be less brittle if these "safe" uses were eventually
replaced.
Reviewed-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions