Skip to content

checkpoint: riscv64 post-merge review follow-ups - #203

Open
congwang-mk wants to merge 2 commits into
mainfrom
riscv64-review-followups
Open

checkpoint: riscv64 post-merge review follow-ups#203
congwang-mk wants to merge 2 commits into
mainfrom
riscv64-review-followups

Conversation

@congwang-mk

Copy link
Copy Markdown
Contributor

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.

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>
@congwang-mk

Copy link
Copy Markdown
Contributor Author

@sachin2605 Please take a look. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant