Repository navigation
Conversation
Yudis-bit
force-pushed
the
fix/rpmi-shmem-name-bounds
branch
from
September 9, 2026 06:22
7044a03 to
065cae7
Compare
Contributor
Author
|
A correction to the description: The proposal bounds the stored name and explicitly terminates it. Would maintainers prefer truncating an overlong queue name, as proposed here, or rejecting it as invalid input? The validation limitation in the description still applies: no cross-build or runtime validation is reported. I also note the mailing-list submission requirement in |
fdt_stringlist_get() returns a reg-names length without the terminating NUL. Copying it into the 16-byte queue name buffer leaves no terminator when the name is exactly 16 bytes long and overwrites adjacent memory when it is longer. Copy at most 15 bytes and terminate the stored name. This preserves the existing queue setup while bounding the write for malformed device trees. Fixes: 91f46fb ("lib/utils: Add RPMI messaging protocol and shared memory transport support") Closes: riscv-software-src#417 Signed-off-by: Yudistira Putra <pyudistira519@gmail.com>
Yudis-bit
force-pushed
the
fix/rpmi-shmem-name-bounds
branch
from
September 29, 2026 10:11
065cae7 to
80ce3a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rpmi_shmem_transport_init()copies a device-treereg-namesentry into the 16-byteqctx->namebuffer.fdt_stringlist_get()reports the string length without its terminating NUL. A 16-character name fills the buffer without a terminator; a name longer than 16 characters writes past it. The copy currently has no length check.Fix
Copy at most
RPMI_NAME_CHARS_MAX - 1bytes and terminate the stored name. Longer entries are truncated. This bounds the write without changing queue selection, which uses the queue index.Validation
gcc-riscv64-linux-gnu. The CI branch used the same source tree as this PR; only this commit's message changed afterward.git diff --checkpassed.Closes #417.
OpenSBI asks for patches on its mailing list. This PR is a discussion link; the patch is being prepared for that review path.