checkpoint: riscv64 post-merge review follow-ups - #203
Open
congwang-mk wants to merge 2 commits into
Open
Conversation
The riscv64 sc_fpregs memcpy carries no bound of its own: it is safe only because validate rejects fpstate_len > FP_MAX and FP_MAX (516) happens to fit the 528-byte field. Nothing enforced that relation, so raising FP_MAX or shrinking the struct would silently turn the copy into a stack overflow inside the signal frame. Assert it at the struct definition, next to the copy it protects. Signed-off-by: Cong Wang <cwang@multikernel.io>
Capture and rearm_restartable_syscall each carried their own copy of the sentinel check plus a near-identical multi-line error, and the two messages had already drifted. Route both through one helper so the check and its wording cannot diverge again. Signed-off-by: Cong Wang <cwang@multikernel.io>
Contributor
Author
|
@sachin2605 Please take a look. Thanks |
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.
Two follow-ups from the post-merge review of #192.
Assert FP_MAX fits sc_fpregs in the restore stub. The riscv64 sc_fpregs memcpy has no bound of its own: it is safe because validate rejects fpstate_len > FP_MAX and FP_MAX (516) fits the 528-byte field, but nothing enforced that relation. Raising FP_MAX or shrinking the struct would silently turn the copy into a stack overflow inside the signal frame, so a _Static_assert now pins it at the struct definition.
Share the riscv64 restart-sentinel rejection. Capture and rearm_restartable_syscall each carried their own copy of the sentinel check plus a near-identical multi-line error, and the two messages had already drifted. Both now route through one reject_restart_sentinel helper so the check and its wording cannot diverge again.
Verified locally: the stub compiles for riscv64 (clang -fsyntax-only cross-check, which also proves the assert holds) and the 38 checkpoint lib tests pass on x86_64. The riscv64 Rust paths rely on the cross-build CI job, as usual on this machine.