fix(driver): reject truncated inference command buffers - #6
Draft
nihar5hah wants to merge 1 commit into
Draft
Conversation
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.
Reject truncated inference command buffers
Target: https://github.com/knewnothing-git/gpusion-driver
GpusionSubmitCommandchecks the INFER payload length usingsizeof(GPUSION_CMD_INFER). That identifier is the enum constant for thecommand type, so the check measures an integer rather than the payload.
The intended structure typedef is
GPUSION_INFER_CMD.On the macOS arm64 host with this repository's non-Windows stubs, these
sizes are 4 bytes and 48 bytes respectively. A 16-byte advertised buffer
passes the initial header check and is incorrectly dispatched as INFER.
The patch changes only the sizeof operand and adds one standalone regression
check. It checks every advertised size from 0 through 47, the complete
48-byte INFER command, a header-only NOP, and failure/completion accounting.
Backing storage remains valid so the test reproduces the incorrect acceptance
without deliberately reading outside allocated memory.
Validation:
The check fails on upstream commit ebdbd24 at the 16-byte case and passes
with the one-line correction. Windows/WDK compilation and hardware behavior
were not tested. The full-size INFER success assertion describes the existing
routing stub, not successful model inference. This patch does not address
physical-address mapping or implement the inference backend.
Prepared with AI assistance. CONTRIBUTING.md lists a ₹250 bounty for a bug
report confirmed reproducible by the maintainer and supports UPI payments.
Please confirm whether this report qualifies and whether the bounty remains
funded. Payment details can be supplied through a private channel.
Closes #5.
Draft because the contribution guide requires Intel laptop validation for kernel changes (and AMD if available). Neither hardware validation nor a Windows/WDK build is available on this macOS host. The documented scripts/test.ps1 is absent from this checkout; the standalone check above was run instead.