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

Fix mem alignment #28

Merged
merged 4 commits into from
Jun 16, 2023
Merged

Fix mem alignment #28

merged 4 commits into from
Jun 16, 2023

Conversation

pjtatlow
Copy link
Owner

This PR resolves the issues that were surfaced by the changes in rust 1.70, where misaligned pointer dereferences now cause panics. The issues were two-fold:

  1. When allocating memory using bumpalo we weren't specifying the alignment, so adding the alignment to the layout fixed that.
  2. When getting a BucketMeta from the memory mapped data, it's likely that data won't be aligned properly. The fix for this one is to copy the data (16 bytes) to a buffer and then cast it to a *BucketMeta, which we then dereference and return.

Fixes #26

@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Patch coverage: 88.23% and project coverage change: -0.10 ⚠️

Comparison is base (00741c7) 94.50% compared to head (5a8a6f3) 94.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
- Coverage   94.50%   94.40%   -0.10%     
==========================================
  Files          21       21              
  Lines        3782     3788       +6     
==========================================
+ Hits         3574     3576       +2     
- Misses        208      212       +4     
Impacted Files Coverage Δ
src/errors.rs 75.40% <0.00%> (-5.30%) ⬇️
src/bucket.rs 97.24% <100.00%> (+0.02%) ⬆️
src/freelist.rs 97.83% <100.00%> (-0.04%) ⬇️
src/node.rs 95.82% <100.00%> (-0.25%) ⬇️
src/tx.rs 88.41% <100.00%> (-0.04%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pjtatlow pjtatlow force-pushed the fix-mem-alignment branch 2 times, most recently from 3f86bae to d9f1ee4 Compare June 16, 2023 05:58
@pjtatlow pjtatlow merged commit ef4e4bc into master Jun 16, 2023
12 checks passed
@pjtatlow pjtatlow deleted the fix-mem-alignment branch June 16, 2023 06:12
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.

Misaligned ptr
1 participant