Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce buffer alignment #1106

Merged
merged 3 commits into from
Jan 24, 2024
Merged

Conversation

mkeeter
Copy link
Contributor

@mkeeter mkeeter commented Jan 23, 2024

This is a follow-up to #1105, so only look at the last commit (b78c987). I'm marking it as a draft until #1105 is merged; then I'll rebase it onto main.

This PR makes Buffer operations stricter: reads and writes now panic if we try to access a Buffer without block alignment. To make this less dangerous, the relevant functions are changed from pub to pub(crate), so they can't be called from the public API. Propolis only uses Buffer::new and Buffer::as_vec, so that shouldn't be an issue.

Within crucible-upstairs, I had to update the implementation of IOSpan to do read-modify-write operations; previously, three unit tests would panic under the strict regime.

@mkeeter mkeeter force-pushed the enforce-buffer-alignment branch from 4883ceb to 56d00e9 Compare January 24, 2024 17:29
@mkeeter mkeeter marked this pull request as ready for review January 24, 2024 17:29
@mkeeter
Copy link
Contributor Author

mkeeter commented Jan 24, 2024

This is now rebased and ready for review!

upstairs/src/lib.rs Outdated Show resolved Hide resolved
upstairs/src/lib.rs Outdated Show resolved Hide resolved
@mkeeter mkeeter merged commit a61bbb0 into oxidecomputer:main Jan 24, 2024
18 checks passed
@mkeeter mkeeter deleted the enforce-buffer-alignment branch January 24, 2024 19:16
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.

3 participants